I have a dataset that looks a bit like:
<item1> <isLocated> <someAddress>
<item2> <isLocated> <someAddress>
<item3> <isLocated> <someOtherAddress>
I want to be able to use SPARQL to answer the question:
"Which items will I find at someAddress or someOtherAddress?"
I could use a UNION like this:
SELECT ?item
{
{ ?item <isLocated> <someAddress> }
UNION { ?item <isLocated> <someOtherAddress }
}
But I think this will become pretty messy when I start talking about 100's or 1000's of addresses.
I think the VALUES inline data might be more suitable than a heap of UNION queries. I've tried writing the following query but my RDF store/engine (bigdata) seems to choke on it:
SELECT ?item
{
?item <isLocated> ?loc .
}
VALUES (?loc) { (<someAddress>) (<someOtherAddress>) }
(based on http://www.w3.org/TR/sparql11-query/#inline-data)
The error I get from bigdata is: Lexical error at line 5, column 7. Encountered: " " (32), after : "VALUES"
Am I forming this query correctly? Is using a UNION or VALUES more appropriate?
It seems no matter how I format this query (based on the w3 examples in the link above) I get similar Lexical errors.
Any ideas?
Cheers.
At a guess, I'd say that Bigdata does not yet support the VALUES
clause. This is a brand new feature introduced in the latest SPARQL working draft (published just weeks ago), so quite naturally several tools will not yet support it.
You could try using BINDINGS
instead (this is roughly the same feature from previous working drafts, which was replaced).