Search in sources :

Example 1 with UnaryTupleOperator

use of org.openrdf.query.algebra.UnaryTupleOperator in project incubator-rya by apache.

the class SparqlFluoQueryBuilder method getConstructGraphVarOrder.

private static VariableOrder getConstructGraphVarOrder(final Reduced node) {
    // get child node
    final QueryModelNode child = node.getArg();
    Preconditions.checkArgument(child instanceof Projection || child instanceof MultiProjection);
    final UnaryTupleOperator unary = (UnaryTupleOperator) child;
    // get ProjectionElemList to build ConstructGraph
    final List<ProjectionElemList> projections = new ArrayList<>();
    if (unary instanceof Projection) {
        projections.add(((Projection) unary).getProjectionElemList());
    } else {
        projections.addAll(((MultiProjection) unary).getProjections());
    }
    return getConstructGraphVarOrder(projections);
}
Also used : ProjectionElemList(org.openrdf.query.algebra.ProjectionElemList) UnaryTupleOperator(org.openrdf.query.algebra.UnaryTupleOperator) ArrayList(java.util.ArrayList) QueryModelNode(org.openrdf.query.algebra.QueryModelNode) MultiProjection(org.openrdf.query.algebra.MultiProjection) Projection(org.openrdf.query.algebra.Projection) ConstructProjection(org.apache.rya.indexing.pcj.fluo.app.ConstructProjection) MultiProjection(org.openrdf.query.algebra.MultiProjection)

Example 2 with UnaryTupleOperator

use of org.openrdf.query.algebra.UnaryTupleOperator in project incubator-rya by apache.

the class AbstractExternalSetMatcher method updateTupleAndNodes.

protected void updateTupleAndNodes() {
    segmentNodeList = segment.getOrderedNodes();
    final TupleExprAndNodes tupAndNodes = segment.getQuery();
    tuple = tupAndNodes.getTupleExpr();
    filters = tupAndNodes.getFilters();
    unmatched = new HashSet<>();
    final List<QueryModelNode> nodes = tupAndNodes.getNodes();
    for (final QueryModelNode q : nodes) {
        if (q instanceof UnaryTupleOperator || q instanceof BinaryTupleOperator) {
            unmatched.add((TupleExpr) q);
        } else if (q instanceof FlattenedOptional) {
            final FlattenedOptional opt = (FlattenedOptional) q;
            final TupleExpr rightArg = opt.getRightArg();
            if (rightArg instanceof UnaryTupleOperator || rightArg instanceof BinaryTupleOperator) {
                unmatched.add(rightArg);
            }
        }
    }
}
Also used : TupleExprAndNodes(org.apache.rya.indexing.external.matching.QueryNodesToTupleExpr.TupleExprAndNodes) UnaryTupleOperator(org.openrdf.query.algebra.UnaryTupleOperator) BinaryTupleOperator(org.openrdf.query.algebra.BinaryTupleOperator) QueryModelNode(org.openrdf.query.algebra.QueryModelNode) TupleExpr(org.openrdf.query.algebra.TupleExpr)

Aggregations

QueryModelNode (org.openrdf.query.algebra.QueryModelNode)2 UnaryTupleOperator (org.openrdf.query.algebra.UnaryTupleOperator)2 ArrayList (java.util.ArrayList)1 TupleExprAndNodes (org.apache.rya.indexing.external.matching.QueryNodesToTupleExpr.TupleExprAndNodes)1 ConstructProjection (org.apache.rya.indexing.pcj.fluo.app.ConstructProjection)1 BinaryTupleOperator (org.openrdf.query.algebra.BinaryTupleOperator)1 MultiProjection (org.openrdf.query.algebra.MultiProjection)1 Projection (org.openrdf.query.algebra.Projection)1 ProjectionElemList (org.openrdf.query.algebra.ProjectionElemList)1 TupleExpr (org.openrdf.query.algebra.TupleExpr)1