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

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


  }

  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

  }

 
  @Override
  public void insertFederatedQueryOperator(final ASTService node, final OperatorConnection connection){
    Node child0 = node.jjtGetChild(0);
    if (child0 instanceof ASTVar) {
      Join join = new Join();
      connection.connect(join);
      SeveralSucceedingOperators sso = new SeveralSucceedingOperators();
      sso.addSucceedingOperator(join, 0);
View Full Code Here

      while(n.jjtGetParent()!=null && !(n instanceof ASTGraphConstraint)){
        n = n.jjtGetParent();
      }
      String additionalGraphVariable = "";
      if(n instanceof ASTGraphConstraint){
        final Node child0 = n.jjtGetChild(0);
        if(child0 instanceof ASTVar) {
          additionalGraphVariable = " " + ((ASTVar)child0).toQueryString();
        }
      }
      // intermediate Strings are used for the special queries
View Full Code Here

  @Override
  public Object evaluate(final ASTFunctionCall node, final Bindings b, final Map<Node, Object> d) throws TypeErrorException, NotBoundException {
    final Literal name = LazyLiteral.getLiteral(node.jjtGetChild(0));
    final ExternalFunction externalFunction = EvaluationVisitorImplementation.externalFunctions.get(name);
    if(externalFunction!=null){
      final Node child1 = node.jjtGetChild(1);
      final int number = child1.jjtGetNumChildren();
      final Object[] args = new Object[number];
      for(int i=0; i<number; i++){
        args[i] = child1.jjtGetChild(i).accept(this, b, d);
      }
      return externalFunction.evaluate(args);
    }
    if (name.toString().startsWith("<http://www.w3.org/2001/XMLSchema#")) {
      return Helper.cast(name.toString(), this.resultOfChildZero(node.jjtGetChild(1), b, d));
View Full Code Here

      final Map<Node, Object> d) throws NotBoundException, TypeErrorException {
    if (node.jjtGetNumChildren() == 0) {
      return "";
    }
    // jump over ASTExpressionList!
    final Node child0 = node.jjtGetChild(0);
    if (child0 instanceof ASTNIL || child0.jjtGetNumChildren() == 0) {
      return "";
    }
    Object result = Helper.unlazy(child0.jjtGetChild(0).accept(this, b, d));
    if (Helper.isNumeric(result)) {
      return null;
    }
    for (int i = 1; i < child0.jjtGetNumChildren(); i++) {

      final Object child = Helper.unlazy(child0.jjtGetChild(i).accept(this, b, d));

      if (Helper.isNumeric(child)) {
        return null;
      }
View Full Code Here

      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

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.