Package java.util.concurrent

Examples of java.util.concurrent.ConcurrentSkipListMap$Node


      return !this.handleInAndNotIn(node, b, d);
  }

  protected boolean handleInAndNotIn(final Node node, final Bindings b, final Map<Node, Object> d) throws NotBoundException, TypeErrorException {
    final Object arg1 = Helper.unlazy(this.resultOfChildZero(node, b, d));
    final Node child1 = node.jjtGetChild(1);
    for(int i=0; i<child1.jjtGetNumChildren(); i++) {
      final Object arg2 = Helper.unlazy(child1.jjtGetChild(i).accept(this, b, d));
      if(Helper.equals(arg1, arg2)) {
        return true;
      }
    }
    return false;
View Full Code Here


    }
  }

  @Override
  public Object evaluate(final ASTCoalesceFuncNode node, final Bindings b, final Map<Node, Object> d) throws NotBoundException, TypeErrorException {
    final Node child0 = node.jjtGetChild(0);
    for(int i=0; i<child0.jjtGetNumChildren(); i++){
      try {
        return Helper.unlazy(child0.jjtGetChild(i).accept(this, b, d));
      } catch(final Error e){
        // ignore...
      } catch(final Exception e){
        // ignore...
      }
View Full Code Here

  public void visit(final ASTWindow node, final OperatorConnection connection, final Item graphConstraint) {
    ASTType.TYPE dot = ASTType.TYPE.TRIPLES;
    int slidingNumber = 10;
    Literal iri = null;
    for (int i = 0; i < node.jjtGetNumChildren(); i++) {
      final Node n = node.jjtGetChild(i);
      if (n instanceof ASTType) {
        dot = ((ASTType) n).getType();
        slidingNumber = ((ASTType) n).getValue();
        if(dot == ASTType.TYPE.INSTANCESDURATION || dot == ASTType.TYPE.INSTANCESNUMBER){
          iri = ((ASTQuotedURIRef)n.jjtGetChild(0)).getLiteral(true);
        }
      }
    }
    final Window window;
    switch(dot){
      default:
      case TRIPLES:
        window = new WindowTriples(slidingNumber);
        break;
      case DURATION:
        window = new WindowDuration(slidingNumber);
        break;
      case INSTANCESNUMBER:
        window = new WindowInstancesNumber(slidingNumber, iri);
        break;
      case INSTANCESDURATION:
        window = new WindowInstancesDuration(slidingNumber, iri);
        break;
    }
    if (this.indexScanCreator_Stream.getStream() == null) {
      System.out.println("Query uses Window operations, but did not define a stream, asssuming STREAM INTERMEDIATERESULT TRIPLES 1");
      final CollectResult cr = new CollectResult(false);
      this.result.addApplication(cr);
      this.indexScanCreator_Stream.setStream(new StreamTriples(cr, 1));
    }
    this.indexScanCreator_Stream.getStream().addSucceedingOperator(new OperatorIDTuple(window, 0));
    final PatternMatcher currentPatternMatcher = new PatternMatcher();
    window.addSucceedingOperator(new OperatorIDTuple(currentPatternMatcher, 0));
    final PatternMatcher oldPatternMatcher = this.indexScanCreator_Stream.getCurrentPatternMatcher();
    this.indexScanCreator_Stream.setCurrentPatternMatcher(currentPatternMatcher);
    for (int i = 0; i < node.jjtGetNumChildren(); i++) {
      final Node n = node.jjtGetChild(i);
      if (!(n instanceof ASTType)) {
        n.accept(this, connection, graphConstraint);
      }
    }
    this.indexScanCreator_Stream.setCurrentPatternMatcher(oldPatternMatcher);
  }
View Full Code Here

        this.visit((ASTStream)node.jjtGetChild(i));
      }
    }

    int index;
    final Node child0 = node.jjtGetChild(0);
    if(child0 instanceof ASTConstructTemplate){
      this.setGraphConstraints(child0, connection);
      index=1;
    } else {
      index=0;
      for (int i = index; i < node.jjtGetNumChildren(); i++) {
        final Node childi = node.jjtGetChild(i);
        if(childi instanceof ASTGroupConstraint) {
          this.setGraphConstraints(childi, connection);
        }
      }
    }
    for (int i = index; i < node.jjtGetNumChildren(); i++) {
      final Node childi = node.jjtGetChild(i);
      if(childi instanceof ASTGroupConstraint) {
        childi.accept(this, connection, null);
      } else {
        if(!(childi instanceof ASTStream)){
          childi.accept(this, connection);
        }
      }
    }
  }
View Full Code Here

      final Construct c = new Construct();
      c.setTemplates(operators);
      graphConstructs.add(new Tuple<Construct, Item>(c, null));
    }
    for(int i=0; i<node.jjtGetNumChildren();i++){
      final Node child = node.jjtGetChild(i);
      if(child instanceof ASTGraphConstraint){
        final Collection<TriplePattern> otp = this.collectTriplePatternOfChildren(child);
        if(otp.size()>0){
          final Construct c2 = new Construct();
          c2.setTemplates(otp);
          final Node childchild=child.jjtGetChild(0);
          Item item=null;
          if (childchild instanceof ASTQuotedURIRef) {
            try {
              item=LiteralFactory.createURILiteralWithoutLazyLiteral("<"+ childchild.toString() + ">");
            } catch (final Exception e) {
              System.err.println(e);
            }
          } else if(childchild instanceof ASTVar){
            item = new Variable(((ASTVar)childchild).getName());
View Full Code Here

  }

  public Collection<TriplePattern> collectTriplePatternOfChildren(final Node node){
    final Collection<TriplePattern> resultantTriplePatterns = new LinkedList<TriplePattern>();
    for(int i=0; i<node.jjtGetNumChildren(); i++){
      final Node child = node.jjtGetChild(i);
      if(child instanceof ASTTripleSet){
        resultantTriplePatterns.add(this.getTriplePattern((ASTTripleSet)child));
      }
    }
    return resultantTriplePatterns;
View Full Code Here

  public TriplePattern getTriplePattern(final ASTTripleSet node) {
    final Item[] item = { null, null, null };

    for (int i = 0; i < 3; i++) {
      final Node n = node.jjtGetChild(i);
      if(n instanceof ASTObjectList){
        item[i] = getItem(n.jjtGetChild(0));
      } else {
        item[i] = getItem(n);
      }
    }
    final TriplePattern tpe = new TriplePattern(item[0], item[1], item[2]);
View Full Code Here

          realSubject = itm;
          subjectIsALiteral = true;
        } else {
          subject = (Variable) itm;
        }
        final Node subjectNode = tripleSet.jjtGetChild(0);

        itm = getItem(tripleSet.jjtGetChild(2));
        if (!itm.isVariable()){
          object = this.getVariable(getItem(tripleSet.jjtGetChild(0)).toString(), getItem(tripleSet.jjtGetChild(2)).toString(), "interimObject");
          realObject = itm;
          objectIsALiteral = true;
        } else {
          object = (Variable) itm;
        }
        final Node objectNode = tripleSet.jjtGetChild(2);


        final Node predicateNode = tripleSet.jjtGetChild(1);
        final BasicOperator startingOperator = predicateNode.accept(this, connection, graphConstraint, subject, object, subjectNode, objectNode);

        if(!subjectIsALiteral && !objectIsALiteral){
          startingOperator.addSucceedingOperator(connection.getOperatorIDTuple());
        }
        else
          if(subjectIsALiteral && !objectIsALiteral){
            final Filter filter = new Filter("(" + subject + " = " + realSubject +")");
            final Projection projection = new Projection();
            projection.addProjectionElement(object);
            if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
              projection.addProjectionElement((Variable)graphConstraint);
            }

            filter.addSucceedingOperator(new OperatorIDTuple(projection,0));
            projection.addSucceedingOperator(connection.getOperatorIDTuple());
            startingOperator.addSucceedingOperator(new OperatorIDTuple(filter,0));

          }
          else
            if(!subjectIsALiteral && objectIsALiteral){
              final Filter filter = new Filter("(" + object + " = " + realObject + ")");
              final Projection projection = new Projection();
              projection.addProjectionElement(subject);
              if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
                projection.addProjectionElement((Variable)graphConstraint);
              }

              filter.addSucceedingOperator(new OperatorIDTuple(projection,0));
              projection.addSucceedingOperator(connection.getOperatorIDTuple());
              startingOperator.addSucceedingOperator(new OperatorIDTuple(filter,0));

            }
            else
              if(subjectIsALiteral && objectIsALiteral){
                final Filter firstFilter = new Filter("(" + object + " = " + realObject + ")");
                final Filter secondFilter = new Filter("(" + subject + " = " + realSubject + ")");
                final Projection firstProjection = new Projection();
                firstProjection.addProjectionElement(subject);
                if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
                  firstProjection.addProjectionElement((Variable)graphConstraint);
                }
                final Projection secondProjection = new Projection();
                secondProjection.addProjectionElement(object);
                if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
                  secondProjection.addProjectionElement((Variable)graphConstraint);
                }

                firstFilter.addSucceedingOperator(new OperatorIDTuple(firstProjection,0));
                firstProjection.addSucceedingOperator(new OperatorIDTuple(secondFilter, 0));
                secondFilter.addSucceedingOperator(new OperatorIDTuple(secondProjection,0));
                secondProjection.addSucceedingOperator(connection.getOperatorIDTuple());
                startingOperator.addSucceedingOperator(new OperatorIDTuple(firstFilter,0));
              }
      }
      catch( final Exception e){
        e.printStackTrace();
        System.out.println(e);
      }
    } else {
      // alternative way to evaluate (...)?, (...)* and (...)+ without using the Closure and PathLengthZero operators!
      try{
        Variable subject;
        Variable object;
        Item realSubject = null;
        Item realObject = null;
        boolean subjectIsALiteral = false;
        boolean objectIsALiteral = false;
        Item itm = getItem(tripleSet.jjtGetChild(0));
        if (!itm.isVariable()){
          subject = this.getVariable(getItem(tripleSet.jjtGetChild(0)).toString(), getItem(tripleSet.jjtGetChild(2)).toString(), "interimSubject");
          realSubject = itm;
          subjectIsALiteral = true;
        } else {
          subject = (Variable) itm;
        }
        final Node subjectNode = tripleSet.jjtGetChild(0);
        itm = getItem(tripleSet.jjtGetChild(2));
        if (!itm.isVariable()){
          object = this.getVariable(getItem(tripleSet.jjtGetChild(0)).toString(), getItem(tripleSet.jjtGetChild(2)).toString(), "interimObject");
          realObject = itm;
          objectIsALiteral = true;
        } else {
          object = (Variable) itm;
        }
        final Node objectNode = tripleSet.jjtGetChild(2);
        final ReplaceVar replaceVar = new ReplaceVar();
        replaceVar.addSubstitution(object, subject);
        final Variable variable = this.getVariable(subject.toString(), object.toString(), "interimVariable");
        replaceVar.addSubstitution(variable, object);
        if(graphConstraint!=null && graphConstraint.isVariable() && !graphConstraint.equals(getItem(subjectNode)) && !graphConstraint.equals(getItem(objectNode))) {
View Full Code Here

  @Override
  public BasicOperator visit(final ASTOptionalOccurence node,
      final OperatorConnection connection, final Item graphConstraint,
      final Variable subject, final Variable object, final Node subjectNode, final Node objectNode) {
    if(USE_CLOSURE_AND_PATHLENGTHZERO_OPERATORS){
      Node predicateNode = node.jjtGetChild(0);
      while (predicateNode instanceof ASTOptionalOccurence){
        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);
View Full Code Here

  @Override
  public BasicOperator visit(final ASTArbitraryOccurences node,
      final OperatorConnection connection, final Item graphConstraint,
      final Variable subject, final Variable object, final Node subjectNode, final Node objectNode) {
    if(USE_CLOSURE_AND_PATHLENGTHZERO_OPERATORS){
      Node predicateNode = node.jjtGetChild(0);
      while (predicateNode instanceof ASTArbitraryOccurences ||
          predicateNode instanceof ASTArbitraryOccurencesNotZero){
        predicateNode = predicateNode.jjtGetChild(0);
      }
      final BasicOperator startingOperator = predicateNode.accept(this, connection, graphConstraint, subject, object, subjectNode, objectNode);
      // System.out.println(startingOperator);

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

TOP

Related Classes of java.util.concurrent.ConcurrentSkipListMap$Node

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.