Package lupos.engine.operators.tripleoperator

Examples of lupos.engine.operators.tripleoperator.TriplePattern


  }

  public Object visit(RulePredicate obj, Object arg) throws RIFException {
    if (obj.isTriple() && arg instanceof BasicOperator) {

      final TriplePattern pattern = unitermToTriplePattern(obj);
      final BasicIndexScan index = root.newIndexScan(null,
          new ArrayList<TriplePattern>(Arrays.asList(pattern)), null);
      final BindableIndexScan bindIndex = new BindableTripleIndexScan(index);
      datasetIndex.addBindableIndex(bindIndex);
      ((BasicOperator) arg).addSucceedingOperator(bindIndex);
View Full Code Here


  protected TriplePattern unitermToTriplePattern(Uniterm obj) {
    Item subject = (Item) obj.termParams.get(0).accept(this, null);
    Item predicate = (Item) obj.termName.accept(this, null);
    Item object = (Item) obj.termParams.get(1).accept(this, null);
    TriplePattern pattern = new TriplePattern(subject, predicate, object);
    return pattern;
  }
View Full Code Here

      if(opID!=null) {
        join.addSucceedingOperator(opID);
      }
      return join;
    } else if(triplePatterns.size()==1){
      final TriplePattern tp = triplePatterns.iterator().next();
      if(opID!=null) {
        tp.addSucceedingOperator(opID);
      }
      this.currentPatternMatcher.add(tp);
      return tp;
    } else {
      throw new Error("There should be at least one Triple Pattern given!");
View Full Code Here

        item[i] = getItem(n.jjtGetChild(0));
      } else {
        item[i] = getItem(n);
      }
    }
    final TriplePattern tpe = new TriplePattern(item[0], item[1], item[2]);
    return tpe;
  }
View Full Code Here

        predicateNode = predicateNode.jjtGetChild(0);
      }
      final BasicOperator startingOperator = predicateNode.accept(this, connection, graphConstraint, subject, object, subjectNode, objectNode);

      final Item[] items = {subject,this.getVariable(subject.toString(),object.toString(),"predicate"),object};
      final TriplePattern tp = new TriplePattern(items);
      final LinkedList<TriplePattern> temp = new LinkedList<TriplePattern>();
      temp.add(tp);
      final BasicOperator memoryScan = this.indexScanCreator.createIndexScanAndConnectWithRoot(null, temp, graphConstraint);

      Set<Literal> allowedObjects = null;
View Full Code Here

      final Closure closure = new Closure(subject, object, allowedSubjects, allowedObjects);
      startingOperator.addSucceedingOperator(new OperatorIDTuple(closure,0));

      final Item[] items = {subject,this.getVariable(subject.toString(),object.toString(),"predicate"),object};
      final TriplePattern tp = new TriplePattern(items);
      final LinkedList<TriplePattern> temp = new LinkedList<TriplePattern>();
      temp.add(tp);
      final BasicOperator memoryScan = this.indexScanCreator.createIndexScanAndConnectWithRoot(null, temp, graphConstraint);

      final PathLengthZero zeroOperator = new PathLengthZero(subject, object, allowedSubjects, allowedObjects);
View Full Code Here

      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);
View Full Code Here

    final Minus minus = new Minus();
    final Union union = new Union();

    final Item[] items = {subject, this.getVariable(subject.toString(), object.toString(), "b"), object};
    final TriplePattern tp = new TriplePattern(items);
    final LinkedList<TriplePattern> temp = new LinkedList<TriplePattern>();
    temp.add(tp);
    this.indexScanCreator.createIndexScanAndConnectWithRoot(new OperatorIDTuple(minus,0), temp, graphConstraint);
    for (int i = 0; i < node.jjtGetNumChildren(); i++){
      final Item[] items2 = new Item[3];
      if(node.jjtGetChild(i) instanceof ASTInvers){
        items2[0] = object;
        items2[1] = getItem(node.jjtGetChild(i).jjtGetChild(0));
        items2[2] = subject;
      } else {
        items2[0] = subject;
        items2[1] = getItem(node.jjtGetChild(i));
        items2[2] = object;
      }
      final TriplePattern tp2 = new TriplePattern(items2);
      final LinkedList<TriplePattern> temp2 = new LinkedList<TriplePattern>();
      temp2.add(tp2);
      this.indexScanCreator.createIndexScanAndConnectWithRoot(new OperatorIDTuple(union,i), temp2, graphConstraint);
    }
View Full Code Here

  @Override
  public BasicOperator visit(final ASTQuotedURIRef node,
      final OperatorConnection connection, final Item graphConstraint,
      final Variable subject, final Variable object, final Node subjectNode, final Node objectNode) {
    final Item[] items = {subject, getItem(node), object};
    final TriplePattern tp = new TriplePattern(items);
    final LinkedList<TriplePattern> temp = new LinkedList<TriplePattern>();
    temp.add(tp);
    return this.indexScanCreator.createIndexScanAndConnectWithRoot(null, temp, graphConstraint);
  }
View Full Code Here

        if (n instanceof ASTTripleSet) {
          final Node predicate = n.jjtGetChild(1);
          if (predicate instanceof ASTArbitraryOccurencesNotZero || predicate instanceof ASTArbitraryOccurences || predicate instanceof ASTOptionalOccurence) {
            multipleOccurencesToJoin.add((ASTTripleSet) n);
          } else {
            final TriplePattern tp = this.getTriplePattern((ASTTripleSet) n);
            triplePatternToJoin.add(tp);
          }
        } else if (this.isHigherConstructToJoin(n)) {
          if(!(n instanceof ASTService) ||  this.serviceGenerator.countsAsJoinPartner((ASTService)n)){
            numberUnionOrGraphConstraints++;
View Full Code Here

TOP

Related Classes of lupos.engine.operators.tripleoperator.TriplePattern

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.