[Mulgara-dev] xsd resolver

Alex Hall alexhall at revelytix.com
Wed Nov 12 16:20:16 UTC 2008


Life is hard, and then you die wrote:
[snip]
>> Second, I believe that any numbers generated in a query will have a
>> negative gNode (are you able to check this?). Perhaps it's possible to
>> filter on these numbers, while still matching on positive gNodes?
> 
> Yes, they are negative. But I'm not sure how that helps: the decision
> whether to generate or filter needs to be done ahead of time, or else
> we have to tell the query scheduler that the xsd resolver always be
> run last.

Well, the XSD resolver slices from both the persistent and temporary data pools
when resolving a constraint.  So I think the query you're trying to do would
work with matching if, like you say, the XSD resolver is called after the Lucene
resolver and the generated score is already in the temporary data pool.  That's
beside the point though, because I agree that the resolver should be filtering
if the variable in an XSD constraint bound elsewhere in a constraint that is
*joined* with the XSD constraint -- appends should still result in generation,
not filtering.  Also, you should be prepared to see a negative performance
impact if you want to globalize and filter nodes row-by-row in a Tuples.

> Hmm, I think the DefinablePrefixAnnotation can be used to determine
> whether the variables have been bound or not, i.e. that could be used
> to trigger whether to filter or generate. However, I think one piece
> is still missing: a way to the query planner that it should use other
> resolvers to resolve the variables _if possible_ (the
> MandatoryBindingAnnotation doesn't cut it because that's a hard
> requirement rather than a soft please-but-only-if-you-can). So maybe a
> new annotation is needed here.

I don't think that what you want to accomplish can even be done with
annotations.  Keep in mind that, even if the variable in an XSD constraint is
bound elsewhere in the query, there's no way for the XSD resolver to see these
bound values from the QueryEvaluationContext that it is given.  Instead, I think
you would need to modify the IntervalConstraint and
IntervalConstraintTransformation to collect all constraints that appear
alongside an XSD constraint in a conjunction, and stick them into a new
conjunction referenced by the IntervalConstraint.  When the
IntervalConstraintDescriptor goes to resolve the constraint, it would then ask
the query engine to resolve the other constraints and once it has the resulting
Tuples it can decide whether to filter the rows or generate a new Tuples and
join with the other results.

At least, that's my understanding of the situation based on my reading of the
query engine and XSD resolver code.  Please correct me if I'm wrong, because I'm
not all that familiar with the annotations framework.  Is the
MandatoryBindingAnnotation actually used anywhere?  The only example I was able
to find was some test code.

Regards,
Alex



More information about the Mulgara-dev mailing list