There is an online validator using Jena that prints query algebra at
http://sparql.org
You can also see the optimizer effects.
>> Does Jena evaluate triples in the WHERE {} block sequentially
You can't rely on that. The optimizer makes chnages; BGP's reorder
triple patterns as well.
>> WHERE {
>> OPTIONAL {}
>> FILTER ()
>> }
>>
>> and
>>
>> WHERE {
>> FILTER ()
>> OPTIONAL {}
>> }
>>
>> have a different order of execution, or do they represent the same
query to Jena?
Different question - these are the same because in SPARQL, the FILTER
applies to the whole {}-block it is in. Conceptually it is moved to the
end. The optimizer then does stuff.
Andy
On 26/05/17 15:07, Lorenz Buehmann wrote:
I cannot say whether optimizations are always used in Jena, but I know
the the algebra stuff has some optimize() methods, probably some pruning
rules, the rest would need some statistics like cardinalities,
join-selectivity, etc. For sure, Andy knows more.
One comment:
You should keep in mind that the order of OPTIONAL is important.
On 26.05.2017 13:25, Laura Morales wrote:
Does Jena evaluate triples in the WHERE {} block sequentially, or does it try
to perform any optimizations internally? As a practical example, does
WHERE {
OPTIONAL {}
FILTER ()
}
and
WHERE {
FILTER ()
OPTIONAL {}
}
have a different order of execution, or do they represent the same query to
Jena?