<docbook><section><title>VirtTipsAndTricksDiscoverSPARQFedCapabilitiesSPARQL</title><title>Adding SPARQL Endpoint Capabilities Interrogation to Virtuoso SPARQL-FED functionality</title>Adding SPARQL Endpoint Capabilities Interrogation to Virtuoso SPARQL-FED functionality
<bridgehead class="http://www.w3.org/1999/xhtml:h2">What?</bridgehead>
 Discover the capabilities of a SPARQL endpoint en route to enhancing SPARQL-FED usage from Virtuoso instances by granting special roles to &quot;SPARQL&quot;.<bridgehead class="http://www.w3.org/1999/xhtml:h2">Why?</bridgehead>
 Virtuoso service endpoints can interact with the Virtuoso compiler and in case of errors, for example when using  SPARQL LOAD SERVICE &lt;<ulink url="http://example.com/sparql&gt;">http://example.com/sparql&gt;</ulink> DATA   , it can execute the appropriate LOAD SERVICE ...
 DATA by itself and retry the failed query.<bridgehead class="http://www.w3.org/1999/xhtml:h2">How?</bridgehead>
<para>Adding SPARQL Endpoint Capabilities Interrogation to Virtuoso SPARQL-FED functionality can be achieved by: </para>
<orderedlist spacing="compact"><listitem>Granting ROLE privileges to the SPARQL user ; </listitem>
<listitem>Using SPARQL-FED as per usual via SPARQL-Protocol, HTML based Query UI, or SPASQL.</listitem>
</orderedlist><para>Grant the SPARQL_LOAD_SERVICE_DATA ROLE privilege to the SPARQL user to enable the capabilities of external Virtuoso SPARQL endpoint to be determined by executing the following command from the Conductor or command line iSQL interfaces:</para>
<programlisting>GRANT SPARQL_LOAD_SERVICE_DATA to &quot;SPARQL&quot; ;
</programlisting><para> Once executed when running SPARQL-FED queries the source SPARQL endpoint will interrogate the remote source en route to best understanding its capabilities for optimum execution of the SPARQL-FED queries.
 The &quot;best effort&quot; determination of capabilities is done by a combination of the following:</para>
<orderedlist spacing="compact"><listitem>Service Description Document </listitem>
<listitem>SPARQL 1.1 queries.</listitem>
</orderedlist><para>The following curl command can be used to obtain the service description for a given SPARQL endpoint: </para>
<programlisting>curl -iLH &quot;Accept: text/turtle&quot; http://linkeddata.uriburner.com/sparql
</programlisting><para> Example usage:</para>
<orderedlist spacing="compact"><listitem>Execute from iSQL: <programlisting>SQL&gt; grant SPARQL_LOAD_SERVICE_DATA to &quot;SPARQL&quot;;
Done. -- 3 msec.
SQL&gt; grant SPARQL_SPONGE to &quot;SPARQL&quot;;
Done. -- 3 msec.
</programlisting></listitem>
<listitem>From the <ulink url="http://host:port/sparql">http://host:port/sparql</ulink> endpoint execute as an anonymous user the following query: <programlisting>SELECT DISTINCT ?Entity
WHERE {SERVICE &lt;http://dbmi-icode-01.dbmi.pitt.edu:8080/sparql&gt;
      {SELECT *
       WHERE { ?Entity ?Relation ?EntityType} limit 50
     }
    }
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://bit.ly/1E5FLq5">View the SPARQL Query Definition via SPARQL Protocol URL</ulink>; </listitem>
<listitem><ulink url="http://bit.ly/1yJ4C08">View the SPARQL Query Results via SPARQL Protocol URL</ulink>;</listitem>
</itemizedlist></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://www.w3.org/TR/sparql11-service-description/">W3C SPARQL 1.1 Service Description</ulink> </listitem>
<listitem><ulink url="http://linkeddata.uriburner.com/c/8B2FXO">SPARQL Service Description Ontology</ulink> </listitem>
<listitem><ulink url="VirtTipsAndTricksDiscoverSPARQFedCapabilities">How to discover the capabilities of a SPARQL endpoint to enhancing SPARQL-FED usage from Virtuoso instances?</ulink> </listitem>
<listitem><ulink url="VirtTipsAndTricksGuide">Virtuoso Tips and Tricks Collection</ulink></listitem>
</itemizedlist></section></docbook>