Package es.uma.ama.maudeWorkstationGUI.ui.graph

Examples of es.uma.ama.maudeWorkstationGUI.ui.graph.Graph$Node


        // or from the whole DataEditor) must be first inserted!

        final ASTGroupConstraint node = SPARQL1_1Parser.parseGroupGraphPatternsAndRDFTerms(content);

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

          if (child instanceof ASTGroupConstraint) {
            final VisualQueryGenerator vqg = new VisualQueryGenerator(
                ((VisualGraphOperatorWithPrefix) this.visualGraphs
                    .get(0)).prefix);

            final Object data = child.jjtAccept(
                (SPARQL1_1ParserVisitor) vqg, rdfHash);

            result.add(data);

            final Operator newOp = (Operator) data;
View Full Code Here


  }

  public void registerElementsInPrefixInstance(final SimpleNode root) {
    // walk through children of root node...
    for (int i = 0; i < root.jjtGetNumChildren(); ++i) {
      final Node child = root.jjtGetChild(i); // get current child

      // if children is a prefix declaration...
      if (child instanceof ASTPrefixDecl) {
        // get prefix...
        final String prefixString = ((ASTPrefixDecl) child).getPrefix();

        // get child of PrefixDecl to get the name space...
        final Node prefixDeclChild = child.jjtGetChild(0);

        // if child of PrefixDecl is QuotedURIRef...
        if (prefixDeclChild instanceof ASTQuotedURIRef) {
          // get name space...
          final String namespace = ((ASTQuotedURIRef) prefixDeclChild)
View Full Code Here

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

TOP

Related Classes of es.uma.ama.maudeWorkstationGUI.ui.graph.Graph$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.