Package org.openrdf.query.algebra

Examples of org.openrdf.query.algebra.Union


        SignedConnection owner = owners.iterator().next();
        replacement.addArg(new OwnedTupleExpr(owner, joinArg));
      }
      else if (joinArg instanceof Join || distinct) {
        // Local join with multiple owners or distinct federation members
        Union union = new Union();
        for (SignedConnection owner : owners) {
          union.addArg(new OwnedTupleExpr(owner, joinArg.clone()));
        }
        replacement.addArg(union);
      }
      else {
        replacement.addArg(joinArg);
View Full Code Here


      SignedConnection member = getSingleOwner(arg);
      if (ownedJoins.size() > 0 && ownedJoins.get(ownedJoins.size() - 1).getOwner() == member) {
        ownedJoins.get(ownedJoins.size() - 1).getOperation().addArg(arg.clone());
      }
      else {
        ownedJoins.add(new Owned<Union>(member, new Union(arg.clone())));
      }
    }
    addOwners(union, ownedJoins);
  }
View Full Code Here

  private void addOwners(LeftJoin node, SignedConnection leftOwner, SignedConnection rightOwner,
      boolean local)
  {
    if (leftOwner == null && rightOwner == null) {
      if (local) {
        Union union = new Union();
        for (SignedConnection member : members) {
          union.addArg(new OwnedTupleExpr(member, node.clone()));
        }
        node.replaceWith(union);
      }
    }
    else if (leftOwner == rightOwner) {
      node.replaceWith(new OwnedTupleExpr(leftOwner, node.clone()));
    }
    else {
      if (local) {
        if (rightOwner == null) {
          node.replaceWith(new OwnedTupleExpr(leftOwner, node.clone()));
        }
        else if (leftOwner == null) {
          Union union = new Union();
          for (SignedConnection member : members) {
            if (rightOwner == member) {
              union.addArg(new OwnedTupleExpr(member, node.clone()));
            }
            else {
              union.addArg(new OwnedTupleExpr(member, node.getLeftArg().clone()));
            }
          }
          node.replaceWith(union);
        }
        else {
View Full Code Here

        // every element is used by the same owner
        node.replaceWith(new OwnedTupleExpr(o, node.clone()));
      }
    }
    else {
      Union replacement = new Union();
      for (Owned<Union> e : ownedJoins) {
        SignedConnection o = e.getOwner();
        Union union = e.getOperation();
        if (o == null) {
          // multiple owners
          for (TupleExpr arg : union.getArgs()) {
            replacement.addArg(arg.clone());
          }
        }
        else {
          replacement.addArg(new OwnedTupleExpr(o, union));
View Full Code Here

        StatementPattern attributePattern = new StatementPattern(subjectVar, attributePredVar,
            attributeVar);

        if (inheritanceProp != null) {
          // create a union expression for this attribute.
          Union union = new Union();
          union.addArg(attributePattern);

          // the join for checking if the access attribute is inherited.
          Join inheritJoin = new Join();
          Var inheritVar = new Var("-acl_inherited_value" + i);
          // SP (?subject, inheritProp, ?S_i)
          StatementPattern inheritPattern = new StatementPattern(subjectVar, inheritPredVar, inheritVar);
          inheritJoin.addArg(inheritPattern);
          // SP (?S_i, accessAttr_i, ?accessAttrValue_i)
          StatementPattern inheritAttrPattern = new StatementPattern(inheritVar, attributePredVar,
              attributeVar);
          inheritJoin.addArg(inheritAttrPattern);

          union.addArg(inheritJoin);

          joinOfAttributePatterns.addArg(union);
        }
        else {
          // no inheritance: the attribute can be matched with a simple
View Full Code Here

          // Insert a Union over the individual constraints, pushing it
          // down below other filters to avoid cloning them
          TupleExpr node = findNotFilter(filterArg);

          Union union = new Union();
          for (ValueExpr arg : constraints) {
            union.addArg(new Filter(node.clone(), arg));
          }

          node.replaceWith(union);

          // Enter recursion
View Full Code Here

    throws VisitorException
  {
    TupleExpr leftArg = (TupleExpr)node.getLeftArg().jjtAccept(this, null);
    TupleExpr rightArg = (TupleExpr)node.getRightArg().jjtAccept(this, null);

    TupleExpr result = new Union(leftArg, rightArg);

    if (node.isDistinct()) {
      result = new Distinct(result);
    }
View Full Code Here

    throws VisitorException
  {
    TupleExpr leftArg = (TupleExpr)node.getLeftArg().jjtAccept(this, null);
    TupleExpr rightArg = (TupleExpr)node.getRightArg().jjtAccept(this, null);

    TupleExpr result = new Union(leftArg, rightArg);

    if (node.isDistinct()) {
      result = new Distinct(result);
    }
View Full Code Here

    graphPattern = new GraphPattern(parentGP);
    node.jjtGetChild(1).jjtAccept(this, null);
    TupleExpr rightArg = graphPattern.buildTupleExpr();

    parentGP.addRequiredTE(new Union(leftArg, rightArg));
    graphPattern = parentGP;

    return null;
  }
View Full Code Here

    throws VisitorException
  {
    TupleExpr leftArg = (TupleExpr)node.getLeftArg().jjtAccept(this, null);
    TupleExpr rightArg = (TupleExpr)node.getRightArg().jjtAccept(this, null);

    TupleExpr result = new Union(leftArg, rightArg);

    if (node.isDistinct()) {
      result = new Distinct(result);
    }
View Full Code Here

TOP

Related Classes of org.openrdf.query.algebra.Union

Copyright © 2018 www.massapicom. 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.