Hi,

What is the intended semantics of the FROM clause in SPARQL queries? I got 
confused with the results of the following tests that I run against a rdf store 
(arq-2.8.7, jena-2.6.4, tdb-0.8.9):

Let us have two datasets in a single triplestore:
PREFIX ex: <http://www.example.info>

ex:ds1 { <ex:r><ex:p1><ex:o1> . }
ex:ds2 { <ex:r><ex:p2><ex:o2> . }
(each of the datasets contains a single triplet, each of the triplets has the 
same subject <ex:r>.)

Let us now run the query that is going to return all triplets from the 
triplestore that have <ex:r> as a subject. It should be like this:
PREFIX ex: <http://www.example.info>
FROM <ex:ds1>

FROM <ex:ds2>
SELECT ?p ?o WHERE {
 <ex:r> ?p ?o .

}

As expected, we get the following results:

?p           ?o

<ex:p1>  <ex:o1>
<ex:p2>  <ex:o2>

Next, let us run the following query ("return all resources that have a 
property with value  <ex:o1> and a property with value  <ex:o2>" would be an 
non-formal not-necessarily correct interpretation in English language):
PREFIX ex: <http://www.example.info>
FROM <ex:ds1>

FROM <ex:ds2>
SELECT ?s WHERE {
 ?s ?p1 <ex:o1> .
 ?s ?p2 <ex:o2> .

}

One would expect the following result:
?s

<ex:r>
Rationale for the expectation is that FROM clause constructs union of the 
default graph and the graphs specified by FROM statements in the query, and 
then runs rest of the query against the union of graphs.

However, experimentation results are different: The query returns an EMPTY 
result.
Rationale for the obtained results is that query was run against each 
individual dataset and then the union of results is returned.

So, is my expectation wrong because of misinterpretation of the standard 
specification or it is a bug in the version of Jena that I work with?

Thanks,
Milorad

Reply via email to