<docbook><section><title>VirtEvaluatorGuideLinkedDataDeployment</title><title> Evaluator&#39;s Guide to Linked Data Deployment</title> Evaluator&#39;s Guide to Linked Data Deployment
<para>This guide will shows how to deploy Linked Data for Objects in an RDF Resource File (physical) or Linked Data Views (Virtual) </para>
<itemizedlist mark="bullet" spacing="compact"><listitem>To include both from references with specific examples for Physical and Virtual Resources </listitem>
<listitem>to include Mapping Rules </listitem>
<listitem>the list to consist of: <orderedlist spacing="compact"><listitem>11 ways to get RDF into Virtuoso </listitem>
<listitem>SPARQL Optimization </listitem>
<listitem>Linked Data Deployment</listitem>
</orderedlist></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2"> 11 ways to get RDF into Virtuoso</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> HTTP Post using Content-Type: application/sparql-query</bridgehead>
<para>With POST can be accomplished SPARQL Insert/Update etc.</para>
<para>The result is in the rdf_quad.</para>
<para>With GET Methods you can get the triples which are saved.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h4"> Examples</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h5"> Example 1</bridgehead>
<orderedlist spacing="compact"><listitem>Create a DAV collection xx for user demo with password demo.
</listitem>
<listitem>Execute the following command: <programlisting>curl -i -d &quot;INSERT {&lt;http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this&gt;
&lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://rdfs.org/sioc/ns#User&gt;}&quot; -u &quot;demo:demo&quot;
-H &quot;Content-Type: application/sparql-query&quot; http://localhost:8890/DAV/xx/yy
</programlisting></listitem>
<listitem>The response should be: <programlisting>HTTP/1.1 201 Created
Server: Virtuoso/05.00.3023 (Win32) i686-generic-win-32  VDB
Connection: Keep-Alive
Content-Type: text/html; charset=ISO-8859-1
Date: Fri, 28 Dec 2007 12:50:12 GMT
Accept-Ranges: bytes
MS-Author-Via: SPARQL
Content-Length: 0
</programlisting></listitem>
<listitem>The result in the DAV/xx location will be a new <ulink url="WebDAV">WebDAV</ulink> resource with name &quot;yy&quot; containing the following: <itemizedlist mark="bullet" spacing="compact"><listitem>if opened with Conductor: <programlisting>CONSTRUCT { ?s ?p ?o } FROM &lt;http://localhost:8890/DAV/xx/yy&gt; WHERE { ?s ?p ?o }
</programlisting></listitem>
<listitem>if opened with GET, then the content will be RDF representation of what was inserted into the graph, i.e.
<programlisting>      &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
      &lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;
      xmlns:rdfs=&quot;http://www.w3.org/2000/01/rdf-schema#&quot;&gt;
      &lt;rdf:Description
      rdf:about=&quot;http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this&quot;&gt;
      &lt;ns0pred:type xmlns:ns0pred=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;
      rdf:resource=&quot;http://rdfs.org/sioc/ns#User&quot;/&gt;
      &lt;/rdf:Description&gt;
      &lt;/rdf:RDF&gt;
</programlisting> </listitem>
</itemizedlist></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h5"> Example 2</bridgehead>
<orderedlist spacing="compact"><listitem>Create a DAV collection, for ex.
 with name &quot;test&quot; for user ( for ex.
 demo).
</listitem>
<listitem>Execute the following command: <programlisting>curl -i -d &quot;INSERT IN GRAPH &lt;http://mygraph.com&gt;
{ &lt;http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this&gt;
  &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt;
  &lt;http://rdfs.org/sioc/ns#User&gt; .
  &lt;http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this&gt;
  &lt;http://www.w3.org/2000/01/rdf-schema#label&gt;
  &lt;Kingsley Uyi Idehen&gt; .
  &lt;http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this&gt;
  &lt;http://rdfs.org/sioc/ns#creator_of&gt;

&lt;http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300&gt;
  } &quot; -u &quot;demo:demo&quot; -H &quot;Content-Type: application/sparql-query&quot; http://localhost:8890/DAV/home/demo/test/myrq
</programlisting></listitem>
<listitem>As result the response will be: <programlisting>HTTP/1.1 201 Created
Server: Virtuoso/05.00.3023 (Win32) i686-generic-win-32  VDB
Connection: Keep-Alive
Content-Type: text/html; charset=ISO-8859-1
Date: Thu, 20 Dec 2007 16:25:25 GMT
Accept-Ranges: bytes
MS-Author-Via: SPARQL
Content-Length: 0
</programlisting></listitem>
<listitem>Now let&#39;s check the inserted triples.
 Go to the sparql endpoint, i.e.
 <ulink url="http://localhost:8890/sparql">http://localhost:8890/sparql</ulink> and: <itemizedlist mark="bullet" spacing="compact"><listitem>Enter for Default Graph URI: <programlisting>http://mygraph.com
</programlisting></listitem>
<listitem>Enter in the Query area: <programlisting>      SELECT * WHERE {?s ?p ?o}
</programlisting></listitem>
<listitem>Click the button &quot;Run Query&quot; </listitem>
<listitem>As result will be shown the inserted triples: <programlisting>      s  	                                                          p                                                 o
      http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this   http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://rdfs.org/sioc/ns#User
      http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this   http://www.w3.org/2000/01/rdf-schema#label 	    Kingsley
      http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this   http://rdfs.org/sioc/ns#creator_of                http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300
</programlisting></listitem>
</itemizedlist></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> HTTP PUT using Content-Type: application/rdf+xml</bridgehead>
<para>The URI in a PUT request identifies the entity enclosed with the request.
 Therefore using HTTP PUT is a more useful and meaningful command than using POST (which is more about submitting data to a script).</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h4"> Example</bridgehead>
<orderedlist spacing="compact"><listitem>Suppose there is myfoaf.rdf file with the following content: <programlisting>&lt;rdf:RDF xmlns=&quot;http://www.example/jose/foaf.rdf#&quot;
    xmlns:foaf=&quot;http://xmlns.com/foaf/0.1/&quot;
    xmlns:log=&quot;http://www.w3.org/2000/10/swap/log#&quot;
    xmlns:myfoaf=&quot;http://www.example/jose/foaf.rdf#&quot;
    xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt;

    &lt;foaf:Person rdf:about=&quot;http://www.example/jose/foaf.rdf#jose&quot;&gt;
        &lt;foaf:homepage rdf:resource=&quot;http://www.example/jose/&quot;/&gt;
        &lt;foaf:knows rdf:resource=&quot;http://www.example/jose/foaf.rdf#juan&quot;/&gt;
        &lt;foaf:name&gt;Jose Jimen~ez&lt;/foaf:name&gt;
        &lt;foaf:nick&gt;Jo&lt;/foaf:nick&gt;
        &lt;foaf:workplaceHomepage rdf:resource=&quot;http://www.corp.example/&quot;/&gt;
    &lt;/foaf:Person&gt;

    &lt;foaf:Person rdf:about=&quot;http://www.example/jose/foaf.rdf#juan&quot;&gt;
        &lt;foaf:mbox rdf:resource=&quot;mailto:juan@mail.example&quot;/&gt;
    &lt;/foaf:Person&gt;

    &lt;foaf:Person rdf:about=&quot;http://www.example/jose/foaf.rdf#julia&quot;&gt;
        &lt;foaf:mbox rdf:resource=&quot;mailto:julia@mail.example&quot;/&gt;
    &lt;/foaf:Person&gt;

    &lt;rdf:Description rdf:about=&quot;http://www.example/jose/foaf.rdf#kendall&quot;&gt;
        &lt;foaf:knows rdf:resource=&quot;http://www.example/jose/foaf.rdf#edd&quot;/&gt;
    &lt;/rdf:Description&gt;
&lt;/rdf:RDF&gt;
</programlisting></listitem>
<listitem>Now let&#39;s upload the myfoaf.rdf file to destination server demo.openlinksw.com for user demo: <programlisting>curl -T myfoaf.rdf http://demo.openlinksw.com/DAV/home/demo/rdf_sink/myfoaf.rdf -u demo:demo
</programlisting></listitem>
<listitem>As result the response should be: <programlisting>&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML 2.0//EN&quot;&gt;
&lt;HTML&gt;
&lt;HEAD&gt;
  &lt;TITLE&gt;201 Created&lt;/TITLE&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
  &lt;H1&gt;Created&lt;/H1&gt;
  Resource /DAV/home/demo/rdf_sink/ myfoaf.rdf has been created.
&lt;/BODY&gt;
&lt;/HTML&gt;
</programlisting> </listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> SPARQL Insert using LOAD</bridgehead>
<para>SPARQL INSERT operation can be done using the LOAD feature.</para>
<emphasis>Example</emphasis>:<orderedlist spacing="compact"><listitem>Execute from ISQL: <programlisting>sparql insert in graph &lt;http://mygraph.com&gt;
{
  &lt;http://myopenlink.net/dataspace/Kingsley#this&gt;
  &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt;
  &lt;http://rdfs.org/sioc/ns#User&gt; .

  &lt;http://myopenlink.net/dataspace/Kingsley#this&gt;
  &lt;http://rdfs.org/sioc/ns#id&gt;
  &lt;Kingsley&gt; .

  &lt;http://myopenlink.net/dataspace/Caroline#this&gt;
  &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt;
  &lt;http://rdfs.org/sioc/ns#User&gt; .

 &lt;http://myopenlink.net/dataspace/Caroline#this&gt;
  &lt;http://rdfs.org/sioc/ns#id&gt;
  &lt;Caroline&gt; .

   &lt;http://myopenlink.net/dataspace/Matt#this&gt;
  &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt;
  &lt;http://rdfs.org/sioc/ns#User&gt; .

  &lt;http://myopenlink.net/dataspace/Matt#this&gt;
  &lt;http://rdfs.org/sioc/ns#id&gt;
  &lt;Matt&gt; .

   &lt;http://myopenlink.net/dataspace/demo#this&gt;
  &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt;
  &lt;http://rdfs.org/sioc/ns#User&gt; .

  &lt;http://myopenlink.net/dataspace/demo#this&gt;
  &lt;http://rdfs.org/sioc/ns#id&gt;
  &lt;demo&gt; .};
</programlisting></listitem>
<listitem>Create DAV collection which is visible to public, for ex: <ulink url="http://localhost:8890/DAV/tmp">http://localhost:8890/DAV/tmp</ulink> </listitem>
<listitem>Upload to the DAV collection the following file for ex.
 with name listall.rq and with the following content: <programlisting>PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX sioc: &lt;http://rdfs.org/sioc/ns#&gt;
SELECT ?x ?p ?o
FROM &lt;http://mygraph.com&gt;
WHERE
  {
    ?x rdf:type sioc:User .
    ?x ?p ?o.
    ?x sioc:id ?id .
    FILTER REGEX(str(?id), &quot;^King&quot;)
  }
ORDER BY ?x
</programlisting></listitem>
<listitem>Now from ISQL execute the following command: <programlisting>sparql
load bif:concat (&quot;http://&quot;, bif:registry_get(&quot;URIQADefaultHost&quot;), &quot;/DAV/tmp/listall.rq&quot;) into graph &lt;http://myNewGraph.com&gt;;
</programlisting></listitem>
<listitem>As result should be shown: <programlisting>callret-0
VARCHAR
_______________________________________________________________________________

Load &lt;http://localhost:8890/DAV/tmp/listall.rq&gt; into graph &lt;http://myNewGraph.com&gt; -- done

1 Rows. -- 321 msec.
</programlisting> </listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> SPARQL Insert via /sparql endpoint</bridgehead>
<para>SPARQL INSERT operation can be sent to a web service endpoint as a single statement and executed in sequence.</para>
<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h4"> Example</bridgehead>
<para>Using the Virtuoso ISQL tool or using the /sparql UI at <ulink url="http://host:port/sparql,">http://host:port/sparql,</ulink> execute the following:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem>Insert into graph <ulink url="http://example/bookStore">http://example/bookStore</ulink> 3 triples: <programlisting>      sparql insert in graph &lt;http://BookStore.com&gt;
      { &lt;http://www.dajobe.org/foaf.rdf#i&gt; &lt;http://purl.org/dc/elements/1.1/date&gt; &lt;1999-04-01T00:00:00&gt; .
        &lt;http://www.w3.org/People/Berners-Lee/card#i&gt; &lt;http://purl.org/dc/elements/1.1/date&gt; &lt;1998-05-03T00:00:00&gt; .
        &lt;http://www.w3.org/People/Connolly/#me&gt; &lt;http://purl.org/dc/elements/1.1/date&gt; &lt;2001-02-08T00:00:00&gt; };
</programlisting></listitem>
<listitem>As result will be shown the message: <programlisting>      Insert into &lt;http://BookStore.com&gt;, 3 triples -- done
</programlisting></listitem>
<listitem>Next we will select all triples from the graph <ulink url="http://example/bookStore:">http://example/bookStore:</ulink> <programlisting>      sparql select * from &lt;http://BookStore.com&gt; where {?s ?p ?o};
</programlisting></listitem>
<listitem>As result will be shown: <programlisting>      s                                              p                                       o
      VARCHAR                                        VARCHAR                                 VARCHAR
      _______________________________________________________________________________

      http://www.w3.org/People/Berners-Lee/card#i    http://purl.org/dc/elements/1.1/date    1998-05-03T00:00:00
      http://www.w3.org/People/Connolly/#me          http://purl.org/dc/elements/1.1/date    2001-02-08T00:00:00
      http://www.dajobe.org/foaf.rdf#i               http://purl.org/dc/elements/1.1/date    1999-04-01T00:00:00

      3 Rows. -- 0 msec.
</programlisting></listitem>
<listitem>Now let&#39;s insert into graph another <ulink url="http://NewBookStore.com">http://NewBookStore.com</ulink> graph&#39;s values: <programlisting>      sparql
      PREFIX dc:  &lt;http://purl.org/dc/elements/1.1/&gt;
      PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
      INSERT INTO GRAPH &lt;http://NewBookStore.com&gt; { ?book ?p ?v }
      WHERE
        { GRAPH  &lt;http://BookStore.com&gt;
         { ?book dc:date ?date
           FILTER ( xsd:dateTime(?date) &lt; xsd:dateTime(&quot;2000-01-01T00:00:00&quot;)).
           ?book ?p ?v.
         }
        };
</programlisting></listitem>
<listitem>As result will be shown: <programlisting>      callret-0
      VARCHAR
      _______________________________________________________________________________

      Insert into &lt;http://NewBookStore.com&gt;, 2 triples -- done
</programlisting></listitem>
<listitem>Finally we will check the triples from the graph NewBookStore.com: <programlisting>      SQL&gt; sparql select * from &lt;http://NewBookStore.com&gt; where {?s ?p ?o};
</programlisting></listitem>
<listitem>As result will be shown: <programlisting>      s                                             p                                      o
      VARCHAR                                       VARCHAR                                VARCHAR
      _______________________________________________________________________________

      http://www.w3.org/People/Berners-Lee/card#i   http://purl.org/dc/elements/1.1/date   1998-05-03T00:00:00
      http://www.dajobe.org/foaf.rdf#i              http://purl.org/dc/elements/1.1/date   1999-04-01T00:00:00

      2 Rows. -- 10 msec.
</programlisting> </listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> SPARQL Insert via HTTP Post using Content-Type: application/sparql-query and ODS wiki</bridgehead>
<para>With HTTP Post and ODS wiki can be written an rdf document and respectively to be performed over it INSERT/UPDATE action.</para>
<para>You can write to a file using SIOC terms for ODS-Wiki.</para>
<para>You can check with sparql the inserted / updated triples in the Quad Store.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h4"> Example</bridgehead>
<orderedlist spacing="compact"><listitem>Suppose there is ODS user test3 with ODS password 1, which has testWiki wiki instance.
</listitem>
<listitem>Execute the following: <programlisting>curl -i -d &quot;INSERT {&lt;http://localhost:8890/dataspace/test3/wiki/testWiki&gt; &lt;http://atomowl.org/ontologies/atomrdf#contains&gt; &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; . &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; &lt;http://rdfs.org/sioc/ns#has_container&gt; &lt;http://localhost:8890/dataspace/test3/wiki/testWiki&gt; . &lt;http://localhost:8890/dataspace/test3/wiki/testWiki&gt; &lt;http://atomowl.org/ontologies/atomrdf#entry&gt; &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; . &lt;http://localhost:8890/dataspace/test3/wiki/testWiki&gt; &lt;http://rdfs.org/sioc/ns#container_of&gt; &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; . &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; &lt;http://rdfs.org/sioc/ns#topic&gt;  &lt;http://localhost:8890/dataspace/test3/wiki/testWiki&gt; . &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; &lt;http://atomowl.org/ontologies/atomrdf#source&gt; &lt;http://localhost:8890/dataspace/test3/wiki/testWiki&gt; . &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://rdfs.org/sioc/types#Comment&gt; . &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://atomowl.org/ontologies/atomrdf#Entry&gt; . &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; &lt;http://www.w3.org/2000/01/rdf-schema#label&gt; &#39;MyTest&#39; . &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://atomowl.org/ontologies/atomrdf#Link&gt; . &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; &lt;http://rdfs.org/sioc/ns#content&gt; &lt;test&gt;}&quot; -u &quot;test3:1&quot; -H &quot;Content-Type: application/sparql-query&quot; http://localhost:8890/DAV/home/test3/wiki/testWiki/MyTest
</programlisting></listitem>
<listitem>As result we should have 2 files created: <itemizedlist mark="bullet" spacing="compact"><listitem>In the user DAV folder &quot;DAV/home/test3/wiki/testWiki/&quot; will be created a file &quot;<ulink url="MyTest">MyTest</ulink>&quot; with type &quot;application/sparql-query&quot;.
 You can view the content of this file from from the Conductor UI or from the user&#39;s Briefcase UI, path &quot;DAV/home/test3/wiki/testWiki&quot;.
 Its content will be: <programlisting>      &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
      &lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:rdfs=&quot;http://www.w3.org/2000/01/rdf-schema#&quot;&gt;
      &lt;rdf:Description rdf:about=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki&quot;&gt;&lt;ns0pred:entry xmlns:ns0pred=&quot;http://atomowl.org/ontologies/atomrdf#&quot; rdf:resource=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&quot;/&gt;&lt;/rdf:Description&gt;
      &lt;rdf:Description rdf:about=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&quot;&gt;&lt;ns0pred:label xmlns:ns0pred=&quot;http://www.w3.org/2000/01/rdf-schema#&quot;&gt;MyTest&lt;/ns0pred:label&gt;&lt;/rdf:Description&gt;
      &lt;rdf:Description rdf:about=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&quot;&gt;&lt;ns0pred:type xmlns:ns0pred=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; rdf:resource=&quot;http://atomowl.org/ontologies/atomrdf#Link&quot;/&gt;&lt;/rdf:Description&gt;
      &lt;rdf:Description rdf:about=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&quot;&gt;&lt;ns0pred:type xmlns:ns0pred=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; rdf:resource=&quot;http://rdfs.org/sioc/types#Comment&quot;/&gt;&lt;/rdf:Description&gt;
      &lt;rdf:Description rdf:about=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&quot;&gt;&lt;ns0pred:type xmlns:ns0pred=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; rdf:resource=&quot;http://atomowl.org/ontologies/atomrdf#Entry&quot;/&gt;&lt;/rdf:Description&gt;
      &lt;rdf:Description rdf:about=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&quot;&gt;&lt;ns0pred:has_container xmlns:ns0pred=&quot;http://rdfs.org/sioc/ns#&quot; rdf:resource=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki&quot;/&gt;&lt;/rdf:Description&gt;
      &lt;rdf:Description rdf:about=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki&quot;&gt;&lt;ns0pred:container_of xmlns:ns0pred=&quot;http://rdfs.org/sioc/ns#&quot; rdf:resource=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&quot;/&gt;&lt;/rdf:Description&gt;
      &lt;rdf:Description rdf:about=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki&quot;&gt;&lt;ns0pred:contains xmlns:ns0pred=&quot;http://atomowl.org/ontologies/atomrdf#&quot; rdf:resource=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&quot;/&gt;&lt;/rdf:Description&gt;
      &lt;rdf:Description rdf:about=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&quot;&gt;&lt;ns0pred:content xmlns:ns0pred=&quot;http://rdfs.org/sioc/ns#&quot;&gt;test&lt;/ns0pred:content&gt;&lt;/rdf:Description&gt;
      &lt;rdf:Description rdf:about=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&quot;&gt;&lt;ns0pred:topic xmlns:ns0pred=&quot;http://rdfs.org/sioc/ns#&quot; rdf:resource=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki&quot;/&gt;&lt;/rdf:Description&gt;
      &lt;rdf:Description rdf:about=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&quot;&gt;&lt;ns0pred:source xmlns:ns0pred=&quot;http://atomowl.org/ontologies/atomrdf#&quot; rdf:resource=&quot;http://localhost:8890/dataspace/test3/wiki/testWiki&quot;/&gt;&lt;/rdf:Description&gt;
      &lt;/rdf:RDF&gt;
</programlisting></listitem>
<listitem>To the user&#39;s wiki instance will be added a new <ulink url="WikiWord">WikiWord</ulink> &quot;<ulink url="MyTest">MyTest</ulink>&quot; with content the value of the SIOC term attribute &quot;content&quot;: <programlisting>      &lt;http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest&gt; &lt;http://rdfs.org/sioc/ns#content&gt; &lt;test&gt;
      i.e. the content will be &quot;test&quot;.
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>Now let&#39;s check what data was inserted in the Quad Store: <itemizedlist mark="bullet" spacing="compact"><listitem>Go to the sparql endpoint, i.e.
 for ex.
 to <ulink url="http://localhost:8890/sparql">http://localhost:8890/sparql</ulink> </listitem>
<listitem>Enter for Default Graph URI: <programlisting>      http://localhost:8890/DAV/home/test3/wiki/testWiki/MyTest
</programlisting></listitem>
<listitem>Enter for Query text: <programlisting>      SELECT * WHERE {?s ?p ?o}
</programlisting></listitem>
<listitem>Click the &quot;Run Query&quot; button.
</listitem>
<listitem>As result will be shown the inserted triples: <programlisting>      s  	                                                    p  	                                             o
      http://localhost:8890/dataspace/test3/wiki/testWiki 	    http://rdfs.org/sioc/ns#container_of 	     http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest
      http://localhost:8890/dataspace/test3/wiki/testWiki 	    http://atomowl.org/ontologies/atomrdf#entry      http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest
      http://localhost:8890/dataspace/test3/wiki/testWiki 	    http://atomowl.org/ontologies/atomrdf#contains   http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest
      http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/1999/02/22-rdf-syntax-ns#type  http://rdfs.org/sioc/types#Comment
      http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/1999/02/22-rdf-syntax-ns#type  http://atomowl.org/ontologies/atomrdf#Entry
      http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/1999/02/22-rdf-syntax-ns#type  http://atomowl.org/ontologies/atomrdf#Link
      http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/2000/01/rdf-schema#label 	     MyTest
      http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://rdfs.org/sioc/ns#has_container 	     http://localhost:8890/dataspace/test3/wiki/testWiki
      http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://rdfs.org/sioc/ns#content 	             test
      http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://rdfs.org/sioc/ns#topic 	             http://localhost:8890/dataspace/test3/wiki/testWiki
      http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://atomowl.org/ontologies/atomrdf#source     http://localhost:8890/dataspace/test3/wiki/testWiki
</programlisting></listitem>
</itemizedlist></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Using Web DAV</bridgehead>
<para>Example using <ulink url="WebDAV">WebDAV</ulink> (mount folder to DAV and dump; if this is the rdf_sink the Quad Store is updated automatically, or you can load from DAV manually to quad store)</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h4"> Examples</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h5"> Example 1: Using ODS Briefcase</bridgehead>
<orderedlist spacing="compact"><listitem>Go to your ods location, for ex.
 <ulink url="http://localhost:8890/ods">http://localhost:8890/ods</ulink> </listitem>
<listitem>Register user, for ex.
 user test1 </listitem>
<listitem>Login if not already in ods </listitem>
<listitem>Go to ODS -&gt;Briefcase </listitem>
<listitem>Create new instance </listitem>
<listitem>Go to the briefcase instance by clicking its name link </listitem>
<listitem>Upload file in a new created folder mytest or in the rdf_sink folder with: <itemizedlist mark="bullet" spacing="compact"><listitem>checked option &quot;RDF Store&quot; </listitem>
<listitem>set RDF Graph Name, for ex.
 <ulink url="http://localhost:8890/DAV/home/test1/">http://localhost:8890/DAV/home/test1/</ulink> of the current folder&gt;/ for ex.
 <ulink url="http://localhost:8890/DAV/home/test1/mytest/">http://localhost:8890/DAV/home/test1/mytest/</ulink> or <ulink url="http://localhost:8890/DAV/home/test1/rdf_sink/">http://localhost:8890/DAV/home/test1/rdf_sink/</ulink> </listitem>
<listitem>For ex.
 upload the following file with name jose.rdf.
<programlisting>      &lt;rdf:RDF xmlns=&quot;http://www.example/jose/foaf.rdf#&quot;
          xmlns:foaf=&quot;http://xmlns.com/foaf/0.1/&quot;
          xmlns:log=&quot;http://www.w3.org/2000/10/swap/log#&quot;
          xmlns:myfoaf=&quot;http://www.example/jose/foaf.rdf#&quot;
          xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt;

          &lt;foaf:Person rdf:about=&quot;http://www.example/jose/foaf.rdf#jose&quot;&gt;
              &lt;foaf:homepage rdf:resource=&quot;http://www.example/jose/&quot;/&gt;
              &lt;foaf:knows rdf:resource=&quot;http://www.example/jose/foaf.rdf#juan&quot;/&gt;
              &lt;foaf:name&gt;Jose Jimen~ez&lt;/foaf:name&gt;
              &lt;foaf:nick&gt;Jo&lt;/foaf:nick&gt;
              &lt;foaf:workplaceHomepage rdf:resource=&quot;http://www.corp.example/&quot;/&gt;
          &lt;/foaf:Person&gt;

          &lt;foaf:Person rdf:about=&quot;http://www.example/jose/foaf.rdf#juan&quot;&gt;
              &lt;foaf:mbox rdf:resource=&quot;mailto:juan@mail.example&quot;/&gt;
          &lt;/foaf:Person&gt;

          &lt;foaf:Person rdf:about=&quot;http://www.example/jose/foaf.rdf#julia&quot;&gt;
              &lt;foaf:mbox rdf:resource=&quot;mailto:julia@mail.example&quot;/&gt;
          &lt;/foaf:Person&gt;

          &lt;rdf:Description rdf:about=&quot;http://www.example/jose/foaf.rdf#kendall&quot;&gt;

              &lt;foaf:knows rdf:resource=&quot;http://www.example/jose/foaf.rdf#edd&quot;/&gt;
          &lt;/rdf:Description&gt;
      &lt;/rdf:RDF&gt;
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>Execute the following query: <programlisting>select * from &lt;&gt;
where {?s ?p ?o}
</programlisting></listitem>
<listitem>As result should be shown: <programlisting>s  	                                  p  	                                            o
http://www.example/jose/foaf.rdf#jose 	  http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://xmlns.com/foaf/0.1/Person
http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/nick 	            Jo
http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/name 	            Jose Jimen~ez
http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/knows 	            http://www.example/jose/foaf.rdf#juan
http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/homepage 	            http://www.example/jose/
http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/workplaceHomepage 	    http://www.corp.example/
http://www.example/jose/foaf.rdf#kendall  http://xmlns.com/foaf/0.1/knows 	            http://www.example/jose/foaf.rdf#edd
http://www.example/jose/foaf.rdf#julia 	  http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://xmlns.com/foaf/0.1/Person
http://www.example/jose/foaf.rdf#julia 	  http://xmlns.com/foaf/0.1/mbox 	            mailto:julia@mail.example
http://www.example/jose/foaf.rdf#juan 	  http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://xmlns.com/foaf/0.1/Person
http://www.example/jose/foaf.rdf#juan 	  http://xmlns.com/foaf/0.1/mbox 	            mailto:juan@mail.example
</programlisting></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h5"> Example 2: Using Conductor UI</bridgehead>
<orderedlist spacing="compact"><listitem>Go to Conductor UI, for ex.
 at <ulink url="http://localhost:8890/conductor">http://localhost:8890/conductor</ulink> </listitem>
<listitem>Login as dba user </listitem>
<listitem>Go to <ulink url="WebDAV">WebDAV</ulink>&amp;HTTP and create new folder, for ex.
 test </listitem>
<listitem>Upload in the folder test a file, for ex.
 the file jose.rdf from above with options: <itemizedlist mark="bullet" spacing="compact"><listitem>Destination: RDF Store </listitem>
<listitem>Set the RDF IRI</listitem>
</itemizedlist></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Using Virtuoso Crawler</bridgehead>
<para>Using Virtuoso Crawler (which includes the Sponger options so you crawl non-RDF but get RDF and this can go to the Quad Store)</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h4"> Example</bridgehead>
<orderedlist spacing="compact"><listitem>Go to Conductor UI.
 For ex.
 at <ulink url="http://localhost:8890/conductor">http://localhost:8890/conductor</ulink> </listitem>
<listitem>Login as dba user </listitem>
<listitem>Go to tab <ulink url="WebDAV">WebDAV</ulink>&amp;HTTP </listitem>
<listitem>Go to tab Content Imports </listitem>
<listitem>Click the &quot;New Target&quot; button </listitem>
<listitem>In the shown form: <itemizedlist mark="bullet" spacing="compact"><listitem>Enter for &quot;Target description&quot;: Tim Berners-Lee&#39;s electronic Business Card </listitem>
<listitem>Enter for &quot;Target URL&quot;: <ulink url="http://www.w3.org/People/Berners-Lee">http://www.w3.org/People/Berners-Lee</ulink> </listitem>
<listitem>Enter for &quot;Copy to local DAV collection&quot; for ex.: /DAV/home/demo/rdf_sink/ </listitem>
<listitem>Choose from the list &quot;Local resources owner&quot;: demo </listitem>
<listitem>Check the check.box with label &quot;Store metadata&quot;.
</listitem>
<listitem>Check all the check-boxes shown below the check-box &quot;Store metadata&quot;.
</listitem>
<listitem>Click the button &quot;Create&quot;.
<itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="VirtEvaluatorGuideLinkedDataDeployment/rdfinsert1.png" /></figure> </listitem>
</itemizedlist></listitem>
<listitem>Click the button &quot;Import Queues&quot;.
</listitem>
<listitem>For &quot;Robot target&quot; with label &quot;Tim Berners-Lee&#39;s electronic Business Card&quot; click the start link.
</listitem>
<listitem>As result should be shown t he number of the pages retrieved.
<itemizedlist mark="bullet" spacing="compact"><listitem><figure><graphic fileref="VirtEvaluatorGuideLinkedDataDeployment/rdfinsert2.png" /></figure> </listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
<listitem>Now using the sparql endpoint with sponger option &quot;Use only local data&quot; enter for Default Graph URI: <ulink url="http://www.w3.org/People/Berners-Lee">http://www.w3.org/People/Berners-Lee</ulink> and execute the following query: <programlisting>select *
where {?s ?p ?o}
</programlisting></listitem>
<listitem>As result should be shown the following triples: <programlisting>s                                       p  	                                            o
http://www.w3.org/People/Berners-Lee 	http://www.w3.org/1999/02/22-rdf-syntax-ns#type     http://xmlns.com/foaf/0.1/Document
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Answers for young people - Tim Berners-Lee
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Berners-Lee: Weaving the Web
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Declaration by Tim BL 28 Feb 1996 w.r.t. CDA challenge
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Errata - Berners-Lee: Weaving the Web
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Frequently asked questions by the Press - Tim BL
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Glossary - Weaving the Web - Berners-Lee
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Longer Bio for Tim Berners-Lee
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Michael Dertouzos has left us
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            The Future of the Web and Europe
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            The World Wide Web: Past, Present and Future
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            The World Wide Web: A very short personal history
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee - 3Com Founders chair
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee: Disclosures
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee: WWW and UU and I
http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee: WorldWideWeb, the first Web client
</programlisting> </listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Using SPARQL Query and Sponger</bridgehead>
<para>(i.e.
 we Fetch the Network Resources in the FROM Clause or values for the graph-uri parameter in SPARQL protocol URLs)</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h4"> Example</bridgehead>
<orderedlist spacing="compact"><listitem>Execute the following query: <programlisting>sparql
SELECT ?id
FROM NAMED &lt;http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/sioc.ttl&gt;
 OPTION (get:soft &quot;soft&quot;, get:method &quot;GET&quot;)
WHERE { GRAPH ?g { ?id a ?o } }
limit 10;
</programlisting></listitem>
<listitem>As result will be shown the retrieved triples: <programlisting>id
VARCHAR
_______________________________________________________________________________

http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this
http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D
http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D
http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/612
http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/612
http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/610
http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/610
http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/856
http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/856

10 Rows. -- 20 msec.
</programlisting> </listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Using Virtuoso PL APIs</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h4"> Example</bridgehead>
<para>In the example script we implement a basic mapper which maps a text/plain mime type to an imaginary ontology, which extends the class Document from FOAF with properties &#39;txt:<ulink url="UniqueWords">UniqueWords</ulink>&#39; and &#39;txt:Chars&#39;, where the prefix &#39;txt:&#39; we specify as &#39;urn:txt:v0.0:&#39;.</para>
<programlisting>use DB;

create procedure DB.DBA.RDF_LOAD_TXT_META
	(
	 in graph_iri varchar,
	 in new_origin_uri varchar,
	 in dest varchar,
         inout ret_body any,
	 inout aq any,
	 inout ps any,
	 inout ser_key any
	 )
{
  declare words, chars int;
  declare vtb, arr, subj, ses, str any;
  declare ses any;
  -- if any error we just say nothing can be done
  declare exit handler for sqlstate &#39;*&#39;
    {
      return 0;
    };
  subj := coalesce (dest, new_origin_uri);
  vtb := vt_batch ();
  chars := length (ret_body);
  -- using the text index procedures we get a list of words
  vt_batch_feed (vtb, ret_body, 1);
  arr := vt_batch_strings_array (vtb);
  -- the list has &#39;word&#39; and positions array , so we must divide by 2
  words := length (arr) / 2;
  ses := string_output ();
  -- we compose a N3 literal
  http (sprintf (&#39;&lt;%s&gt; &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://xmlns.com/foaf/0.1/Document&gt; .\n&#39;, subj), ses);
  http (sprintf (&#39;&lt;%s&gt; &lt;urn:txt:v0.0:UniqueWords&gt; &quot;%d&quot; .\n&#39;, subj, words), ses);
  http (sprintf (&#39;&lt;%s&gt; &lt;urn:txt:v0.0:Chars&gt; &quot;%d&quot; .\n&#39;, subj, chars), ses);
  str := string_output_string (ses);
  -- we push the N3 text into the local store
  DB.DBA.TTLP (str, new_origin_uri, subj);
  return 1;
}
;

--
delete from DB.DBA.SYS_RDF_MAPPERS where RM_HOOK = &#39;DB.DBA.RDF_LOAD_TXT_META&#39;;

insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
    values (&#39;(text/plain)&#39;, &#39;MIME&#39;, &#39;DB.DBA.RDF_LOAD_TXT_META&#39;, null, &#39;Text Files (demo)&#39;);

-- here we set order to some large number so don&#39;t break existing mappers
update DB.DBA.SYS_RDF_MAPPERS set RM_ID = 2000 where RM_HOOK = &#39;DB.DBA.RDF_LOAD_TXT_META&#39;;
</programlisting><orderedlist spacing="compact"><listitem>To test the mapper we just use /sparql endpoint with option &#39;Retrieve remote RDF data for all missing source graphs&#39; to execute: <programlisting>select * from &lt;http://demo.openlinksw.com:8890/tutorial/hosting/ho_s_30/WebCalendar/tools/summary.txt&gt;
where { ?s ?p ?o }
</programlisting></listitem>
<listitem>To check the results: <itemizedlist mark="bullet" spacing="compact"><listitem>Make sure the initial state of tutorial RD <emphasis>S_1 is set.
</emphasis></listitem>
<listitem>Go to <ulink url="http://demo.openlinksw.com/sparql">http://demo.openlinksw.com/sparql</ulink> </listitem>
<listitem>Enter for Default Graph URI this value: <programlisting>      http://localhost:80/tutorial/hosting/ho_s_30/WebCalendar/tools/summary.txt
</programlisting></listitem>
<listitem>Enter for Query text: <programlisting>      select *
      where {?s ?p ?o}
</programlisting></listitem>
<listitem>Click the &quot;Run Query&quot; button.
</listitem>
<listitem>As result should be shown the following triples: <programlisting>      s  	                                                                    p  	                                            o
      http://localhost:80/tutorial/hosting/ho_s_30/WebCalendar/tools/summary.txt  http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://xmlns.com/foaf/0.1/Document
      http://localhost:80/tutorial/hosting/ho_s_30/WebCalendar/tools/summary.txt  urn:txt:v0.0:UniqueWords 	                    47
      http://localhost:80/tutorial/hosting/ho_s_30/WebCalendar/tools/summary.txt  urn:txt:v0.0:Chars 	                            625
</programlisting> <emphasis>Important:</emphasis> Setting Sponger Permissions:</listitem>
</itemizedlist></listitem>
</orderedlist><para>In order to allow the Sponger to update the local RDF quad store with triples constituting the Network Resource structured data being fetched, the role &quot;SPARQL_UPDATE&quot; must be granted to the account &quot;SPARQL&quot;.
 This should normally be the case.
 If not, you must manually grant this permission.
 As with most Virtuoso DBA tasks, the Conductor provides the simplest means of doing this.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> Using SIMILE RDF Bank API</bridgehead>
<para>Virtuoso implements the HTTP-based Semantic Bank API that enables client applications to post to its RDF Triple Store.
 This method offers an alternative to using Virtuoso/PL functions or <ulink url="WebDAV">WebDAV</ulink> uploads as the triples-insertion mechanism.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h4"> Example</bridgehead>
<orderedlist spacing="compact"><listitem>From your machine go to Firefox-&gt;Tools-&gt;<ulink url="PiggyBank">PiggyBank</ulink>-&gt;My Semantic Bank Accounts </listitem>
<listitem>Add in the shown form: <itemizedlist mark="bullet" spacing="compact"><listitem>For bank: address: <ulink url="http://demo.openlinksw.com/bank">http://demo.openlinksw.com/bank</ulink> </listitem>
<listitem>For account id: demo </listitem>
<listitem>For password: demo </listitem>
</itemizedlist></listitem>
<listitem>Go to <ulink url="http://demo.openlinksw.com/ods">http://demo.openlinksw.com/ods</ulink> </listitem>
<listitem>Log in as user demo, password: demo </listitem>
<listitem>Go to the Weblog tab from the main ODS Navigation </listitem>
<listitem>Click on weblog instance name, for ex.
 &quot;demo&#39;s Weblog&quot;.
</listitem>
<listitem>When the weblog home page is loaded, click Alt + P.
</listitem>
<listitem>As result is shown the &quot;My <ulink url="PiggyBank">PiggyBank</ulink>&quot; page with all the collected information presented in items.
</listitem>
<listitem>For several of the items add Tags from the form &quot;Tag&quot; shown for each of them.
</listitem>
<listitem>As result should be shown the message &quot;Last updated: [here goes the date value].
</listitem>
<listitem>You can also click &quot;Save&quot; and &quot;Publish&quot; for these items.
</listitem>
<listitem>Go to <ulink url="http://demo.openlinksw.com/sparql">http://demo.openlinksw.com/sparql</ulink> </listitem>
<listitem>Enter for the &quot;Default Graph URI&quot; field: <ulink url="http://simile.org/piggybank/demo">http://simile.org/piggybank/demo</ulink> </listitem>
<listitem>Enter for the &quot;Query text&quot; text-area: <programlisting>prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
prefix sioc: &lt;http://rdfs.org/sioc/ns#&gt;
select *
from &lt;http://simile.org/piggybank/demo&gt;
where {?s ?p  ?o}
</programlisting></listitem>
<listitem>Click &quot;Run Query&quot;.
</listitem>
<listitem>As results are shown the found results.</listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Using RDF NET</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h4"> Example</bridgehead>
<orderedlist spacing="compact"><listitem>Execute the following query: <programlisting>SQL&gt; select DB.DBA.HTTP_RDF_NET (&#39;sparql load
&quot;http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com&quot;
into graph &lt;http://www.openlinksw.com/&gt;&#39;);
</programlisting></listitem>
<listitem>As result should be shown: <programlisting>callret
VARCHAR
_______________________________________________________

&lt;?xml version=&quot;1.0&quot; ?&gt;
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;
xmlns:vcard=&quot;http://www.w3.org/2001/vcard-rdf/3.0#&quot;
xmlns=&quot;http://example.org/book/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot;
xmlns:ns=&quot;http://example.org/ns#&quot;&gt;
&lt;rdf:Description&gt;
&lt;callret-0&gt;Load &lt;http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com&gt;
into graph &lt;http://www.openlinksw.com/&gt; -- done&lt;/callret-0&gt;
&lt;/rdf:Description&gt;
&lt;/rdf:RDF&gt;

1 Rows. -- 1982 msec.
</programlisting> </listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Virtuoso Deploying Linked Data</bridgehead>
<orderedlist spacing="compact"><listitem>Linked data: Describes recommended best practice for exposing &amp; connecting data on the Semantic Web <itemizedlist mark="bullet" spacing="compact"><listitem>Use the RDF data model </listitem>
<listitem>Identify real or abstract things (resources) in your ?universe of discourse? (Data Spaces), using URIs as unique IDs </listitem>
<listitem>Make URIs accessible via HTTP so people can discover and explore these Data Spaces </listitem>
<listitem>Allow these URIs to be dereferenced and return information </listitem>
<listitem>Include links to provide ?discovery paths? to entities in other Data Spaces </listitem>
</itemizedlist></listitem>
<listitem>Document Web Resources: In the traditional Document Web: <itemizedlist mark="bullet" spacing="compact"><listitem>All resources are document-orientated </listitem>
<listitem>URI dereferencing returns a document </listitem>
<listitem>Rendered representation is nearly always a document </listitem>
<listitem>No real distinction between a resource and its representation </listitem>
<listitem>Such resources have been referred to as ?information resources? </listitem>
</itemizedlist></listitem>
<listitem>Semantic Web Resources: In the Semantic Web: <itemizedlist mark="bullet" spacing="compact"><listitem>A URI identifies a thing (piece of data) in a data space </listitem>
<listitem>The identity of a thing is distinct from its address and representation <itemizedlist mark="bullet" spacing="compact"><listitem>things may have several possible representations </listitem>
<listitem>the most desirable representation of a thing may change, depending on the consumer (human or software-agent) </listitem>
<listitem>things may be associated with data at different addresses within a data space </listitem>
</itemizedlist></listitem>
<listitem>Unfortunately, URIs identifying things are generally referred to as ?non-information resources? in AWWW parlance <itemizedlist mark="bullet" spacing="compact"><listitem>Entity or Object IDs, or Data Source Names, are preferable terms </listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
<listitem>Deployment Challenges: We?ve established that the Semantic Web and Linked Data require: <itemizedlist mark="bullet" spacing="compact"><listitem>Data access with unambiguous naming </listitem>
<listitem>Data (de)reference with ambiguous association </listitem>
<listitem>Or put another way, we need mechanisms for an HTTP server to: <itemizedlist mark="bullet" spacing="compact"><listitem>Answer the question ?Does this URI identify a (physical) document resource or an (RDF based) abstract entity/thing?? </listitem>
<listitem>Provide alternative representations of an entity/thing </listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
<listitem>Deployment Challenge Resolution: Two solutions proposed by the <ulink url="SemWeb">SemWeb</ulink> Community: <itemizedlist mark="bullet" spacing="compact"><listitem>Distinguish resource type through URL formats <itemizedlist mark="bullet" spacing="compact"><listitem>?Hash? vs ?slash? URLs </listitem>
</itemizedlist></listitem>
<listitem>Content negotiation with URL rewriting </listitem>
</itemizedlist></listitem>
<listitem>?Hash? vs ?Slash? URLs: <itemizedlist mark="bullet" spacing="compact"><listitem>A solution using the syntax of the URL to differentiate ?abstract? resources from ?information? resources </listitem>
<listitem>Slash URIs <itemizedlist mark="bullet" spacing="compact"><listitem>Don?t contain a fragment identifier (#)? </listitem>
<listitem>Identify document resources in traditional Web </listitem>
<listitem>E.g.
 <ulink url="http://demo.openlinksw.com/Northwind/Customer/ALFKI">http://demo.openlinksw.com/Northwind/Customer/ALFKI</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem>Identifies a physical (X)HTML document </listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
<listitem>Hash URIs <itemizedlist mark="bullet" spacing="compact"><listitem>Contain a fragment identifier </listitem>
<listitem>Identify data resources (entities) in Semantic Web </listitem>
<listitem>E.g.
 <ulink url="http://demo.openlinksw.com/Northwind/Customer/ALFKI#this">http://demo.openlinksw.com/Northwind/Customer/ALFKI#this</ulink> <itemizedlist mark="bullet" spacing="compact"><listitem>Identifies the entity ALFKI, distinct from its representation </listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
<listitem>Content Negotiation - Example: <orderedlist spacing="compact"><listitem>HTTP Request: <itemizedlist mark="bullet" spacing="compact"><listitem>HTML browser requests a HTML/XHTML document in English or French <programlisting>GET /whitepapers/data_mngmnt HTTP/1.1
Host: www.openlinksw.com
Accept: text/html, application/xhtml+xml
Accept-Language: en, fr
</programlisting><itemizedlist mark="bullet" spacing="compact"><listitem>Accept header indicates preferred MIME types </listitem>
<listitem>RDF browser might instead stipulate a MIME type of application/rdf+xml or application/rdf+n3 </listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
<listitem>HTTP Response: <itemizedlist mark="bullet" spacing="compact"><listitem>Server redirects to a URL where the appropriate version can be found <programlisting>HTTP/1.1 302 Found
Location: http://www.openlinksw.com/whitepapers/data_mngmnt.en.html
</programlisting></listitem>
</itemizedlist></listitem>
</orderedlist><itemizedlist mark="bullet" spacing="compact"><listitem>Redirect is indicated by HTTP status code 302 (Found)? </listitem>
<listitem>Client then sends another HTTP request to the new URL </listitem>
<listitem>HTTP defines several 3xx status codes for redirection </listitem>
</itemizedlist></listitem>
<listitem>Deploying Linked Data Using Virtuoso: <itemizedlist mark="bullet" spacing="compact"><listitem>Virtuoso?s approach is to implement the generic solution outlined so far, using <itemizedlist mark="bullet" spacing="compact"><listitem>Content negotiation </listitem>
<listitem>URL rewriting </listitem>
</itemizedlist></listitem>
<listitem>Virtuoso includes a Rules-based URL Rewriter </listitem>
<listitem>Can be used to inject Semantic Web data into the Document Web </listitem>
</itemizedlist></listitem>
<listitem>URL Rewriting Example: <itemizedlist mark="bullet" spacing="compact"><listitem>URI dereferenced by RDF browser client <programlisting>&lt;http://demo.openlinksw.com/Northwind/Customer/ALFKI&gt; or
&lt;http://demo.openlinksw.com/Northwind/Customer/ALFKI#this&gt;
</programlisting></listitem>
<listitem>becomes after rewriting (omitting URL encoding)? <programlisting>/sparql?query =
CONSTRUCT
{ &lt;http://demo.openlinksw.com/Northwind/Customer/ALFKI#this&gt; ?p ?o }
FROM 
&lt;http://demo.openlinksw.com/Northwind/&gt;
WHERE 
{ &lt;http://demo.openlinksw.com/Northwind/Customer/ALFKI#this&gt; ?p ?o }
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>URL Rewriting for iSparql: <itemizedlist mark="bullet" spacing="compact"><listitem>iSparql Query Builder: e.g.Browsing Linked Data View: <programlisting>&lt;http://demo.openlinksw.com/Northwind&gt;	
</programlisting></listitem>
<listitem>Dereferencing: <programlisting>&lt;http://demo.openlinksw.com/Northwind/Customer/ALFKI#this&gt; or
&lt;http://demo.openlinksw.com/Northwind/Customer/ALFKI&gt;
</programlisting></listitem>
<listitem>UI supports two commands for dereferencing a URI: <itemizedlist mark="bullet" spacing="compact"><listitem>?Explore?  (i.e.
 Get all links to &amp; from)? <programlisting>SELECT ?property ?hasValue ?isValueOf WHERE {{ &lt;http://demo.openlinksw.com/Northwind/Customer/ALFKI#this&gt;	 ?property ?hasValue } UNION { ?isValueOf ?property  &lt;http://demo.openlinksw.com/Northwind/Customer/ALFKI#this&gt; }} 
?Get Dataset? (i.e. Treat URI as a subgraph)?
SELECT * FROM &lt;http://demo.openlinksw.com/Northwind/Customer/ALFKI#this&gt;WHERE { ?s ?p ?o }
</programlisting></listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
<listitem>URL Rewriting for iSparql: Issues: <itemizedlist mark="bullet" spacing="compact"><listitem>?Get Dataset? Option ? Issues with URI being dereferenced: <programlisting>&lt;http://demo.openlinksw.com/Northwind/Customer/ALFKI#this&gt;
</programlisting></listitem>
<listitem>Assumes URI is a named graph ? It isn?t! <itemizedlist mark="bullet" spacing="compact"><listitem>It?s a unique node ID (object ID / entity instance ID)? </listitem>
<listitem>The only graph defined by our Linked Data View is: <programlisting>&lt;http://demo.openlinksw.com/Northwind&gt;
</programlisting></listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
<listitem>Northwind URL Rewriting: The Aim: <itemizedlist mark="bullet" spacing="compact"><listitem>Aim of URL rewriting for the Northwind Linked Data View: </listitem>
<listitem>Create a rule for RDF browsers which will map an IRI <programlisting>&lt;http://demo.openlinksw.com/Northwind/Customer/something&gt; 
</programlisting></listitem>
<listitem>to a SPARQL query <programlisting>CONSTRUCT &lt;iri&gt; ?p ?o FROM &lt;http://demo.openlinksw.com/Northwind/&gt;
WHERE { &lt;iri&gt; ?p ?o }
</programlisting></listitem>
<listitem>and rewrite the request as <programlisting>/sparql?query=CONSTRUCT ...
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>Virtuoso - URL Rewriter Key Elements: <orderedlist spacing="compact"><listitem>Rewriting Rule <itemizedlist mark="bullet" spacing="compact"><listitem>Describes how to parse a ?nice? URL and compose the actual ?long? URL of the resource to be returned </listitem>
<listitem>Two types: sprintf-based and regex-based </listitem>
</itemizedlist></listitem>
<listitem>Rewriting Rule List <itemizedlist mark="bullet" spacing="compact"><listitem>Named, ordered list of rewriting rules or rule lists </listitem>
<listitem>Tried from top to bottom, first matching rule is applied </listitem>
</itemizedlist></listitem>
<listitem>Conductor UI for rewriting rule configuration </listitem>
<listitem>Configuration API ? alternative to Conductor UI, for scripts <itemizedlist mark="bullet" spacing="compact"><listitem>Functions for creating, dropping, enumerating rules &amp; rule lists </listitem>
</itemizedlist></listitem>
</orderedlist></listitem>
<listitem>URL Rewriter API: Enabling Rewriting: <itemizedlist mark="bullet" spacing="compact"><listitem>Enabled through vhost_define( ) function </listitem>
<listitem>vhost_define( ) defines a virtual host or virtual path </listitem>
<listitem>opts parameter is a vector of field-value pairs </listitem>
<listitem>Field url_rewrite controls / enables URL rewriting </listitem>
<listitem>Field value is the IRI of the rule list to apply e.g.
<programlisting>VHOST_DEFINE (lpath=&gt;&#39;/Northwind, ppath=&gt;&#39;/DAV/Northwind/&#39;,
vhost=&gt;?demo.openlinksw.com&#39;, lhost=&gt;&#39;192.168.11.2:80&#39;, is_dav=&gt;1,
vsp_user=&gt;&#39;dba&#39;, is_brws=&gt;0, opts=&gt;vector (&#39;url_rewrite&#39;, &#39;oplweb_rule_list1&#39;));
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>URL Rewriter API: Summary: Functions in DB.DBA schema: <programlisting>URLREWRITE_CREATE_SPRINTF_RULE
URLREWRITE_CREATE_REGEX_RULE
URLREWRITE_CREATE_RULELIST
URLREWRITE_DROP_RULE
URLREWRITE_DROP_RULELIST
URLREWRITE_ENUMERATE_RULES
URLREWRITE_ENUMERATE_RULELISTS
</programlisting></listitem>
<listitem>URLREWRITE_CREATE_REGEX_RULE: <programlisting>URLREWRITE_CREATE_REGEX_RULE (&#11;rule_iri, allow_update, nice_match, nice_params, nice_min_params, target_compose, target_params, target_expn := null, accept_pattern := null, do_not_continue := 0, http_redirect_code := null ) ;

rule_iri: rule?s name / identifier
nice_match: regex to parse URL into a vector of ?occurrences?
nice_params: vector of names of the parsed parameters.&#11;Length of vector equals # of ?(?)? specifiers in the regex
target_compose: ?compose? regex for the destination URL
target_params: vector of names of parameters to pass to the ?compose? expression as $1, $2 etc
target_expn: optional SQL text to execute instead of a regex compose
accept_pattern: regex expression to match the HTTP Accept header
do_not_continue: on a match, try / don?t try next rule in rule list
http_redirect_code: null, 301, 302 or 303. 30x =&gt; HTTP redirect
</programlisting></listitem>
<listitem>URL Rewriter API ? Northwind Example: <programlisting>--Rewriting rule: 
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
&#39;oplweb_rule1?, 1, &#39;([^#]*)?, vector(&#39;path&#39;), 1,
&#39;/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//demo.openlinksw.com%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//demo.openlinksw.com/Northwind/%%3E+WHERE+{+%%3Chttp%%3A//demo.openlinksw.com%U%%23this%%3E+%%3Fp+%%3Fo+}&amp;format=%U?,
vector(&#39;path&#39;, &#39;path&#39;, &#39;*accept*&#39;),
null, &#39;(text/rdf.n3)|(application/rdf.xml)&#39;, 0, 303);

--In effect (omitting URL encoding):
/sparql?query = CONSTRUCT { %U ?p ?o } FROM &lt;http://demo.openlinksw.com/Northwind/&gt; &#11;WHERE { %U ?p ?o }
--where %U is a placeholder for the original URI
</programlisting></listitem>
</orderedlist><itemizedlist mark="bullet" spacing="compact"><listitem>Arguments in previous rule defined by URLREWRITE_CREATE_REGEX_RULE: <programlisting>--nice_match arg: 
([^#]*)?
----regex matches input IRI up to fragment delimiter
--nice_params arg: 
vector(&#39;path&#39;)?
----?path? is name of first match group in nice_match regex
--accept_pattern arg: 
(text/rdf.n3)|(application/rdf.xml)?
----regex to match HTTP Accept header
--target_params arg: 
vector(&#39;path&#39;, &#39;path&#39;, &#39;*accept*&#39;)?
--names of params whose values will replace %U placeholders in the target URL pattern
---*accept* passes matched part of Accept header&#11;for substitution into &amp;format=%U  portion of query string&#11;e.g. application/rdf.xml
</programlisting></listitem>
<listitem>Enabling Rewriting: <programlisting>DB.DBA.URLREWRITE_CREATE_RULELIST (
&#39;oplweb_rule_list1&#39;,
1,
vector (
&#39;oplweb_rule1&#39;
));

-- ensure a Virtual Directory /oplweb exists
VHOST_REMOVE (lpath=&gt;&#39;/Northwind&#39;, vhost=&gt;?demo.openlinksw.com&#39;,
lhost=&gt;&#39;192.168.11.2:80&#39;);
VHOST_DEFINE (lpath=&gt;&#39;/Northwind&#39;, ppath=&gt;&#39;/DAV/Northwind/&#39;,
vhost=&gt;?demo.openlinksw.com&#39;, lhost=&gt;&#39;192.168.11.2:80&#39;, is_dav=&gt;1,
vsp_user=&gt;&#39;dba&#39;, is_brws=&gt;0, opts=&gt;vector (&#39;url_rewrite&#39;, &#39;oplweb_rule_list1&#39;));
</programlisting></listitem>
</itemizedlist><orderedlist spacing="compact"><listitem>URL Rewriter - Verification with curl: <itemizedlist mark="bullet" spacing="compact"><listitem>curl utility provides a useful tool for verifying HTTP server responses and rewriting rules <programlisting>$ curl -I -H &quot;Accept: application/rdf+xml&quot;
http://demo.openlinksw.com/Northwind/Customer/ALFKI
HTTP/1.1 303 See Other
Server: Virtuoso/05.00.3016 (Solaris) x86_64-sun-solaris2.10-64 PHP5
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Date: Tue, 14 Aug 2007 13:30:22 GMT
Accept-Ranges: bytes
Location:
/sparql?query=CONSTRUCT+{+%3Chttp%3A//demo.openlinksw.com/Northwind/Customer/ALFKI%
23this%3E+%3Fp+%3Fo+}+FROM+%3Chttp%3A//demo.openlinksw.com/Northwind%3E+WHERE+{+%3C
http%3A//demo.openlinksw.com/Northwind/Customer/ALFKI%23this%3E+%3Fp+%3Fo+}&amp;format=
application/rdf%2Bxml
Content-Length: 0
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>URL Rewriter ? <ulink url="URIQADefaultHost">URIQADefaultHost</ulink> Macro: <itemizedlist mark="bullet" spacing="compact"><listitem>Makes rewriting rules (&amp; Linked Data View definitions) more portable </listitem>
<listitem>Each occurrence is substituted with the value of the <ulink url="DefaultHost">DefaultHost</ulink> parameter in URIQA section of virtuoso.ini configuration file </listitem>
<listitem><ulink url="DefaultHost">DefaultHost</ulink> ::= server name.
 e.g.
 www.example.com:8890 <programlisting>&#39;/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/Northwind/%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}&amp;format=%U&#39;
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>Content Negotiation Revisited - TCN: Virtuoso supports two flavours of content negotiation: <itemizedlist mark="bullet" spacing="compact"><listitem>HTTP/1.1 style content negotiation (introduced earlier) <itemizedlist mark="bullet" spacing="compact"><listitem>Server-driven negotiation only </listitem>
</itemizedlist></listitem>
<listitem>Transparent Content Negotiation (TCN) <itemizedlist mark="bullet" spacing="compact"><listitem>Server-driven or agent-driven negotiation </listitem>
</itemizedlist></listitem>
<listitem>Suitably enabled user agents / browsers can take advantage of TCN </listitem>
<listitem>Non-TCN capable user agents continue to be handled using HTTP/1.1 content negotiation </listitem>
</itemizedlist></listitem>
<listitem>Transparent Content Negotiation: <itemizedlist mark="bullet" spacing="compact"><listitem>Supports variant selection by user agent or by server </listitem>
<listitem>Transparent - all variants on server are visible to the agent </listitem>
<listitem>Variant Selection by User Agent: <itemizedlist mark="bullet" spacing="compact"><listitem>User agent chooses best variant itself from variant list sent by server </listitem>
<listitem>Requires sending fewer/smaller Accept headers </listitem>
</itemizedlist></listitem>
<listitem>Variant Selection by Server: <itemizedlist mark="bullet" spacing="compact"><listitem>User agent can instruct server to select best variant on its behalf </listitem>
<listitem>Server uses ?remote variant selection algorithm? (RFC2296) </listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
<listitem>Example ? Preferred format: XML: <itemizedlist mark="bullet" spacing="compact"><listitem>Assumes Virtuoso <ulink url="WebDAV">WebDAV</ulink> server contains 3 variants of resource named ?page?: <itemizedlist mark="bullet" spacing="compact"><listitem>/DAV/TCN/page.xml </listitem>
<listitem>/DAV/TCN/page.html </listitem>
<listitem>/DAV/TCN/page.txt </listitem>
</itemizedlist></listitem>
<listitem>User agent indicates preference for XML <programlisting>$ curl -i -H &quot;Accept: text/xml,text/html;q=0.7,text/plain;q=0.5,*/*;q=0.3&quot;
			-H &quot;Negotiate: *&quot; http://demo.openlinksw.com/DAV/TCN/page
HTTP/1.1 200 OK Server: Virtuoso/05.00.3021 (Linux) i686-pc-linux-gnu VDB
Connection: Keep-Alive
Date: Wed, 31 Oct 2007 15:44:07 GMT
Accept-Ranges: bytes
TCN: choice
Vary: negotiate,accept
Content-Location: page.xml
Content-Type: text/xml
ETag: &quot;8b09f4b8e358fcb7fd1f0f8fa918973a&quot;
Content-Length: 39
&lt;?xml version=&quot;1.0&quot; ?&gt;
&lt;a&gt;some xml&lt;/a&gt;
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>Example ? Preferred format: HTML: <itemizedlist mark="bullet" spacing="compact"><listitem>User agent indicates preference for HTML <programlisting>$ curl -i -H &quot;Accept: text/xml;q=0.3,text/html;q=1.0,text/plain;q=0.5,*/*;q=0.3&quot;
			-H &quot;Negotiate: *&quot; http://demo.openlinksw.com/DAV/TCN/page
HTTP/1.1 200 OK
Server: Virtuoso/05.00.3021 (Linux) i686-pc-linux-gnu VDB
Connection: Keep-Alive
Date: Wed, 31 Oct 2007 15:43:18 GMT
Accept-Ranges: bytes
TCN: choice
Vary: negotiate,accept
Content-Location: page.html
Content-Type: text/html
ETag: &quot;14056a25c066a6e0a6e65889754a0602&quot;
Content-Length: 49
&lt;html&gt;
	&lt;body&gt;
		some html
	&lt;/body&gt;
&lt;/html&gt;
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>Example ? Variant list request: <itemizedlist mark="bullet" spacing="compact"><listitem>User agent asks for a list of variants <programlisting>$ curl -i -H &quot;Accept: text/xml,text/html;q=0.7,text/plain;q=0.5,*/*;q=0.3&quot;
	-H &quot;Negotiate: vlist&quot; http://localhost:8890/DAV/TCN/page
HTTP/1.1 300 Multiple Choices
Server: Virtuoso/05.00.3021 (Linux) i686-pc-linux-gnu VDB
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Date: Wed, 31 Oct 2007 15:44:35 GMT
Accept-Ranges: bytes
TCN: list
Vary: negotiate,accept
Alternates: {&quot;page.html&quot; 0.900000 {type text/html}}, {&quot;page.txt&quot; 0.500000 {type
text/plain}}, {&quot;page.xml&quot; 1.000000 {type text/xml}}
Content-Length: 368
&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML 2.0//EN&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;title&gt;300 Multiple Choices&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;&lt;h1&gt;Multiple Choices&lt;/h1&gt;Available variants:&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;page.html&quot;&gt;HTML variant&lt;/a&gt;, type text/html&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;page.txt&quot;&gt;Text document&lt;/a&gt;, type text/plain&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;page.xml&quot;&gt;XML variant&lt;/a&gt;, type text/xml&lt;/li&gt;
&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>TCN Configuration ? Variant Description <itemizedlist mark="bullet" spacing="compact"><listitem>Variant descriptions held in SQL table HTTP <emphasis>VARIANT_MAP </emphasis></listitem>
<listitem>Added/updated/removed through Virtuoso/PL or Conductor UI <programlisting>create table DB.DBA.HTTP_VARIANT_MAP (
	VM_ID integer identity, -- unique ID
	VM_RULELIST varchar, -- HTTP rule list name
	VM_URI varchar, -- name of requested resource e.g. &#39;page&#39;
	VM_VARIANT_URI varchar, -- name of variant e.g. &#39;page.xml&#39;,&#39;page.de.html&#39; etc.
	VM_QS float, -- Source quality, number in the range 0.001-1.000, with 3 digit precision
	VM_TYPE varchar, -- Content type of the variant e.g. text/xml
	VM_LANG varchar, -- Content language e.g. &#39;en&#39;, &#39;de&#39; etc.
	VM_ENC varchar, -- Content encoding e.g. &#39;utf-8&#39;, &#39;ISO-8892? etc.
	VM_DESCRIPTION long varchar, -- human readable variant description
								  e.g. &#39;Profile in RDF format&#39;
	VM_ALGO int default 0, -- reserved for future use
	primary key (VM_RULELIST, VM_URI, VM_VARIANT_URI)
)
create unique index HTTP_VARIANT_MAP_ID on DB.DBA.HTTP_VARIANT_MAP (VM_ID)
</programlisting></listitem>
</itemizedlist></listitem>
<listitem>TCN Configuration - via Virtuoso/PL: <itemizedlist mark="bullet" spacing="compact"><listitem>Adding or Updating a Resource Variant <programlisting>DB.DBA.HTTP_VARIANT_ADD (
	in rulelist_uri varchar, -- HTTP rule list name
	in uri varchar, -- Requested resource name e.g. &#39;page&#39;
	in variant_uri varchar, 	-- Variant name e.g. &#39;page.xml&#39;, &#39;page.de.html&#39; etc.
	in mime varchar, -- Content type of the variant e.g. text/xml
	in qs float := 1.0, -- Source quality, a floating point number with 3
						  digit precision in 0.001-1.000 range
	in description varchar := null, -- a human readable description of the
									variant e.g. &#39;Profile in RDF format&#39;
	in lang varchar := null, -- Content language e.g. &#39;en&#39;, &#39;bg&#39;. &#39;de&#39; etc.
	in enc varchar := null -- Content encoding e.g. &#39;utf-8&#39;, &#39;ISO-8892&#39; etc.
	)
</programlisting></listitem>
<listitem>Removing a Resource Variant <programlisting>DB.DBA.HTTP_VARIANT_REMOVE (
	in rulelist_uri varchar, -- HTTP rule list name
	in uri varchar, -- Name of requested resource e.g. &#39;page&#39;
	in variant_uri varchar := &#39;%&#39; -- Variant name filter	
	)
</programlisting></listitem>
<listitem>Adding resource variant descriptions <itemizedlist mark="bullet" spacing="compact"><listitem>Define variant descriptions &amp; associate them with a rule list <programlisting>DB.DBA.HTTP_VARIANT_ADD (&#39;http_rule_list_1&#39;, &#39;page&#39;, &#39;page.html&#39;, &#39;text/html&#39;,
	0.900000, &#39;HTML variant&#39;);
DB.DBA.HTTP_VARIANT_ADD (&#39;http_rule_list_1&#39;, &#39;page&#39;, &#39;page.txt&#39;, &#39;text/plain&#39;,
	0.500000, &#39;Text document&#39;);
DB.DBA.HTTP_VARIANT_ADD (&#39;http_rule_list_1&#39;, &#39;page&#39;, &#39;page.xml&#39;, &#39;text/xml&#39;,
	1.000000, &#39;XML variant&#39;);
</programlisting></listitem>
<listitem>Define a virtual directory &amp; associate the  rule list with it <programlisting>DB.DBA.VHOST_DEFINE (lpath=&gt;&#39;/DAV/TCN/&#39;, ppath=&gt;&#39;/DAV/TCN/&#39;, is_dav=&gt;1,
	vsp_user=&gt;&#39;dba&#39;, opts=&gt;vector (&#39;url_rewrite&#39;, &#39;http_rule_list_1&#39;));
</programlisting></listitem>
</itemizedlist></listitem>
</itemizedlist></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2"> RDF sink folder support</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="VirtuosoRDFSinkFolder">Virtuoso RDF Sink Folder</ulink> </listitem>
<listitem><ulink url="ODSRDFSinkFolder">ODS RDF Sink Folder</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Making Rule Sets</bridgehead>
<para>Since RDF Schema and OWL schemas are RDF graphs, these can be loaded into the triple store.
 Thus, in order to use such a schema as query context, one first loads the corresponding document into the triple store using ttlp or rdf_load_rdfxml or related functions.
 After the schema document is loaded, one can add the assertions therein into an inference context with the rdfs_rule_set function.
 This function specifies a logical name for the rule set plus a graph URI.
 It is possible to combine multiple schema graphs into a single rule set.
 A single schema graph may also independently participate in multiple rule sets.</para>
<programlisting>rdfs_rule_set (in name varchar, in uri varchar, in remove int := 0)
</programlisting><para> This function adds the applicable facts of the graph into a rule set.
 The graph URI must correspond to the graph IRI of a graph stored in the triple store of the Virtuoso instance.
 If the remove argument is true, the specified graph is removed from the rule set instead.</para>
<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Changing Rule Sets</bridgehead>
<para>Changing a rule set affects queries made after the change.
 Some queries may have been previously compiled and will not be changed as a result of modifying the rule set.
 When a rule set is changed, i.e.
 when rdfs_rule_set is called with the first argument set to a pre-existing rule set&#39;s name, all the graphs associated with this name are read and the relevant facts are added to a new empty rule set.
 Thus, if triples are deleted from or added to the graphs comprising the rule set, calling rdfs_rule_set will refresh the rule set to correspond to the state of the stored graphs.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> See Also</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="VirtLinkedDataDeploymentTutorialDOAP">Linked Data Deployment DOAP Tutorial</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2"> References</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://sites.wiwiss.fu-berlin.de/suhl/bizer/pub/LinkedDataTutorial/">Linked Data Tutorial</ulink> </listitem>
<listitem><ulink url="VirtLinkedDataDeployment">Deploying Linked Data in Virtuoso</ulink> </listitem>
<listitem>Deploying RDF Linked Data via Virtuoso Universal Server <itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://virtuoso.openlinksw.com/presentations/Virtuoso_Deploying_Linked_Data.ppt">PowerPoint Presentation</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/presentations/Virtuoso_Deploying_Linked_Data/Virtuoso_Deploying_Linked_Data.html">Slidy(XHTML)</ulink> </listitem>
<listitem><ulink url="http://www.slideshare.net/rumito/deploying-rdf-linked-data-via-virtuoso-universal-server-329375/">Slideshare</ulink> </listitem>
<listitem><ulink url="http://www.authorstream.com/Presentation/rumito-66915-deploying-rdf-linked-data-via-virtuoso-universal-openlink-sql-sparql-semanticweb-semweb-web-linkeddata-web30-web20-science-technology-ppt-powerpoint/">Flash</ulink> </listitem>
<listitem><ulink url="http://docs.google.com/Present?docid=dc7jvc6m_996fw3pfdcz&amp;skipauth=true">Google Doc</ulink> </listitem>
</itemizedlist></listitem>
<listitem><ulink url="http://docs.openlinksw.com/virtuoso/rdfandsparql.html">RDF Database and SPARQL</ulink></listitem>
</itemizedlist><para><ulink url="CategoryRDF">CategoryRDF</ulink> <ulink url="CategoryVirtuoso">CategoryVirtuoso</ulink> </para>
</section></docbook>