Package lupos.gui.operatorgraph.visualeditor.operators

Examples of lupos.gui.operatorgraph.visualeditor.operators.Operator


    final Item predicateItem = predicatePanel.getSelectedElement();
    final Item objectItem = objectPanel.getSelectedElement();

    // add the object operator...
    this.visualEditor.prepareOperatorForAdd(QueryRDFTerm.class);
    final Operator objectOp = this.queryGraph.addOperator(5, 5, objectItem);

    // create the connection between subject and object operator with the
    // right predicate item...
    final Connection<Operator> connectionMode = new QueryConnection(
        this.visualEditor);
View Full Code Here


      for( final Term term : this.getTerms()){
        System.out.println(term.isUniterm());
        if( (term.isList() || term.isUniterm()) ){
          final GraphWrapper childGW = term.getSucceedingOperator();
          if(childGW==null){
            final Operator dummyOperator = term.getDummyOperator();
            if(dummyOperator==null){
              continue;
            }
            list.add(dummyOperator);
View Full Code Here

   * @param query
   *            the query to parse
   */
  protected void evaluateQuery(final String query) {
    try {
      final Operator rootNode = this.parseQuery(query); // parse the query

      // generate QueryGraph...
      final JPanel graphPanel = this.visualGraphs.get(0).createGraph(
          new GraphWrapperOperator(rootNode),
          Arrange.values()[0]);
View Full Code Here

    // generate VisualQuery and get root element of it...
    final VisualQueryGenerator vqg = new VisualQueryGenerator(
        ((VisualGraphOperatorWithPrefix) this.visualGraphs.get(0)).prefix);

    final Operator rootNode = (Operator) root.jjtAccept(
        (SPARQL1_1ParserVisitor) vqg, null);
    rootNode.setParents();

    this.statusBar.clear();

    return rootNode;
  }
View Full Code Here

  @Override
  protected void pasteElements(final String content) {
    final int rowY = this.visualGraphs.getFirst().getMaxY() + (int) this.visualGraphs.get(0).SPACING_Y;

    try {
      final Operator rootNode = this.parseQuery(content);

      this.visualGraphs.get(0).addToRootList(
          new GraphWrapperOperator(rootNode));
      this.visualGraphs.get(0).arrange(Arrange.values()[0]);
    } catch (final Throwable e) {
      this.statusBar.clear();

      try {
        final LinkedList<Object> result = new LinkedList<Object>();

        final LinkedHashMap<Item, QueryRDFTerm> rdfHash = new LinkedHashMap<Item, QueryRDFTerm>();
        // TODO if insertion into data editor or into an existing
        // TripleContainer, then all existing items (of the
        // TripleContainer
        // 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;
            newOp.setParents();

            final GraphBox graphBox = this.visualGraphs.get(0).graphBoxCreator.createGraphBox(
                this.visualGraphs.get(0),
                new GraphWrapperOperator(newOp));
            graphBox.setY(rowY);
View Full Code Here

      else if(ret == 2) {
        this.visualEditor.prepareOperatorForAdd(ConstructTemplateContainer.class);
      }

      if(ret == 1 || ret == 2) {
        final Operator operator = this.addOperator(x, y);

        this.visualEditor.prepareOperatorForAdd(QueryRDFTerm.class);
        ((ContainerPanel) operator.getGUIComponent()).getQueryGraph().addOperator((int) this.PADDING, (int) this.PADDING);
      }

      return false;
    }
View Full Code Here

    return true;
  }

  protected Operator createOperator(Class<? extends Operator> clazz, Item content) throws Exception {
    // get the chosen operator...
    Operator newOp = null;

    try {
      newOp = clazz.getDeclaredConstructor(RuleEnum.class, String.class).newInstance(RuleEnum.values()[0], "");
    }
    catch(NoSuchMethodException nsme) {
View Full Code Here

  @Override
  public Object visit(final ASTQuery node, final Object data) {
    final int numberChildren = node.jjtGetNumChildren();
    final String graphConstraint = null;

    Operator testOP = null;

    for (int i = 0; i < numberChildren; i++){
      final Operator testOP2 = (Operator) node.jjtGetChild(i).jjtAccept(
          this, graphConstraint);
      if(testOP==null) {
        testOP = testOP2;
      }
    }
View Full Code Here

      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));

            testOP = filterOp;
          }
        }
View Full Code Here


    final Graph g = new Graph(this.prefix, item);

    for (int i = 1; i < numberChildren; i++) {
      final Operator op = (Operator) node.jjtGetChild(i).jjtAccept(
          this, data);

      g.addSucceedingOperator(new OperatorIDTuple<Operator>(op, i - 1));
    }
View Full Code Here

TOP

Related Classes of lupos.gui.operatorgraph.visualeditor.operators.Operator

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.