Java Code Examples for org.eclipse.rdf4j.query.algebra.Join#replaceChildNode()

The following examples show how to use org.eclipse.rdf4j.query.algebra.Join#replaceChildNode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeneralizedExternalProcessor.java    From rya with Apache License 2.0 6 votes vote down vote up
@Override
public void meet(Join node) {

          if (compSet.contains(node.getRightArg())) {
              this.toBeReplaced = node.getRightArg();
              node.replaceChildNode(node.getRightArg(), replacement);
              return;
          } else if (compSet.contains(node.getLeftArg())) {
              this.toBeReplaced = node.getLeftArg();
              node.replaceChildNode(node.getLeftArg(), replacement);
              return;
          } else {
              super.meet(node);
          }

      }
 
Example 2
Source File: GeneralizedExternalProcessor.java    From rya with Apache License 2.0 6 votes vote down vote up
@Override
public void meet(Join queryNode) {

          // if query tree contains external tuples and they are not
          // positioned above statement pattern node
          // reposition
          if (this.extTuples.size() > 0 && !(queryNode.getRightArg() instanceof ExternalTupleSet)
                  && !(queryNode.getRightArg() instanceof BindingSetAssignment)) {

              if (queryNode.getLeftArg() instanceof ExternalTupleSet) {
                  QueryModelNode temp = queryNode.getLeftArg();
                  queryNode.setLeftArg(queryNode.getRightArg());
                  queryNode.setRightArg((TupleExpr)temp);
              } else {

                  QNodeExchanger qnev = new QNodeExchanger(queryNode.getRightArg(), this.extTuples);
                  queryNode.visit(qnev);
                  queryNode.replaceChildNode(queryNode.getRightArg(), qnev.getReplaced());
                  super.meet(queryNode);
              }
          } else {
              super.meet(queryNode);
          }

      }
 
Example 3
Source File: GeneralizedExternalProcessor.java    From rya with Apache License 2.0 6 votes vote down vote up
@Override
public void meet(Join queryNode) {

          // if query tree contains external tuples and they are not
          // positioned above statement pattern node
          // reposition
          if (this.bsas.size() > 0 && !(queryNode.getRightArg() instanceof BindingSetAssignment)) {
              QNodeExchanger qnev = new QNodeExchanger(queryNode.getRightArg(), bsas);
              queryNode.visit(qnev);
              queryNode.replaceChildNode(queryNode.getRightArg(), qnev.getReplaced());
              super.meet(queryNode);
          } else {
              super.meet(queryNode);
          }

      }
 
Example 4
Source File: GeneralizedExternalProcessor.java    From rya with Apache License 2.0 5 votes vote down vote up
@Override
public void meet(Join node) {

          if (!compSet.contains(node.getRightArg())) {
              // looks for placed to position filter node. if right node is
              // contained in index
              // and left node is statement pattern node contained in index or
              // is a join, place
              // filter above join.
              if (node.getLeftArg() instanceof Join || !compSet.contains(node.getLeftArg())) {

                  QueryModelNode pNode = node.getParentNode();
                  ((Filter) filter).setArg(node);
                  pNode.replaceChildNode(node, filter);
                  filterPlaced = true;

                  return;
              } // otherwise place filter below join and above right arg
              else {
                  ((Filter) filter).setArg(node.getRightArg());
                  node.replaceChildNode(node.getRightArg(), filter);
                  filterPlaced = true;
                  return;

              }
          } else if (node.getLeftArg() instanceof StatementPattern && !compSet.contains(node.getLeftArg())) {

              ((Filter) filter).setArg(node.getLeftArg());
              node.replaceChildNode(node.getLeftArg(), filter);
              filterPlaced = true;

              return;
          } else {
              super.meet(node);
          }
      }