<docbook><section><title>VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample</title><para> </para>
<title> Constraining Resource Access Using Social Relationship Semantics and WebID</title> Constraining Resource Access Using Social Relationship Semantics and <ulink url="WebID">WebID</ulink>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Introduction</bridgehead>
<para>The following example demonstrates how you can leverage the combined power of a SPARQL ASK Query, Social Relationship Semantics, and Web-accessible Linked Data to constrain access to a protected resource.
 Basically, you need to:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem>Set a foaf:knows relationship in your user&#39;s profile </listitem>
<listitem>Set an ACL rule that requires you to prove (via <ulink url="WebID">WebID</ulink> protocol and a Linked Data based profile resource) that you have a <ulink url="WebID">WebID</ulink> that&#39;s in a knows relation with our example user </listitem>
<listitem>Create a protected resource accessible from a location on the Web via its URL</listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">  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:h2"> Steps</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> Step 1 -- Set a foaf:knows relationship in your profile</bridgehead>
<para> </para>
<orderedlist spacing="compact"><listitem>Assuming John has the following <ulink url="http://ods.openlinksw.com/wiki/ODS/ODSGenerateX509Certificate">WebID</ulink>: <programlisting>http://id.myopenlink.net/dataspace/person/john#this
</programlisting></listitem>
<listitem>Assuming Kate is friend of John and John wants to only share a resource with 1 person -- Kate.
 To be able to view this resource, Kate needs to make sure John is added as friend in her profile&#39;s data with the following relation: <programlisting>&lt;foaf:knows&gt; &lt;http://id.myopenlink.net/dataspace/person/john#this&gt;
</programlisting></listitem>
<listitem>Go to <ulink url="http://host:port/ods">http://host:port/ods</ulink> -&gt; Sign In and enter Kate&#39;s credentials: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex1.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex1.png" /></figure></ulink> </listitem>
<listitem>Go to Profile-&gt;Edit: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex2.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex2.png" /></figure></ulink> </listitem>
<listitem>Go to &quot;Annotations&quot;: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex3.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex3.png" /></figure></ulink> </listitem>
<listitem>In the presented form enter: <itemizedlist mark="bullet" spacing="compact"><listitem>&quot;Relation&quot;: foaf:knows ; </listitem>
<listitem>&quot;URI&quot;:  <ulink url="http://id.myopenlink.net/dataspace/person/john#this">http://id.myopenlink.net/dataspace/person/john#this</ulink>  ; </listitem>
<listitem>&quot;Label&quot;: John <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex4.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex4.png" /></figure></ulink> </listitem>
</itemizedlist></listitem>
<listitem>Click &quot;Add&quot;: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex5.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex5.png" /></figure></ulink></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> Step 2 -- Create a Web Resource that should only be accessible to people that are friends to John</bridgehead>
<orderedlist spacing="compact"><listitem>Go to <ulink url="http://host:port/ods">http://host:port/ods</ulink> and log in with John&#39;s credentials: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex6.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex6.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;<ulink url="WebIDPlayground">WebIDPlayground</ulink>&quot;: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex7.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex7.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 John: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex8.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex8.png" /></figure></ulink> </listitem>
<listitem>Go to &quot;<ulink url="WebIDPlayground">WebIDPlayground</ulink>&quot; folder and using the &quot;Upload&quot; feature upload a resource, ex.
 an image &quot;OpenLink.png&quot; from above: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex9.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex9.png" /></figure></ulink> <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex10.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex10.png" /></figure></ulink></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Step 3 -- Share the Web Resource URL with people that are friends of John</bridgehead>
<orderedlist spacing="compact"><listitem>For the create folder &quot;<ulink url="WebIDPlayground">WebIDPlayground</ulink>&quot; from above, click its &quot;Update Properties&quot; link: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex11.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex11.png" /></figure></ulink> <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex12.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex12.png" /></figure></ulink> </listitem>
<listitem>Go to &quot;Sharing&quot;: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex13.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex13.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="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex14.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex14.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="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex15.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex15.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="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex16.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex16.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="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex17.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex17.png" /></figure></ulink> </listitem>
<listitem>Modify the SPARQL ASK statement by replacing it with this one: <programlisting>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 where {^{webid}^ rdf:type foaf:Person;
                foaf:knows &lt;http://id.myopenlink.net/dataspace/person/john#this&gt;}
</programlisting><ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex18.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex18.png" /></figure></ulink> </listitem>
</orderedlist></listitem>
<listitem>Click &quot;Update&quot;: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex19.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex19.png" /></figure></ulink></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> Step 4 -- View the shared document</bridgehead>
<orderedlist spacing="compact"><listitem>As per the sharing done from above, Kate should be able to see the Web resource  <ulink url="https://host:port/DAV/home/John/WebIDPlayground/">https://host:port/DAV/home/John/WebIDPlayground/</ulink>  if she authenticates with her <ulink url="http://ods.openlinksw.com/wiki/ODS/ODSGenerateX509Certificate">X 509. WebID Watermarked Certificate</ulink> </listitem>
<listitem>Navigate to  <ulink url="https://host:port/DAV/home/John/WebIDPlayground/">https://host:port/DAV/home/John/WebIDPlayground/</ulink>  </listitem>
<listitem>When prompted for authentication, select for Kate&#39;s X 509 <ulink url="WebID">WebID</ulink> Watermarked Certificate: <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex20.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex20.png" /></figure></ulink> </listitem>
<listitem>Kate should successfully view the shared Web document -- <ulink url="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex21.png"><figure><graphic fileref="VirtSPARQLSecurityWebIDSocialRelationshipSPARQLASKExample/arskex21.png" /></figure></ulink></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="https://plus.google.com/112399767740508618350/posts/7A3Kgs4HMHk">Using Social Relationship Semantics and WebID to Drive Resource Access Control</ulink> </listitem>
<listitem><ulink url="VirtSPARQLSecurityWebIDSPARQLASKExample">Constraining Resource Access To Group Members</ulink> </listitem>
<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://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>