Package lupos.gui.operatorgraph.visualeditor.operators

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


  }

  @Override
  protected Operator createOperator(final Class<? extends Operator> clazz, final Item content) throws Exception {

    Operator newOp = null;

    newOp = clazz.newInstance();

    return newOp;
  }
View Full Code Here



  @Override
  protected Operator createOperator(final Class<? extends Operator> clazz, final Item content) throws Exception {

    Operator newOp = null;

    newOp = clazz.newInstance();

    return newOp;
  }
View Full Code Here

  public JSONObject toJSON() {
    final JSONObject saveObject = new JSONObject();
    this.operatorNames.clear();

    for(final GraphWrapper gw : this.boxes.keySet()) {
      final Operator op = (Operator) gw.getElement();

      // AbstractTermOperator
      if (op instanceof AbstractTermOperator) {
        final AbstractTermOperator ato = (AbstractTermOperator) op;
        if (!ato.isChild()) {
View Full Code Here

      if( operatorObject.has("TERMS") ) {
        termsObject = operatorObject.getJSONObject("TERMS");
      }

      Operator op = null;
      // Connections
      if (opName.equals("CONNECTIONS")) {
        continue;
      }
      // UnitermOperator
      if (operatorObject.has("OP TYPE")
          && operatorObject.getString("OP TYPE").equals(
              "UnitermOperator" ) && (termsObject != null)) {

        final UnitermOperator uniTerm = new UnitermOperator();
        uniTerm.fromJSON(operatorObject, uniTerm, this);

        uniTerm.setConstantComboBoxEntries(this.visualRifEditor.getDocumentContainer().getActiveDocument().getDocumentEditorPane().getPrefixList());
        uniTerm.setVisualRifEditor(this.visualRifEditor);
        uniTerm.setTermName(operatorObject.getString("TERMNAME"));
        uniTerm.getUniTermComboBox().setSelectedItem(operatorObject.getString("SELECTEDPREFIX"));
        uniTerm.setSelectedPrefix(operatorObject.getString("SELECTEDPREFIX"));
        uniTerm.setExternal(operatorObject.getBoolean("EXTERNAL"));
        uniTerm.setNamed(operatorObject.getBoolean("NAMED"));

        // get savedTerms
        final HashMap<String,Term> unsortedTerms = this.getSavedTerms(termsObject,uniTerm);

        // sort terms
        final LinkedList<Term> terms =  this.sortTerms(unsortedTerms);

        uniTerm.setTerms(terms);

        op = uniTerm;
      } // end UnitermOperator

      // ListOperator
      if (operatorObject.has("OP TYPE")
          && operatorObject.getString("OP TYPE").equals(
              "ListOperator") && (termsObject != null)) {

        final ListOperator listOp = new ListOperator();

        listOp.fromJSON(operatorObject, listOp, this);

        listOp.setConstantComboBoxEntries(this.visualRifEditor.getDocumentContainer().getActiveDocument().getDocumentEditorPane().getPrefixList());
        listOp.setVisualRifEditor(this.visualRifEditor);
        listOp.setOpen(operatorObject.getBoolean("ISOPEN"));

        // get savedTerms
        final HashMap<String,Term> unsortedTerms = this.getSavedTerms(termsObject,listOp);

        // sort terms
        final LinkedList<Term> terms =  this.sortTerms(unsortedTerms);

        listOp.setTerms(terms);

        op = listOp;
      } // end ListOperator

      // FrameOperator
      if (operatorObject.has("OP TYPE")
          && operatorObject.getString("OP TYPE").equals(
              "FrameOperator") && (termsObject != null)) {

        final FrameOperator frameOp = new FrameOperator();
        frameOp.setConstantComboBoxEntries(this.visualRifEditor.getDocumentContainer().getActiveDocument().getDocumentEditorPane().getPrefixList());
        frameOp.setVisualRifEditor(this.visualRifEditor);


        // get savedTerms
        final HashMap<String,Term> unsortedTerms = this.getSavedTerms(termsObject,frameOp);

        // sort terms
        final LinkedList<Term> terms =  this.sortTerms(unsortedTerms);

        frameOp.setTerms(terms);

        op = frameOp;
      } // end FrameOperator

      // AND
      if (operatorObject.has("OP TYPE")
          && operatorObject.getString("OP TYPE").equals(
              "and")) {
        final AndContainer andContainer = new AndContainer();
        andContainer.setVisualRifEditor(this.visualRifEditor);
        andContainer.fromJSON(operatorObject.getJSONObject("OPERATORGRAPH"));
        op = andContainer;
      }

      // Or
      if (operatorObject.has("OP TYPE")
          && operatorObject.getString("OP TYPE").equals(
              "or")) {
        final OrContainer orContainer = new OrContainer();
        orContainer.setVisualRifEditor(this.visualRifEditor);
        orContainer.fromJSON(operatorObject.getJSONObject("OPERATORGRAPH"));
        op = orContainer;
      }

      // Exists
      if (operatorObject.has("OP TYPE")
          && operatorObject.getString("OP TYPE").equals(
              "exists")) {
        final ExistsContainer existsContainer = new ExistsContainer();
        existsContainer.setVisualRifEditor(this.visualRifEditor);
        existsContainer.fromJSON(operatorObject.getJSONObject("OPERATORGRAPH"));
        op = existsContainer;
      }

      // Variable
      if (operatorObject.has("OP TYPE")
          && operatorObject.getString("OP TYPE").equals(
              "VariableOperator")) {
        final VariableOperator variableOperator = new VariableOperator();
        variableOperator.setVisualRifEditor(this.visualRifEditor);
        variableOperator.fromJSON(operatorObject,variableOperator,this);
        op = variableOperator;
      }

      // Constant
      if (operatorObject.has("OP TYPE")
          && operatorObject.getString("OP TYPE").equals(
              "ConstantOperator")) {
        final ConstantOperator constantOperator = new ConstantOperator();
        constantOperator.setVisualRifEditor(this.visualRifEditor);
        constantOperator.fromJSON(operatorObject, constantOperator, this);
        op = constantOperator;
      }

      System.out.println(operatorObject.getString("OP TYPE"));
      final JSONArray positionArray = operatorObject.getJSONArray("POSITION");

      if (this.isRecursiveOperatorGraph() ) {
        System.out.println("this.isRecursiveOperatorGraph() "+op.getClass().getSimpleName());

        this.operatorContainer.addOperator(op);
      }

      this.addOperator(positionArray.getInt(0), positionArray.getInt(1), op);
View Full Code Here

    rootArray = new Operator[numberOfRootElements];

    // Prefix
    if ( !this.vrg.getRifDocument().getPrefixMap().isEmpty() ){
      final Operator root = (Operator) this.vrg.getRifDocument().accept(this.vrg, null);
//      root.setParents();
      rootArray[cnt] = root;
      cnt++;
    }

    // Rules
    if ( !this.vrg.getRifDocument().getChildren().isEmpty() ){
      for (int i = 0; i < this.vrg.getRifDocument().getChildren().size(); i++) {
        final Operator root = (Operator) this.vrg.getRifDocument().getChildren().get(i).accept(this.vrg, null);
//        root.setParents();
        rootArray[cnt] = root;
        cnt++;
      }
    }
View Full Code Here

    }
  }

  @Override
  public int hashCode() {
    final Operator elem = (Operator) this.element;
    return System.identityHashCode(elem);
  }
View Full Code Here

        if( (term.isList() || term.isUniterm()) ){

          GraphWrapper childGW = term.getSucceedingOperator();
         
          if(childGW==null){
            Operator dummyOperator = term.getDummyOperator();
           
            if(dummyOperator==null){
              continue;
            }
           
View Full Code Here

        if( (term.isList() || term.isUniterm()) ){

          GraphWrapper childGW = term.getSucceedingOperator();
         
          if(childGW==null){
            Operator dummyOperator = term.getDummyOperator();
           
            if(dummyOperator==null){
              continue;
            }
           
View Full Code Here

    StringBuffer ret = this.serializeDatasetClause();

    ret.append("{\n");

    for(OperatorIDTuple<Operator> opIDT : this.succeedingOperators) {
      Operator op = opIDT.getOperator();

      if(op instanceof ConstructTemplateContainer) {
        ret.append(op.serializeOperatorAndTree(visited));
      }
    }

    ret.append("}\n");

    // WHERE
    ret.append("WHERE {\n");

    for(OperatorIDTuple<Operator> opIDT : this.succeedingOperators) {
      Operator op = opIDT.getOperator();

      if(!(op instanceof ConstructTemplateContainer)) {
        ret.append(opIDT.getOperator().serializeOperatorAndTree(visited));
      }
    }
View Full Code Here

    final Item subjectItem = subjectPanel.getSelectedElement();
    final Item predicateItem = predicatePanel.getSelectedElement();

    // add the subject operator...
    this.visualEditor.prepareOperatorForAdd(QueryRDFTerm.class);
    final Operator subjectOp = this.queryGraph.addOperator(5, 5,
        subjectItem);

    // create the connection between subject and object operator with the
    // right predicate item...
    final Connection<Operator> connectionMode = new QueryConnection(
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.