Package lupos.gui.operatorgraph.visualeditor.util

Examples of lupos.gui.operatorgraph.visualeditor.util.GraphWrapperOperator


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

      this.visualGraphs.get(0).updateMainPanel(graphPanel);
    } catch (final Throwable e) {
      this.statusBar.clear();
View Full Code Here


    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);
            graphBox.arrange(Arrange.values()[0]);

            this.visualGraphs.get(0).addOperator(graphBox.getX(),
                rowY, newOp);

            // TODO: update x position of last box...
            if (data instanceof OperatorContainer) {
              final OperatorContainer tc = (OperatorContainer) data;

              ((ContainerPanel) tc.getGUIComponent()).arrange(Arrange.values()[0]);

              if (tc.getGUIComponent().getLocation().x < 0) {
                this.visualGraphs
                .get(0)
                .getBoxes()
                .get(new GraphWrapperOperator(tc))
                .setX((int) this.visualGraphs.get(0).PADDING);
              }
            }
          } else {
            // it is an RDF term!
            final Item item = SPARQLCoreParserVisitorImplementation.getItem(child);

            rdfHash.put(
                item,
                new QueryRDFTerm(
                    ((VisualGraphOperatorWithPrefix) this.visualGraphs
                        .get(0)).prefix, item));
          }
        }

        if (result.size() == 1
            && result.get(0) instanceof OperatorContainer) {
          final OperatorContainer tc = (OperatorContainer) result
          .get(0);

          final LinkedHashSet<Operator> hop = new LinkedHashSet<Operator>();

          for (final Operator op : tc.getOperators()) {
            hop.add(op);

            op.visit(new SimpleOperatorGraphVisitor() {
              private static final long serialVersionUID = -350730291684630002L;

              public Object visit(final Operator basicOperator) {
                hop.add(basicOperator);

                return null;
              }
            });
          }

          for (final Operator op : rdfHash.values()) {
            if (!hop.contains(op)) {
              tc.addOperator(op);

              op.setParents();
            }
          }

          ((ContainerPanel) tc.getGUIComponent()).arrange(Arrange.values()[0]);

          if (tc.getGUIComponent().getLocation().x < 0) {
            this.visualGraphs.get(0).getBoxes()
            .get(new GraphWrapperOperator(tc))
            .setX((int) this.visualGraphs.get(0).PADDING);
          }
        } else if (rdfHash.size() > 0) {
          // only single RDF terms are pasted...
          // => collect them in a TripleContainer!
          final LinkedHashSet<Operator> lhso = new LinkedHashSet<Operator>();
          lhso.addAll(rdfHash.values());

          final TripleContainer tc = new TripleContainer(lhso);
          tc.setParents();

          final GraphBox graphBox = this.visualGraphs.get(0).graphBoxCreator.createGraphBox(
              this.visualGraphs.get(0), new GraphWrapperOperator(
                  tc));
          graphBox.setY(rowY);
          graphBox.arrange(Arrange.values()[0]);

          this.visualGraphs.get(0).addOperator(graphBox.getX(), rowY,
              tc);

          ((ContainerPanel) tc.getGUIComponent()).arrange(Arrange.values()[0]);

          if (tc.getGUIComponent().getLocation().x < 0) {
            this.visualGraphs.get(0).getBoxes()
            .get(new GraphWrapperOperator(tc))
            .setX((int) this.visualGraphs.get(0).PADDING);
          }
        }
      } catch (final Throwable pe) {
        JOptionPane.showOptionDialog(this, pe.getMessage(), "Error",
View Full Code Here

  private JRadioButton jRB_mode_all_succeeding = null;
  private JRadioButton jRB_mode_only_succeeding = null;
  private JRadioButton jRB_mode_only_preceding_and_succeeding = null;

  public AnnotationPanel(final VisualGraph<Operator> parent, final AbstractRuleOperator operator, final AbstractRuleOperator child, Triple<Boolean, String, ModeEnum> data) {
    super(parent, new GraphWrapperOperator(operator), operator, false);

    this.parentOp = operator;
    this.child = child;

    boolean active = false;
View Full Code Here

      AnnotationPanel annotationPanel = new AnnotationPanel(parent, this, child, this.annotations.get(child));

      this.annotationLabels.put(child, annotationPanel);

      // add predicate panel to hash table with its GraphWrapper...
      predicates.put(new GraphWrapperOperator(child), annotationPanel);
    }

    return predicates;
  }
View Full Code Here

    final LinkedList<GraphWrapper> rootList = new LinkedList<GraphWrapper>();

    for (final Operator op : RDFTerm.findRootNodes(rdfTermToJoin)) {
      op.setParents();

      rootList.add(new GraphWrapperOperator(op));
    }
    return rootList;
  }
View Full Code Here

      final LinkedList<GraphWrapper> rootList = new LinkedList<GraphWrapper>();

      for (final Operator op : RDFTerm.findRootNodes(rdfTermToJoin)) {
        op.setParents();

        rootList.add(new GraphWrapperOperator(op));
      }

      System.out.println("Displaying data...");

      this.statusBar.setText("Displaying N3 data ...");
View Full Code Here

    final LinkedList<GraphWrapper> rootList = new LinkedList<GraphWrapper>();

    for(final Operator op : RDFTerm.findRootNodes(rdfTermToJoin)) {
      op.setParents();

      rootList.add(new GraphWrapperOperator(op));
    }

    System.out.println("Displaying data...");

    this.visualGraphs.get(0).updateMainPanel(
View Full Code Here

  protected void replaceOperator(final Operator newOP, final VisualGraph<Operator> parent, final GraphWrapper oldGW) {
    newOP.cloneFrom(this);
    this.replaceWith(newOP);

    final GraphWrapper gw = new GraphWrapperOperator(newOP);
    final GraphBox box = parent.getBoxes().get(oldGW);

    box.initBox(gw);
    box.arrange(Arrange.values()[0]);

    parent.getBoxes().remove(oldGW);
    parent.getBoxes().put(gw, box);

    parent.remove(this.panel);
    parent.add(box.getElement());

    for(final Operator preOp : this.precedingOperators) {
      final GraphWrapper preGW = new GraphWrapperOperator(preOp);
      final GraphBox preBox = parent.getBoxes().get(preGW);

      preBox.setLineAnnotations(preOp.drawAnnotations(parent));
    }
View Full Code Here

  public Hashtable<GraphWrapper, AbstractSuperGuiComponent> drawAnnotations(VisualGraph<Operator> parent) {
    Hashtable<GraphWrapper, AbstractSuperGuiComponent> lineLables = new Hashtable<GraphWrapper, AbstractSuperGuiComponent>();

    for(OperatorIDTuple<Operator> opIDt : this.succeedingOperators) {
      GraphWrapper gw = new GraphWrapperOperator(this);
      GraphWrapper childGW = new GraphWrapperOperator(opIDt.getOperator());

      AbstractGuiComponent<Operator> element = new AnnotationPanel<Operator>(parent, gw, this, opIDt.getOperator());

      this.annotationLabels.put(opIDt.getOperator(), element);
View Full Code Here

  protected Prefix prefix;

  protected JLabel addLabel = new JLabel();

  public PredicatePanel(VisualGraph<Operator> parent, final RDFTerm operator, final RDFTerm child, Prefix prefix) {
    super(parent, new GraphWrapperOperator(operator), operator, false);

    this.parentOp = operator;
    this.child = child;
    this.prefix = prefix;
View Full Code Here

TOP

Related Classes of lupos.gui.operatorgraph.visualeditor.util.GraphWrapperOperator

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.