On Feb 20, 2012, at 7:12 PM, Andy Seaborne wrote:
>> Otherwise it inserts a
>> ?this a ?THIS_TYPE clause into the start of the WHERE clause to
>> optimize performance.
> 
> What happens if ?this is used in several places?

It should work fine - it's bound in the beginning of the block so anything 
"under" that will iterate over the same instances.


> If you process the algebra, then the overhead is less as you can process the 
> post-optimizer algebra and execute that directly.

Yes, but my understanding of this part of Jena is not good enough yet to go 
into such a low level. The other problem is simply the number of different 
cases to consider. For example take

WHERE {
        GRAPH ex:other {
                BIND (ex:getLabel(?this) AS ?label) .
        }
}

Assuming the labels are in a different graph than the rdf:type triples (that 
inform us about the instances) then this pre-processing becomes very hard. I 
cannot simply say

WHERE {
        GRAPH ex:other {
                ?this a ?TYPE_CLASS .
                BIND (ex:getLabel(?this) AS ?label) .
        }
}

As soon as exceptions from the rule such as the one above show up, I believe I 
need some outer looping mechanism anyway. I could optimize it from there for 
special cases.


> Do you need to have this split mode execution?  Why not build a single query 
> that calculates ?this (we do this in the linked data API), not puts it in a 
> repeated substitution?

How would this look like exactly?

Thanks
Holger

Reply via email to