virtuoso-opensource icon indicating copy to clipboard operation
virtuoso-opensource copied to clipboard

"graph" leads to inconsistent results of property path query.

Open slater2022 opened this issue 3 years ago • 3 comments

$ ./virtuoso-t -?
Virtuoso Open Source Edition (Column Store) (multi threaded)
Version 7.2.7.3234-pthreads as of May 18 2022 (67261301a)
Compiled for Linux (x86_64-generic_glibc25-linux-gnu)
Copyright (C) 1998-2022 OpenLink Software

use only the original data. query 1:

select distinct  ?s
where {
    graph ?g {
        ?s rdfs:subClassOf?/a rdfs:Class.
    }
}

query result:

s
--
http://www.w3.org/2002/07/owl#Restriction
http://www.w3.org/2002/07/owl#TransitiveProperty
http://www.w3.org/2002/07/owl#SymmetricProperty
http://www.w3.org/2002/07/owl#InverseFunctionalProperty

query 2:

select distinct  ?s
where {
    ?s rdfs:subClassOf?/a rdfs:Class.
}

query result:

s
--
http://www.w3.org/2002/07/owl#InverseFunctionalProperty
http://www.w3.org/2002/07/owl#SymmetricProperty
http://www.w3.org/2002/07/owl#FunctionalProperty
http://www.w3.org/2002/07/owl#TransitiveProperty
http://www.w3.org/2002/07/owl#Class
http://www.w3.org/2002/07/owl#Restriction
http://www.w3.org/2002/07/owl#Ontology
http://www.w3.org/2002/07/owl#OntologyProperty
http://www.w3.org/2002/07/owl#AnnotationProperty
http://www.w3.org/2002/07/owl#AllDifferent
http://www.w3.org/2002/07/owl#ObjectProperty
http://www.w3.org/2002/07/owl#DatatypeProperty
http://www.w3.org/2002/07/owl#DeprecatedClass
http://www.w3.org/2002/07/owl#DeprecatedProperty
http://www.w3.org/2002/07/owl#DataRange

The results of the two queries are different

slater2022 avatar Oct 09 '22 07:10 slater2022

@slater2022

Not a bug. When you use graph ?g { ... }, this means triple patterns inside are belong to same graph, therefore you do not query across all graphs. Note Virtuoso RDF store is a QUAD store, not a triple store.

HTH

imitko avatar Oct 09 '22 20:10 imitko

query

select distinct  ?s
where {
    graph ?g {
        ?s a rdfs:Class.
    }
}

query result

s
--
http://www.w3.org/2002/07/owl#InverseFunctionalProperty
http://www.w3.org/2002/07/owl#SymmetricProperty
http://www.w3.org/2002/07/owl#FunctionalProperty
http://www.w3.org/2002/07/owl#TransitiveProperty
http://www.w3.org/2002/07/owl#Class
http://www.w3.org/2002/07/owl#Ontology
http://www.w3.org/2002/07/owl#OntologyProperty
http://www.w3.org/2002/07/owl#AnnotationProperty
http://www.w3.org/2002/07/owl#AllDifferent
http://www.w3.org/2002/07/owl#Restriction
http://www.w3.org/2002/07/owl#ObjectProperty
http://www.w3.org/2002/07/owl#DatatypeProperty
http://www.w3.org/2002/07/owl#DeprecatedClass
http://www.w3.org/2002/07/owl#DeprecatedProperty
http://www.w3.org/2002/07/owl#DataRange

The query result is the same as query 2

SPARQL 1.1 Query Language

elt? ZeroOrOnePath A path that connects the subject and object of the path by zero or one matches of elt.

no path matching zero rdfs:subClassOf

slater2022 avatar Oct 10 '22 01:10 slater2022

@imitko — Please take a look at @slater2022's followup...

TallTed avatar Oct 12 '22 17:10 TallTed