On 13/01/12 22:59, Martynas Jusevicius wrote:
Hey all,

I'm using ARQ to manipulate SPARQL queries - I'm planning to bind
variables, add triple patterns, FILTERs etc.
The queries will mainly be used remotely over HTTP, so I was glad to
find the QueryEngineHTTP.setInitialBindings() method:
http://incubator.apache.org/jena/documentation/javadoc/arq/com/hp/hpl/jena/sparql/engine/http/QueryEngineHTTP.html#setInitialBindings(com.hp.hpl.jena.query.ResultSet)

But then I tried it out and all I got was an exception "Initial
bindings not supported for remote queries" :(

I don't really get the point behind this restriction. All I want to do
is to bind ?var to some specific Resource, what does that have to do
with query execution -- or the fact that it is remote? I'd like to be
able to manipulate remote queries just as well.
Is there some workaround for this?

Thanks,

Martynas
http://graphity.org

Hi Martynas,

The reason it isn't implemented is to do with how it's implemented. In ARQ, it's done by providing an initial condition to the algebra evaluation.

But in a remote query there is no algebra.

It could be done by rewriting the query (patch welcome) with some care to do with the fact that variables are scoped and, in SPARQL 1.1, not all ?x are the same ?x, for example inside a subquery where it isn't projected.

There is another way though which is standard -- use BINDINGS from SPARQL 1.1. That adds bindings of variables to a query. The semantics aren't exactly the same because it's a join of the data to the rest of the query but for many cases it is the same (you'd need nested subpatterns at least 2 deep to see a difference IIRC).

What might have been a better mechanism is to not overload SPARQL variables but to have a different marker like ?{var} in a templated query. That said, this style is slightly different again in what use cases it's solving.

        Andy

Reply via email to