Hi,
It seems that property paths are problematic when the paths are spread over more than one graph. I wonder whether stardog (5.0.3) is compliant with SPARQL 1.1 in this respect.
The following example demonstrates the issue:
Given a simple data set of quads:
<http://example/a> <http://example/p1> <http://example/b> <http://graph1.example> .
<http://example/b> <http://example/p2> <http://example/c> <http://graph1.example> .
<http://example/b> <http://example/p3> <http://example/c> <http://graph2.example> .
Note that the first two triples belong two graph1 whereas the last triple belongs to graph2!
Let's do a query using property sequence path:
prefix : <http://example/>
select *
from <http://graph1.example>
from <http://graph2.example>
where {
?a :p1/:p2 ?c .
}
It returns as expected: :a
and :b
. Note that the involved properties :p1 and :p2 both occur in triples from graph1 only!
Now, the problematic query:
prefix : <http://example/>
select *
from <http://graph1.example>
from <http://graph2.example>
where {
?a :p1/:p3 ?c .
}
This returns nothing! Presumably, because :p1 and :p3 can be found only in different graphs.
However, when I cut the sequence path into two pieces I will get the connection again:
prefix : <http://example/>
select *
from <http://graph1.example>
from <http://graph2.example>
where {
?a :p1 ?b .
?b :p2 ?c .
}
It returns: :a, :b and :c.
To me this is strange, because I would expect that
select ?a ?c { ?a :p1/:p2 ?c }
is the same as select ?a ?c { ?a :p1 ?b . ?b :p2 ?c }
for any :p1, :p2.
Apparently, this holds in stardog (in SPARQL 1.1?) only when all involved triples are in the same graph. In my opinion it should hold in general, though. Any other opinions?
Best,
Immanuel