Package lupos.engine.operators.singleinput

Examples of lupos.engine.operators.singleinput.Bind


      }
      // TODO consider graphConstraint!
      this.indexScanCreator.createEmptyIndexScanSubmittingQueryResultWithOneEmptyBindingsAndConnectWithRoot(new OperatorIDTuple(projection,0), graphConstraint);
      return projection;
    } else if (!getItem(subjectNode).isVariable()){
      final Bind firstBind = new Bind(object);
      firstBind.addProjectionElement(object, subjectNode);
      // TODO consider graphConstraint!
      this.indexScanCreator.createEmptyIndexScanSubmittingQueryResultWithOneEmptyBindingsAndConnectWithRoot(new OperatorIDTuple(firstBind,0), graphConstraint);
      return firstBind;
    } else if(!getItem(objectNode).isVariable()){
      final LinkedList<TriplePattern> temp = new LinkedList<TriplePattern>();
      final Item[] items = {subject, getItem(node.jjtGetChild(0)), object};
      temp.add(new TriplePattern(items));
      final Bind firstBind = new Bind(subject);
      firstBind.addProjectionElement(subject, objectNode);
      // TODO consider graphConstraint!
      this.indexScanCreator.createEmptyIndexScanSubmittingQueryResultWithOneEmptyBindingsAndConnectWithRoot(new OperatorIDTuple(firstBind,0), graphConstraint);
      return firstBind;
    } else {
      final Union union = new Union();
      final Variable intermediatePredicate = this.getVariable(subject.toString(),object.toString(),"intermediatePredicate");
      final Variable intermediateObject = this.getVariable(subject.toString(),object.toString(),"intermediateObject");
      final Item[] items = {subject, intermediatePredicate, intermediateObject};
      LinkedList<TriplePattern> temp = new LinkedList<TriplePattern>();
      TriplePattern tp = new TriplePattern(items);
      temp.add(tp);
      this.indexScanCreator.createIndexScanAndConnectWithRoot(new OperatorIDTuple(union,0), temp, graphConstraint);

      items[0] = intermediateObject;
      items[1] = intermediatePredicate;
      items[2] = subject;
      temp = new LinkedList<TriplePattern>();
      tp = new TriplePattern(items.clone());
      temp.add(tp);
      this.indexScanCreator.createIndexScanAndConnectWithRoot(new OperatorIDTuple(union,1), temp, graphConstraint);

      final Projection projection = new Projection();
      projection.addProjectionElement(subject);
      projection.addProjectionElement(object);
      if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
        projection.addProjectionElement((Variable)graphConstraint);
      }
      final ASTVar n = new ASTVar(100);
      n.setName(subject.toString().substring(1));
      final Bind bind = new Bind(subject);
      bind.addProjectionElement(object,n);
      union.addSucceedingOperator(new OperatorIDTuple(bind,0));
      bind.addSucceedingOperator(new OperatorIDTuple(projection,0));
      final InMemoryDistinct memoryDistinct = new InMemoryDistinct();
      projection.addSucceedingOperator(new OperatorIDTuple(memoryDistinct,0));
      return memoryDistinct;
    }
  }
View Full Code Here


      for (int i = 0; i < node.jjtGetNumChildren(); i++) {
        final Node n = node.jjtGetChild(i);
        if (n instanceof ASTBind) {
          final ASTVar variable = (ASTVar) n.jjtGetChild(1);
          final Variable variable2 = new Variable(variable.getName());
          final Bind b = new Bind(variable2);
          b.addProjectionElement(variable2, n.jjtGetChild(0));
          connection.connectAndSetAsNewOperatorConnection(b, 0);
        }
      }
      for (int i = 0; i < node.jjtGetNumChildren(); i++) {
        final Node n = node.jjtGetChild(i);
View Full Code Here

TOP

Related Classes of lupos.engine.operators.singleinput.Bind

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.