Weird SPARQL pattern matching in 4store?
Suppose I have a RDF-base containing 4 triples:
"John" "loves" "sushi"
"John" "loves" "Mary"
"Frank" "hates" "sushi"
"John" "hates" "olives"
and let's say I consider "sushi" such a weird thing that I'd like to know what exactly people can do with it and even more what else they can apply the same action to =)
So I write a SPARQL query that seems logical to me:
SELECT ?s ?o WHERE
{
?s ?p "sushi".
?s ?p ?o
}
naturally expecting to get the following result
"John" 开发者_如何学C"sushi"
"John" "Mary"
"Frank" "sushi"
because for each of the first 3 triples there exists a satisfying pair of (?s, ?p) values that makes the joined pattern evaluate to TRUE.
But in reality (I use local 4store engine & DB) the answer is like this:
"John" "sushi"
"John" "Mary"
"Frank" "sushi"
"John" "olives"
Can someone explain this behavior to me?
And if this is truly how it should work in SPARQL, then what is the way to get what I need?
Hmmm, this looks like it may be a bug in 4store since I've just tested this in four different independent SPARQL implementations - Jena ARQ, dotNetRDF Leviathan, OpenLink Virtuoso and Clark & Parsia's Stardog - and they all return the answer you were expecting.
And as a self confessed SPARQL nut I think the answer you are expecting is the correct one.
I'd suggest getting in touch with the 4store guys using their support mailing list - http://groups.google.com/group/4store-support?pli=1
Note this may not be a bug directly in 4store but a bug in the underlying rasqal query library but I don't know enough about 4store to tell you one way or another.
精彩评论