The join yes, but not the reorder.

Reordering is typically about resolving one pattern and using those results
to constraint searches for the next pattern. But for SERVICE you don't want
to be issuing lots of calls. Instead, you need to get all the data and join
it locally (well... if you have enough information there are cases where
you can get data from one service and send it up as BINDINGS for the query
on the next service, but that's getting very advanced, and no, Jena doesn't
do that).

As for the join, even that isn't guaranteed. Yes, a join on normal data
between two patterns that share variables will typically have a smaller
result than either pattern on their own, but it *can* result in a cross
product.

I'm talking in general terms here, rather than speaking to the specifics of
Jena, but if memory serves then this all applies to Jena as well.

Paul




On Fri, Mar 29, 2013 at 10:21 AM, Diogo FC Patrao <[email protected]>wrote:

> Hello
>
> I was experimenting with SPARQL algebras lately, and got some doubts about
> sparql optimization.
>
> First, all of the optimizations listed on [1] are executed? I ask because
> there's this context thing that I don't really get.
>
> Second, it doesn't seem to provide any SERVICE specific optimization, is it
> right? Like, I have queries like:
>
> SELECT * {
>
>  SERVICE ( srv1 ) { ?a prop1 ?o1 }
>  SERVICE ( srv1 ) { ?a prop2 ?o2 }
>  SERVICE ( srv2 } { ?a prop3 ?o3 FILTER (?o3=SOMEVALUE) }
> }
>
> and would benefit from reordering and joining
>
>
> SELECT * {
>
>  SERVICE ( srv2 } { ?a prop3 ?o3 FILTER (?o3=SOMEVALUE) }
>  SERVICE ( srv1 ) { ?a prop1 ?o1; prop2 ?o2; }
> }
>
> [1]
>
> http://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/sparql/algebra/optimize/package-summary.html
>
>
> --
> diogo patrĂ£o
>

Reply via email to