Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SPARQL query: using VALUES inline data or UNION with bigdata store

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.

like image 543
user1685073 Avatar asked Feb 20 '23 02:02

user1685073


1 Answers

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).

like image 151
Jeen Broekstra Avatar answered Mar 11 '23 11:03

Jeen Broekstra