On 2/4/14 6:46 AM, "Nádudvari Gyuri (Reedcourty)" wrote:
Hi Everybody,

I have a problem with the SPARQL engine of Virtuoso. I want to use it
with the next ontology:

<?xml version="1.0"?>
<rdf:RDF
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
     xmlns:owl="http://www.w3.org/2002/07/owl#";
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#";
     xmlns="http://reedcourty.github.com/ontologies/tags#";
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
   xml:base="http://reedcourty.github.com/ontologies/tags";>
   <owl:Ontology rdf:about="">
     <owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
     >Created with TopBraid Composer</owl:versionInfo>
   </owl:Ontology>
   <owl:Class rdf:ID="Tag">
     <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
   </owl:Class>
   <owl:Class rdf:ID="FieldNameInDB">
     <rdfs:subClassOf rdf:resource="#Tag"/>
   </owl:Class>
   <owl:ObjectProperty rdf:ID="tagging">
     <rdfs:range rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
     <rdfs:domain rdf:resource="#Tag"/>
     <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
     >The tag tagging a Thing</rdfs:comment>
     <owl:inverseOf>
       <owl:ObjectProperty rdf:ID="taggedBy"/>
     </owl:inverseOf>
   </owl:ObjectProperty>
   <owl:ObjectProperty rdf:about="#taggedBy">
     <owl:inverseOf rdf:resource="#tagging"/>
     <rdfs:range rdf:resource="#Tag"/>
     <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
     >The Thing tagged by a Tag</rdfs:comment>
     <rdfs:domain rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
   </owl:ObjectProperty>
   <rdf:Property rdf:ID="hasComment">
     <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
     <rdfs:domain rdf:resource="#Tag"/>
     <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
     >The tag has a comment</rdfs:comment>
   </rdf:Property>
   <rdf:Property rdf:ID="addedBy">
     <rdfs:domain rdf:resource="#Tag"/>
     <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
     <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
     >Added by somebody</rdfs:comment>
   </rdf:Property>
   <rdf:Property rdf:ID="hasName">
     <rdfs:domain rdf:resource="#Tag"/>
     <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
     <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
     >The tag has a name</rdfs:comment>
   </rdf:Property>
   <rdf:Property rdf:ID="addedAt">
     <rdfs:domain rdf:resource="#Tag"/>
     <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
     <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string";
     >E.g. the tag added at "2013-10-10T095100"</rdfs:comment>
   </rdf:Property>
</rdf:RDF>

I had uploaded the RDF file to Virtuoso via it's webdav service. Then I
used the following query (but by using others I got the same result):

PREFIX tags:<http://reedcourty.github.com/ontologies/tags#>
SELECT ?tag
WHERE {
     ?tag rdfs:subClassOf tags:Tag .
}

The problem is that I got back every item twice, like:

http://reedcourty.github.com/ontologies/tags#FieldNameInDB
http://reedcourty.github.com/ontologies/tags#FieldNameInDB

What is the problem?

I'm using Virtuoso version 07.00.3203 on Win64 (x86_64-generic-win-64),
Single Server Edition

The problem is that you have two documents (denoted by named graph IRIs) in your Virtuoso instance that are comprised of the same (or overlapping) RDF statements (triples).

You can see this via:

PREFIX tags:<http://reedcourty.github.com/ontologies/tags#>
SELECT ?tag ?g
WHERE { GRAPH ?g {
    ?tag rdfs:subClassOf tags:Tag . }
}

You can fix using:

PREFIX tags:<http://reedcourty.github.com/ontologies/tags#>

SELECT DISTINCT ?tag
WHERE { GRAPH ?g {
    ?tag rdfs:subClassOf tags:Tag . }
}

or by using

PREFIX tags:<http://reedcourty.github.com/ontologies/tags#>

SELECT DISTINCT ?tag
WHERE { GRAPH <{named-graph-iri}> {
    ?tag rdfs:subClassOf tags:Tag . }
}



--

Regards,

Kingsley Idehen 
Founder & CEO
OpenLink Software
Company Web: http://www.openlinksw.com
Personal Weblog: http://www.openlinksw.com/blog/~kidehen
Twitter Profile: https://twitter.com/kidehen
Google+ Profile: https://plus.google.com/+KingsleyIdehen/about
LinkedIn Profile: http://www.linkedin.com/in/kidehen





Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to