On 08/02/18 08:39, Jean-Marc Vanel wrote:
Hi
I wonder about performance of arbitrary length path in Jena :
https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#propertypath-arbitrary-length
For example , here is the query in semantic_forms for searching a string
with a type class. I added yesterday the rdfs:subClassOf* pattern.
I wonder if it would not be more efficient with the unionGraph instead of
numerous GRAPH blocks .
if you try it, please do report on the effect.
GRAPH <urn:x-arq:UnionGraph>
Are the rdfs:subClassOf hierarchies very deep?
As you have it, there is a bit of cross product of ?g1 and ?g2 going on.
Andy
PREFIX text: <http://jena.apache.org/text#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX form: <
http://raw.githubusercontent.com/jmvanel/semantic_forms/master/vocabulary/forms.owl.ttl#
SELECT DISTINCT ?thing ?COUNT WHERE {
?thing text:query ( 'Jean*' ) .
graph ?g1 {
?thing a ?sub .
}
graph ?g2 {
?sub *rdfs:subClassOf** <http://xmlns.com/foaf/0.1/Person> .
} .
OPTIONAL {
graph ?grCount {
?thing form:linksCount ?COUNT.
} }
}
ORDER BY DESC(?COUNT)
LIMIT 10