Hello,
I am building a system that generates queries and sends them to my sparql endpoint.
The system is relying on two graphs, one that contains the actual data, and the other that contains a few triplets representing the knowledge added by the user.
I also need inferencing, to exploit any “subclass” and “subproperty” that might be in either graph, so I have defined a rule set that includes the two graphs.
My query looks like this :
define input:inference 'user_g'
SELECT DISTINCT ?c
FROM <http://localhost:8890/inria-hal-expand>
FROM <http://hyperstorylines.com/session/g>
WHERE {?s a <http://example.com/test#Paper>. ?s [] ?o. ?o a ?c}
But this returns only one value rdf:Class
.
The expected result is a list of all classes that my Papers are linked to.
With the following query, with just the two FROM clauses without the inference, the results are correct.
SELECT DISTINCT ?c
FROM <http://localhost:8890/inria-hal-expand>
FROM <http://hyperstorylines.com/session/g>
WHERE {?s a <http://example.com/test#Paper>. ?s [] ?o. ?o a ?c}
I first thought the issue was caused by the inference rule set containing the queried graph, but if I remove the second FROM clause, and keep the first one, the results are also correct.
define input:inference 'user_g'
SELECT DISTINCT ?c
FROM <http://localhost:8890/inria-hal-expand>
WHERE {?s a <http://example.com/test#Paper>. ?s [] ?o. ?o a ?c}
Note that the user_g
rule set contains both <http://hyperstorylines.com/session/g>
and <http://localhost:8890/inria-hal-expand>
.
These queries are run on the sparql endpoint, both in the web interface and through SPARQLWrapper for python, results are the same either way.
I’ve tried using define input:default-graph-uri
instead of FROM but the results are the same
I cannot use a GRAPH clause because I need triplets from one graph to be able to blend with the other (as most of my result are in the first graph, supplemented by the occasional triplets from the second one).
EDIT :
I’ve realized that swapping the two from clauses causes it to just return nothing, is there just something I don’t understand about FROM clauses and their implementation in Virtuoso ?
For information, right now the graph <http://hyperstorylines.com/session/g>
is almost empty.