On 02/10/13 10:41, Milorad Tosic wrote:
> (arq-2.8.7, jena-2.6.4, tdb-0.8.9)
Quite old. Thgere may well have been fixes.
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.
While I agree the results are wrong (try the current version), this
isn't a corect statement of why.
{
?s ?p1 <ex:o1> .
?s ?p2 <ex:o2> .
}
both parts must match for the same ?s
Each triple pattern is matched agains the combined graph, with duplicate
supression so the combined graoph really is a set of triples. There is
no union going on after some matching, it happens as each triple pattern
is matched.
It has to be that way:
1/ Get the right cardinality
2/ patterns can span graphs
c.f the different:
GRAPH ?g {
?s ?p1 <ex:o1> .
?s ?p2 <ex:o2> .
}
where the pattern does not span graphs.
Andy