<docbook><section><title>VirtSPARQLSecurityWebIDSPARQLASKExample</title><title> Constraining Resource Access To Group Members</title> Constraining Resource Access To Group Members
<para>The following example demonstrates how you can leverage the combined power of a SPARQL ASK Query and Web-accessible Linked Data en route to constraining access to a protected resource.
 Basically, you put two resource to use:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem>A protected resource accessible from a location on the Web via its URL . </listitem>
<listitem>A read-only resource accessible from a location on the Web that describes a Group and its Membership.</listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Prerequisites</bridgehead>
<para>The following packages should be installed, prior to performing this exercise:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="https://virtuoso.openlinksw.com/download/">ods_framework_dav.vad</ulink> </listitem>
<listitem><ulink url="https://virtuoso.openlinksw.com/download/">ods_briefcase_dav.vad</ulink></listitem>
</itemizedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">  1. Describe your group and it membership via a Turtle document, for instance (you can user other RDF model syntaxes, but we choose use Turtle for its simplicity)</bridgehead>
<orderedlist spacing="compact"><listitem>Group Description using terms from the FOAF &amp; RDFS vocabularies : <programlisting>@prefix rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; . 
@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt; . 
@prefix : &lt;#&gt; . 

&lt;&gt; foaf:topic :Group . 
&lt;&gt; rdfs:label &quot;Social Semantics &amp; ACLs Demo&quot; . 
&lt;&gt; rdfs:comment &quot;Members of this group provide the basis for a Resource Access Policy scoped to this group.&quot; . 
:Group a foaf:Group . 
:Group foaf:member &lt;http://id.myopenlink.net/dataspace/person/kate#this&gt; , 
                   &lt;http://id.myopenlink.net/dataspace/person/john#this&gt; . 

</programlisting></listitem>
<listitem>The document content above implies that &lt;<ulink url="http://web.ods.openlinksw.com/DAV/home/demo/Public/group.ttl#Groupgt;">http://web.ods.openlinksw.com/DAV/home/demo/Public/group.ttl#Groupgt;</ulink> denotes the Group.</listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> 2. Create a Web document comprised of content that describes the group</bridgehead>
<para>Publish the Turtle Document to a Web accessible location, using ODS-Briefcase, as follows:</para>
<orderedlist spacing="compact"><listitem>Log in at <ulink url="http://web.ods.openlinksw.com/ods">http://web.ods.openlinksw.com/ods</ulink> -&gt;Sign In and enter user&#39;s credentials: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex1.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex1.png" /></figure></ulink> </listitem>
<listitem>Go to Briefcase and navigate for to its Public folder: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex2.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex2.png" /></figure></ulink> </listitem>
<listitem>Click &quot;Create&quot;: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex3.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex3.png" /></figure></ulink> </listitem>
<listitem>In the presented form: <orderedlist spacing="compact"><listitem>Give a name to the file that will denote your Group, for ex.: group.ttl </listitem>
<listitem>Specify the file mime type: text/turtle </listitem>
<listitem>Paste Turtle based content from above into the editing space: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex4.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex4.png" /></figure></ulink> </listitem>
</orderedlist></listitem>
<listitem>Finally click &quot;Create&quot;.
</listitem>
<listitem>Your file should be created and displayed Briefcase&#39;s folder viewer: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex5.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex5.png" /></figure></ulink> <itemizedlist mark="bullet" spacing="compact"><listitem>Note: if you not using the &quot;Public&quot; folder (which provides public access by default), please make sure you set make the document available to the public, i.e.
 it should have permissions: <programlisting>rw-r--r--
</programlisting></listitem>
</itemizedlist></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> 3. Create a Web document that should only be accessible to members of the new group</bridgehead>
<orderedlist spacing="compact"><listitem>Assuming you (an ODS account holder named &#39;William&#39;) want to only share the image resource (below) with two people: Kate and John, please perform the following steps: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex6.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex6.png" /></figure></ulink> </listitem>
<listitem>Go to <ulink url="http://host:port/ods">http://host:port/ods</ulink> and login with your credentials: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex7.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex7.png" /></figure></ulink> </listitem>
<listitem>Click on the Briefcase application link and click on the &quot;New Folder&quot; menu item to create the sub-folder: &quot;albums&quot;: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex8.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex8.png" /></figure></ulink> </listitem>
<listitem>Click &quot;Create&quot;.
</listitem>
<listitem>The new created folder should be presented in the list of folders and resources for user William: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex9.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex9.png" /></figure></ulink> </listitem>
<listitem>Go to &quot;albums&quot; folder and using the &quot;Upload&quot; feature upload the image &quot;OpenLink.png&quot; from above: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex10.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex10.png" /></figure></ulink> <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex11.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex11.png" /></figure></ulink></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> 4. Share the Web document URL with group members.</bridgehead>
<orderedlist spacing="compact"><listitem>For the uploaded image &quot;Openlink.png&quot; from above, navigate to the Briefcase UI DAV path containing the image, and click its &quot;Update Properties&quot; link: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex12.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex12.png" /></figure></ulink> <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex13.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex13.png" /></figure></ulink> </listitem>
<listitem>Go to &quot;Sharing&quot;: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex14.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex14.png" /></figure></ulink> </listitem>
<listitem>In &quot;<ulink url="WebID">WebID</ulink> users&quot; section click the green &quot;plus&quot; button with label &quot;Add&quot;: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex15.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex15.png" /></figure></ulink> </listitem>
<listitem>In the presented form: <orderedlist spacing="compact"><listitem>Change &quot;Access type&quot; to &quot;Advanced&quot;; </listitem>
<listitem>For &quot;Criteria&quot; click the green &quot;plus&quot; button and select &quot;Certificate - SPARQL ASK&quot; <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex16.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex16.png" /></figure></ulink> </listitem>
<listitem>Should appear a drop-down menu list with 2 values: &quot;equal to&quot; and &quot;not equal to&quot;.
 Select the &quot;equal to&quot; value: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex17.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex17.png" /></figure></ulink> </listitem>
<listitem>Should appear a drop-down menu list with 2 values: &quot;yes&quot; and &quot;no&quot;.
 Leave the default presented value &quot;yes&quot; as selected: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex18.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex18.png" /></figure></ulink> </listitem>
<listitem>Modify the SPARQL ASK statement by replacing it with this one: <programlisting>DEFINE get:soft &quot;replace&quot;
PREFIX sioc: &lt;http://rdfs.org/sioc/ns#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
ASK FROM &lt;http://web.ods.openlinksw.com/DAV/home/demo/Public/group.ttl&gt;
WHERE {&lt;http://web.ods.openlinksw.com/DAV/home/demo/Public/group.ttl#Group&gt;
                       foaf:member ?x}
</programlisting><ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex19.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex19.png" /></figure></ulink> </listitem>
</orderedlist></listitem>
<listitem>Click &quot;Update&quot;: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex20.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex20.png" /></figure></ulink></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> 5. View the shared document</bridgehead>
<orderedlist spacing="compact"><listitem>As per the sharing done from above, users Kate and John should be able to see the Web document  <ulink url="https://host-port//DAV/home/William/albums/OpenLink.png">https://host-port//DAV/home/William/albums/OpenLink.png</ulink>  if they authenticate with <ulink url="http://ods.openlinksw.com/wiki/ODS/ODSGenerateX509Certificate">X 509. Watermarked Certificate</ulink> containing the <ulink url="http://ods.openlinksw.com/wiki/ODS/ODSGenerateX509Certificate">WebIDs</ulink> included in the group.ttl from above.
</listitem>
<listitem>Navigate to  <ulink url="https://host-port//DAV/home/William/albums/OpenLink.png">https://host-port//DAV/home/William/albums/OpenLink.png</ulink>  </listitem>
<listitem>When prompted for authentication, select for ex.
 John&#39;s X 509 <ulink url="WebID">WebID</ulink> Watermarked Certificate: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex21.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex21.png" /></figure></ulink> </listitem>
<listitem>John should successfully view the shared Web document -- in our example a simple image: <ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample/askex22.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSPARQLASKExample/askex22.png" /></figure></ulink></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="https://plus.google.com/112399767740508618350/posts/i1WnaThyy2u">Confining Resource (Data) Access to a Group Entity</ulink> </listitem>
<listitem><ulink url="http://www.youtube.com/watch?v=gzqHVUb3qrw&amp;feature=share">Power of WebID + OpenID Hybrid Protocol via Internet Explorer &amp; Windows</ulink> </listitem>
<listitem><ulink url="http://www.youtube.com/watch?v=eXoxUo7Py4M&amp;feature=share">Using Safari to Demonstrate WebID + OpenID Hybrid Protocol Power!</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSPARQLEndpointProtection">Safeguarding your Virtuoso-hosted SPARQL Endpoint</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtTipsAndTricksGuideSPARQLEndpointProtection">SPARQL Endpoint Protection Methods Collection</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample">Constraining Resource Access Using Social Relationship Semantics and WebID</ulink> </listitem>
<listitem><ulink url="http://docs.openlinksw.com/virtuoso/">Virtuoso documentation</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://docs.openlinksw.com/virtuoso/rdfsparql.html#rdfsupportedprotocolendpoint">SPARQL Service Endpoint</ulink> </listitem>
<listitem><ulink url="http://docs.openlinksw.com/virtuoso/rdfsparql.html#rdfsupportedprotocolendpointuri">Service Endpoint Security</ulink> </listitem>
<listitem><ulink url="http://docs.openlinksw.com/virtuoso/rdfsparql.html#sparqwebservicetbl">Managing a SPARQL Web Service Endpoint</ulink> </listitem>
<listitem><ulink url="http://docs.openlinksw.com/virtuoso/rdfsparql.html">SPARQL</ulink> </listitem>
</itemizedlist></listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtTipsAndTricksGuide">Virtuoso Tips and Tricks Collection</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSPARQLDET">SPARQL Endpoint DET Configuration Guide</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSPARQLSecurityWebID">WebID Protocol &amp; SPARQL Endpoint ACLs Tutorial</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtOAuthSPARQL">SPARQL OAuth Tutorial</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtTipsAndTricksGuideSPARQLEndpoints">Securing SPARQL endpoints</ulink> </listitem>
</itemizedlist></listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/OdsSPARQLAuth">SPARUL over SPARQL using the http://cname:port/sparql-auth endpoint</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtAuthServerUI">Virtuoso Authentication Server UI</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSPARQLSSL">Manage a SPARQL-WebID based Endpoint</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/VirtODSSecurityWebID">WebID Protocol Support in OpenLink Data Spaces</ulink>.
</listitem>
<listitem>Manage ODS Datadspaces Objects <ulink url="WebID">WebID</ulink> Access Control Lists (ACLs): <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSBriefcaseWebID">ODS Briefcase WebID based ACL Guide</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSBriefcaseWebIDPerson">Person Entity WebID based ACL Guide</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSBriefcaseWebIDGroup">Group Entity WebID based ACL Guide</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSBriefcaseWebIDPublic">Public WebID based ACL Guide</ulink> </listitem>
</itemizedlist></listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSFeedManagerWebIDACL">ODS Feed Manager WebID based ACL Guide</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSFeedManagerWebIDACLPerson">Person Entity Specific ACL</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSFeedManagerWebIDACLGroup">Group Entity Specific ACL</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSFeedManagerWebIDACLPublic">Public Specific ACL for anyone with a WebID</ulink> </listitem>
</itemizedlist></listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSCalendarWebIDACL">ODS Calendar WebID based ACL Guide</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSCalendarWebIDACLPerson">Person Entity Specific ACL</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSCalendarWebIDACLGroup">Group Entity Specific ACL</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSCalendarWebIDACLPublic">Public Specific ACL for anyone with a WebID</ulink> </listitem>
</itemizedlist></listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSBookmarksWebIDACL">ODS Bookmark Manager WebID based ACL Guide</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSBookmarksWebIDACLPerson">Person Entity Specific ACL</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSBookmarksWebIDACLGroup">Group Entity Specific ACL</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSBookmarksWebIDACLPublic">Public Specific ACL for anyone with a WebID</ulink> </listitem>
</itemizedlist></listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSAddressBookWebIDACL">ODS Addressbook  WebID based ACL Guide</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSAddressBookWebIDACLPerson">Person Entity Specific ACL</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSAddressBookWebIDACLGroup">Group Entity Specific ACL</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSAddressBookWebIDACLPublic">Public Specific ACL for anyone with a WebID</ulink> </listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSPkiSetup">Guide for Set up a X.509 certificate issuer and HTTPS listener and generate ODS user certificates</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSSetupSSL">Configure Virtuoso+ODS instance as an X.509 Certificate Authority and HTTPS listener</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSetupSSL">Configure Virtuoso instance as an X.509 Certificate Authority and HTTPS listener</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/VirtODSPubSubHub">Setting up PubSubHub in ODS</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/VirtPubSubHub">PubSubHub Demo Client Example</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/VirtFeedPubSubHub">Feed subscription via PubSubHub protocol Example</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/VirtPubSubHubACL">Setting Up PubSubHub to use WebID Protocol or IP based control lists</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/OdsKeyImport">CA Keys Import using Conductor</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSGenerateWebIDX509CertOSKeystore">Generate an X.509 Certificate (with a WebID watermark) to be managed by host operating system keystore</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSGenerateWebIDX509CertBrsKeystore">Generate an X.509 Certificate (with a WebID watermark) to be managed by a browser-based keystore</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSWebIDIdP">Using Virtuoso&#39;s WebID Verification Proxy Service with a WebID-bearing X.509 certificate</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSWebIDIdpProxy">Using Virtuoso&#39;s WebID Identity Provider (IdP) Proxy Service with an X.509 certificate</ulink> </listitem>
<listitem><ulink url="http://ods.openlinksw.com/wiki/ODS/ODSBriefcaseWebIDShareFile">ODS Briefcase WebID Protocol Share File Guide</ulink> </listitem>
<listitem><ulink url="http://esw.w3.org/topic/foaf+ssl">WebID Protocol Specification</ulink> </listitem>
<listitem><ulink url="https://foaf.me/simpleLogin.php">Test WebID Protocol Certificate page</ulink> </listitem>
<listitem><ulink url="http://test.foafssl.org/cert/">WebID Protocol Certificate Generation page</ulink> </listitem>
</itemizedlist></section></docbook>