<docbook><section><title>VirtTipsAndTricksGuideAddisDefinedByRelations</title><title>How to Use SPARQL to add missing isDefinedBy relations to an Ontology?</title>How to Use SPARQL to add missing isDefinedBy relations to an Ontology?
<bridgehead class="http://www.w3.org/1999/xhtml:h2">What?</bridgehead>
 Using SPARQL to add missing isDefinedBy relations to an Ontology.<bridgehead class="http://www.w3.org/1999/xhtml:h2">Why?</bridgehead>
 isDefinedBy relations make Ontologies (TBox) more navigable using follow-your-nose pattern.
 This also makes ABox instance data more discoverable.<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">How?</bridgehead>
<para>Use SPARQL to generate relations that associate Classes and Properties the Ontology that describes them.</para>
<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Example Using the Ontology for vCards</bridgehead>
<para>In this example we will use:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem>Ontology Document URL: <ulink url="http://www.w3.org/2006/vcard/ns">http://www.w3.org/2006/vcard/ns</ulink> ; </listitem>
<listitem>Ontology URI: <ulink url="http://www.w3.org/2006/vcard/ns">http://www.w3.org/2006/vcard/ns</ulink># ; </listitem>
<listitem>A local Named Graph IRI to host SPARQL Update (SPARUL) the new relations.</listitem>
</itemizedlist><programlisting>## Uncomment line below if using Virtuoso and executing SPARQL via iSQL or via an ODBC, JDBC, ADO.NET connection
## SPARQL

## Uncomment line (a SPARQL pragma) below if using Virtuoso and there isn&#39;t a local Named Graph holding triples retrieved from the Ontology URL

## DEFINE get:soft &quot;add&quot;

INSERT INTO &lt;urn:data:qos:vcard&gt; 
  { ?s rdfs:isDefinedBy &lt;http://www.w3.org/2006/vcard/ns#&gt; }
FROM &lt;http://www.w3.org/2006/vcard/ns&gt;
WHERE 
  {
    ?s a ?o
  }
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Example Using the Recorded Media Ontology</bridgehead>
<para>In this example we will use:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem>Ontology Document URL: <ulink url="http://www.w3.org/ns/ma-ont">http://www.w3.org/ns/ma-ont</ulink> ; </listitem>
<listitem>Ontology URI: <ulink url="http://www.w3.org/ns/ma-ont">http://www.w3.org/ns/ma-ont</ulink># ; </listitem>
<listitem>A local Named Graph IRI to host SPARQL Update (SPARUL) the new relations.</listitem>
</itemizedlist><programlisting>SPARQL
INSERT INTO &lt;urn:data:qos:ma-ont&gt; 
  { ?s rdfs:isDefinedBy &lt;http://www.w3.org/ns/ma-ont#&gt; }
FROM &lt;http://www.w3.org/ns/ma-ont&gt;
WHERE 
  {
    ?s a ?o
  }
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="VirtTipsAndTricksGuide">Virtuoso Tips and Tricks Collection</ulink> </listitem>
<listitem><ulink url="http://docs.openlinksw.com/virtuoso/rdfsparql.html">Virtuoso Documentation</ulink> </listitem>
</itemizedlist></section></docbook>