Package EDU.oswego.cs.dl.util.concurrent

Examples of EDU.oswego.cs.dl.util.concurrent.WaitFreeQueue$Node


public abstract class ServiceGeneratorToJoinWithOriginal extends ServiceGenerator {
  @Override
  public void insertFederatedQueryOperator(final ASTService node, final OperatorConnection connection){
    SeveralSucceedingOperators sso = new SeveralSucceedingOperators();
    BasicOperator federatedQuery = this.getFederatedQuery(node);
    Node child0 = node.jjtGetChild(0);
    if(child0 instanceof ASTVar){
      Sort sort = new Sort();
      LinkedList<Variable> listOfVars = new LinkedList<Variable>();
      listOfVars.add(new Variable(((ASTVar)child0).getName()));
      ComparatorVariables comparator = new ComparatorVariables(listOfVars);
View Full Code Here


      try {
        final ASTGroupConstraint node = SPARQL1_1Parser.parseN3GroupGraphPatternsAndRDFTerms(content);

        for(int i = 0; i < node.jjtGetNumChildren(); i++) {
          final Node child = node.jjtGetChild(i);

          if(child instanceof ASTGroupConstraint) {
            final VisualDataGenerator vdg = new VisualDataGenerator(((VisualGraphOperatorWithPrefix) this.visualGraphs.get(0)).prefix);
            rdfTermToJoin.addAll((Collection<Operator>) child.jjtAccept((SPARQL1_1ParserVisitor) vdg, rdfHash));
          }
          else {
            // it is an RDF term!
            final Item item = SPARQLCoreParserVisitorImplementation.getItem(child);
View Full Code Here

      final HashMap<Item, QueryRDFTerm> rdfHash = new HashMap<Item, QueryRDFTerm>();
      final LinkedHashSet<Operator> rdfTermToJoin = new LinkedHashSet<Operator>();

      for (int i = 0; i < node.jjtGetNumChildren(); i++) {
        final Node n = node.jjtGetChild(i);

        if (n instanceof ASTTripleSet) {
          final QueryRDFTerm rdft = (QueryRDFTerm) n.jjtAccept(
              this, rdfHash);

          rdfTermToJoin.add(rdft);

        } else if (n instanceof ASTUnionConstraint
            || n instanceof ASTGraphConstraint) {
          numberUnionOrGraphConstraints++;
        }
      }

      int numberJoinPartner = numberUnionOrGraphConstraints;

      if (rdfTermToJoin.size() > 0) {
        numberJoinPartner++;
      }

      Operator testOP = null;

      if (numberJoinPartner > 1) {
        final Join joinOp = new Join();

        int j = 0;

        for (int i = 0; i < node.jjtGetNumChildren(); i++) {
          final Node n = node.jjtGetChild(i);

          if (n instanceof ASTUnionConstraint
              || n instanceof ASTGraphConstraint) {
            testOP = (Operator) n.jjtAccept(
                this, data);

            if (testOP != null) {
              joinOp.addSucceedingOperator(new OperatorIDTuple<Operator>(
                  testOP, j));
            }

            j++;
          }
        }

        if (rdfTermToJoin.size() > 0) {
          final TripleContainer opContainer = new TripleContainer(
              rdfTermToJoin);

          joinOp.addSucceedingOperator(new OperatorIDTuple<Operator>(
              opContainer, j));
        }

        testOP = joinOp;
      } else { // There should be only triple patterns or one
        // ASTUnionConstraint / ASTGraphConstraint
        for (int i = 0; i < node.jjtGetNumChildren(); i++) {
          final Node n = node.jjtGetChild(i);

          if (n instanceof ASTTripleSet) {
            final TripleContainer opContainer = new TripleContainer(
                rdfTermToJoin);

            testOP = opContainer;

            break;
          } else if (n instanceof ASTUnionConstraint
              || n instanceof ASTGraphConstraint) {
            testOP = (Operator) n.jjtAccept(
                this, data);

            break;
          }
        }
      }

      for (int i = 0; i < node.jjtGetNumChildren(); i++) {
        final Node n = node.jjtGetChild(i);

        if (n instanceof ASTOptionalConstraint) {
          final Optional optional = new Optional();

          if (testOP != null) {
            optional.addSucceedingOperator(new OperatorIDTuple<Operator>(
                testOP, 0));
          }

          testOP = (Operator) n.jjtAccept(
              this, null);

          if (testOP != null) {
            optional.addSucceedingOperator(new OperatorIDTuple<Operator>(
                testOP, 1));
          }

          testOP = optional;
        }
      }

      for (int i = 0; i < node.jjtGetNumChildren(); i++) {
        final Node n = node.jjtGetChild(i);

        Operator filterOp = null;

        if (n instanceof ASTFilterConstraint) {
          filterOp = (Operator) n.jjtAccept(
              this, data);

          if (filterOp != null) {
            filterOp.addSucceedingOperator(new OperatorIDTuple<Operator>(
                testOP, 0));
View Full Code Here

    final int numberChildren = node.jjtGetNumChildren();
    final String graphConstraint = null;

    Item item=null;

    final Node child = node.jjtGetChild(0);

    if (child instanceof ASTQuotedURIRef) {
      try {
        item = LiteralFactory.createURILiteral(((ASTQuotedURIRef) child).getQRef());
      } catch (final URISyntaxException e) {
View Full Code Here

  @SuppressWarnings("unchecked")
  public Object visit(ASTTripleSet node, Object data) {
    Item[] item = { null, null, null };

    for(int i = 0; i < 3; i++) {
      Node n = node.jjtGetChild(i);
      item[i] = SPARQLCoreParserVisitorImplementation.getItem(n);
    }

    HashMap<Item, DataRDFTerm> rdfHash = (HashMap<Item, DataRDFTerm>) data;
    DataRDFTerm rdfTermSubject = rdfHash.get(item[0]);
View Full Code Here

    try {
      HashMap<Item, DataRDFTerm> rdfHash = (HashMap<Item, DataRDFTerm>) data;
      LinkedHashSet<Operator> rdfTermToJoin = new LinkedHashSet<Operator>();

      for(int i = 0; i < node.jjtGetNumChildren(); i++) {
        Node n = node.jjtGetChild(i);

        if(n instanceof ASTTripleSet) {
          DataRDFTerm rdft = (DataRDFTerm) n.jjtAccept((SPARQL1_1ParserVisitor) this, rdfHash);

          rdfTermToJoin.add(rdft);
        }
      }
View Full Code Here

    }
  }

  @Override
  public String visit(final ASTFilterConstraint node) {
    final Node n = new SimpleNode(0);
    final Node parent = node.jjtGetParent();
    n.jjtAddChild(node, 0);
    node.jjtSetParent(n);
    parent.replaceChild2(node, n);
    n.jjtSetParent(parent);
    this.applyRules(node);
    String ret = "";
    final String prefix = (parent instanceof ASTOrderConditions || parent instanceof ASTHaving)? "" : "FILTER";
    final String postfix = (parent instanceof ASTOrderConditions || parent instanceof ASTHaving)? "" : ".\n";
    final int numberOfChildren = n.jjtGetNumChildren();
    for (int i = 0; i < numberOfChildren; i++) {
      final Node currentChild=n.jjtGetChild(i);
      for(int j=0; j<currentChild.jjtGetNumChildren();j++){
        ret += prefix + "(" + this.visitChild(currentChild, j) + ")"+postfix;
      }
    }
    return ret;
  }
View Full Code Here

  }

  private int applyRules(final Node node) {
    if (this.rules[FILTER_AND] && node instanceof ASTFilterConstraint
        && node.jjtGetChild(0) instanceof ASTAndNode) {
      final Node parent = node.jjtGetParent();
      if (this.filter_and((ASTFilterConstraint) node)) {
        return this.applyRules(parent);
      }
    }
    if (this.rules[FILTER_OR] && node instanceof ASTAndNode) {
View Full Code Here

  }

  private boolean nestedOr(final ASTAndNode node) {
    final int ind = this.checkNestedOr(node);
    if (ind >= 0) {
      final Node parent = node.jjtGetParent();
      final Node or = node.jjtGetChild(ind).clone(false);
      node.removeChild(ind);
      parent.addChild(or);
      or.addChild(node);
      final ASTAndNode addAnd = (ASTAndNode) node.cloneStillChild(false);
      node.addChild(or.jjtGetChild(0));
      addAnd.addChild(or.jjtGetChild(0));
    }
    return ind >= 0;
  }
View Full Code Here

     * Then the predicate gets visited by teaching him about the curent subject and object
     * The returned expression is stored in the ret String
     * This way the loop will put together all predicates with every element of the correspondending ObjectList
     */
    for (int i = indexStart; i < node.jjtGetNumChildren(); i+=2) {
      final Node currentObjectList =node.jjtGetChild(i+1);
      for(int j = 0; j < currentObjectList.jjtGetNumChildren(); j++){
        final Node currentObject = currentObjectList.jjtGetChild(j);
        if(currentObject instanceof ASTBlankNodePropertyList || currentObject instanceof ASTCollection){
          ret += node.jjtGetChild(i).accept(this, subject, this.getVarOrBlankNode(currentObject)) + "\n";
          ret += this.visitChild(currentObjectList,j);
        } else {
          ret += node.jjtGetChild(i).accept(this, subject, this.visitChild(currentObjectList,j)) + "\n";
View Full Code Here

TOP

Related Classes of EDU.oswego.cs.dl.util.concurrent.WaitFreeQueue$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.