Examples of TupleExpr


Examples of org.openrdf.query.algebra.TupleExpr

  @Override
  public TupleExpr visit(ASTConstructQuery node, Object data)
    throws VisitorException
  {
    TupleExpr tupleExpr;

    if (node.hasQueryBody()) {
      // Build tuple expression for query body
      tupleExpr = (TupleExpr)node.getQueryBody().jjtAccept(this, null);
    }
    else {
      tupleExpr = new SingletonSet();
    }

    // Create constructor
    ConstructorBuilder cb = new ConstructorBuilder();
    ASTConstruct constructNode = node.getConstructClause();

    if (!constructNode.isWildcard()) {
      TupleExpr constructExpr = (TupleExpr)constructNode.jjtAccept(this, null);
      tupleExpr = cb.buildConstructor(tupleExpr, constructExpr, constructNode.isDistinct());
    }
    else if (node.hasQueryBody()) {
      tupleExpr = cb.buildConstructor(tupleExpr, constructNode.isDistinct());
    }
View Full Code Here

Examples of org.openrdf.query.algebra.TupleExpr

  @Override
  public CompareAny visit(ASTCompareAny node, Object data)
    throws VisitorException
  {
    ValueExpr valueExpr = (ValueExpr)node.getLeftOperand().jjtAccept(this, null);
    TupleExpr tupleExpr = (TupleExpr)node.getRightOperand().jjtAccept(this, null);
    CompareOp op = node.getOperator().getValue();

    return new CompareAny(valueExpr, tupleExpr, op);
  }
View Full Code Here

Examples of org.openrdf.query.algebra.TupleExpr

  @Override
  public CompareAll visit(ASTCompareAll node, Object data)
    throws VisitorException
  {
    ValueExpr valueExpr = (ValueExpr)node.getLeftOperand().jjtAccept(this, null);
    TupleExpr tupleExpr = (TupleExpr)node.getRightOperand().jjtAccept(this, null);
    CompareOp op = node.getOperator().getValue();

    return new CompareAll(valueExpr, tupleExpr, op);
  }
View Full Code Here

Examples of org.openrdf.query.algebra.TupleExpr

  @Override
  public In visit(ASTIn node, Object data)
    throws VisitorException
  {
    ValueExpr valueExpr = (ValueExpr)node.getLeftOperand().jjtAccept(this, null);
    TupleExpr tupleExpr = (TupleExpr)node.getRightOperand().jjtAccept(this, null);
    return new In(valueExpr, tupleExpr);
  }
View Full Code Here

Examples of org.openrdf.query.algebra.TupleExpr

      StringEscapesProcessor.process(qc);
      BaseDeclProcessor.process(qc, baseURI);
      Map<String, String> prefixes = PrefixDeclProcessor.process(qc);
      WildcardProjectionProcessor.process(qc);
      BlankNodeVarProcessor.process(qc);
      TupleExpr tupleExpr = buildQueryModel(qc);

      QueryModel query;

      ASTQuery queryNode = qc.getQuery();
      if (queryNode instanceof ASTSelectQuery) {
View Full Code Here

Examples of org.openrdf.query.algebra.TupleExpr

    throws StoreException
  {
    int size = union.getNumberOfArguments();
    Cursor<BindingSet>[] iters = new Cursor[size];
    for (int i = 0; i < size; i++) {
      final TupleExpr arg = union.getArg(i);
      iters[i] = new DelayedEvaluationCursor(this, arg, bindings);
    }

    return new UnionCursor<BindingSet>(iters);
  }
View Full Code Here

Examples of org.openrdf.query.algebra.TupleExpr

    return Collections.unmodifiableList(requiredTEs);
  }

  public void addOptionalTE(GraphPattern gp) {
    List<ValueExpr> constraints = gp.removeAllConstraints();
    TupleExpr tupleExpr = gp.buildTupleExpr();

    OptionalTupleExpr optTE;

    if (constraints.isEmpty()) {
      optTE = new OptionalTupleExpr(tupleExpr);
View Full Code Here

Examples of org.openrdf.query.algebra.TupleExpr

   * constraints in this graph pattern.
   *
   * @return A tuple expression for this graph pattern.
   */
  public TupleExpr buildTupleExpr() {
    TupleExpr result;

    if (requiredTEs.isEmpty()) {
      result = new SingletonSet();
    }
    else if (requiredTEs.size() == 1) {
View Full Code Here

Examples of org.openrdf.query.algebra.TupleExpr

      super.meet(filter);

      if (filter.getCondition() instanceof SameTerm) {
        // SameTerm applies to the filter's argument
        SameTerm sameTerm = (SameTerm)filter.getCondition();
        TupleExpr filterArg = filter.getArg();

        ValueExpr leftArg = sameTerm.getLeftArg();
        ValueExpr rightArg = sameTerm.getRightArg();

        // Verify that vars are (potentially) bound by filterArg
        Set<String> bindingNames = filterArg.getBindingNames();
        if (leftArg instanceof Var && !bindingNames.contains(((Var)leftArg).getName())
            || rightArg instanceof Var && !bindingNames.contains(((Var)rightArg).getName()))
        {
          // One or both var(s) are unbound, this expression will never
          // return any results
          filter.replaceWith(new EmptySet());
          return;
        }

        Set<String> assuredBindingNames = filterArg.getAssuredBindingNames();
        if (leftArg instanceof Var && !assuredBindingNames.contains(((Var)leftArg).getName())
            || rightArg instanceof Var && !assuredBindingNames.contains(((Var)rightArg).getName()))
        {
          // One or both var(s) are potentially unbound, inlining could
          // invalidate the result e.g. in case of left joins
View Full Code Here

Examples of org.openrdf.query.algebra.TupleExpr

    throws VisitorException
  {
    // Start with building the graph pattern
    graphPattern = new GraphPattern();
    node.getWhereClause().jjtAccept(this, null);
    TupleExpr tupleExpr = graphPattern.buildTupleExpr();

    // Apply result ordering
    ASTOrderClause orderNode = node.getOrderClause();
    if (orderNode != null) {
      List<OrderElem> orderElemements = (List<OrderElem>)orderNode.jjtAccept(this, null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.