Package org.openanzo.glitter.query.rewriter

Class Summary
ConjunctiveRewriter The ConjunctiveRewriter takes advantage of the following equalities: { t1 t2 { t3 } } = t1 t2 t3 That is, triples within a single BGP are conjoined, as are GraphPatterns within a group.
FunctionalPredicateRewriter A FunctionalPredicateRewriter takes a map from predicate URIs to FunctionalPredicate implementations and uses it to rewrite a query node that contains a functional predicate by removing all triple patterns involved in the functional predicate and attaching the functional predicate to the BGP.
NormalFormRewriter From the Semantics and Complexity of SPARQL paper, some equivalences: 2.3.1 (1) P1 AND P2 === P2 AND P1 ; P1 UNION P2 === P2 UNION P1 (2) P1 AND (P2 UNION P3) === (P1 AND P2) UNION (P1 AND P3) similarly: AND(P1, P2, UNION(P3, P4)) === UNION(AND(P1, P2, P3), AND(P1, P2, P4)) similarly: AND(P1, UNION(P2, P3, ..., Pk) === UNION(AND(P1, P2), AND(P1, P3), ..., AND(P1, Pk)) similarly: AND(P1, UNION(P2, P3), UNION(P4, P5)) === UNION(AND(P1, P2, P4), AND(P1, P2, P5), AND(P1, P3, P4), AND(P1, P3, P5)) similarly: AND(P1, P2, ..., Pi, UNION(Q11, Q12, ..., Q1j), UNION(Q21, Q22, ..., Q2k), ..., UNION(Qm1, Qm2, ..., Qmn)) === UNION(For Each (x1, x2, ..., xm) in CartesianProduct(Q11...Q1j, Q21...Q2k, Qm1...Qmn) AND(P1, P2, ..., Pi, x1, x2, ..., xm)) (3) P1 OPT (P2 UNION P3) === (P1 OPT P2) UNION (P1 OPT P3) Similarly: OPT(P1, UNION(P2, P3, ..., Pk)) === UNION(OPT(P1, P2), OPT(P1, P3), ..., OPT(P1, Pk)) We also take advantage of associativity properties: P1 UNION (P2 UNION P3) = (P1 UNION P2) UNION P3 = (for that matter) UNION(P1, P2, P3) if naryUnion is allowed.
VariableRewriter The VariableRewriter rewrites a triple pattern that contains a variable which is bound to only a single value in the supplied bindings.
 



Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.