Ejemplo n.º 1
0
 /*
  * Returns the process:components value for a Control Construct. If it is
  * null, it will be set to list:nil, and this will be returned.
  */
 private OWLIndividual getComponents(OWLIndividual inst) {
   OWLIndividual components =
       (OWLIndividual) OWLUtils.getNamedSlotValue(inst, "process:components", okb);
   if (components == null) {
     components = okb.getOWLIndividual("list:nil");
     OWLUtils.setNamedSlotValue(inst, "process:components", components, okb);
   }
   return components;
 }
Ejemplo n.º 2
0
 /*
  * Called after a new main control construct is set on a composite process.
  * Updates the composedOf property on the c.p.
  */
 private void updateCompositeProcess(OWLIndividual construct) {
   // System.out.println("Updating composite process " + cp +
   // " with process:composedOf = " + construct.getName());
   if (construct != null) {
     OWLUtils.setNamedSlotValue(cp, "process:composedOf", construct, getOWLModel());
   } else {
     OWLUtils.removeNamedSlotValue(cp, "process:composedOf", getOWLModel());
   }
 }
Ejemplo n.º 3
0
  protected void setupGUI() {
    super.setupGUI();
    JPanel typesPanel = ComponentFactory.createPanel();
    typesPanel.setLayout(new BoxLayout(typesPanel, BoxLayout.Y_AXIS));

    JPanel targetWsdlTypePanel = new JPanel(new BorderLayout());
    JLabel targetWsdlTypeLabel = ComponentFactory.createLabel("Target WSDL type");
    JTextArea targetWsdlTypeArea = ComponentFactory.createTextArea();
    targetWsdlTypeArea.setEditable(false);
    JScrollPane targetWsdlTypePane = ComponentFactory.createScrollPane(targetWsdlTypeArea);
    targetWsdlTypePanel.add(targetWsdlTypeLabel, BorderLayout.NORTH);
    targetWsdlTypePanel.add(targetWsdlTypePane, BorderLayout.CENTER);

    targetWsdlTypeArea.setText(getXMLSchemaText(wsdlInputMessagePart));

    JPanel sourceOWLTypesPanel = new JPanel(new BorderLayout());
    JLabel sourceOWLTypesLabel = ComponentFactory.createLabel("Source OWL Types");
    JTextArea sourceOWLTypesArea = ComponentFactory.createTextArea();
    sourceOWLTypesArea.setEditable(false);
    JScrollPane sourceOWLTypesPane = ComponentFactory.createScrollPane(sourceOWLTypesArea);
    sourceOWLTypesPanel.add(sourceOWLTypesLabel, BorderLayout.NORTH);
    sourceOWLTypesPanel.add(sourceOWLTypesPane, BorderLayout.CENTER);

    Collection owlParams = generateParameterList();
    OWLIndividual owlParam = null;
    String owlText = "";
    OWLNamedClass LocalCls = okb.getOWLNamedClass("process:Local");
    OWLNamedClass InputCls = okb.getOWLNamedClass("process:Input");
    for (Iterator it = owlParams.iterator(); it.hasNext(); ) {
      owlParam = (OWLIndividual) it.next();
      if (owlParam.hasRDFType(LocalCls, true)) {
        owlText +=
            "Local: "
                + owlParam.getName()
                + " with type: "
                + OWLUtils.getParameterType(owlParam, okb).getName()
                + "\n";
      } else if (owlParam.hasRDFType(InputCls, true)) {
        owlText +=
            "Input: "
                + owlParam.getName()
                + " with type: "
                + OWLUtils.getParameterType(owlParam, okb).getName();
      }
    }
    sourceOWLTypesArea.setText(owlText);

    typesPanel.add(targetWsdlTypePanel);
    typesPanel.add(sourceOWLTypesPanel);
    tabs.add("Type Information", typesPanel);
  }
Ejemplo n.º 4
0
 private OWLDatatypeProperty chooseDatatypeProperty() {
   return (OWLDatatypeProperty)
       DisplayUtilities.pickInstanceFromCollection(
           (Component) this,
           OWLUtils.sortFrameCollection(okb.getOWLDatatypePropertyClass().getInstances(true)),
           0,
           "Select a datatype property");
 }
Ejemplo n.º 5
0
  /** Creates the tree for a composite process instance, and returns the root node of this tree. */
  private OWLSTreeNode getCompositionTreeNodes(OWLIndividual inst) {
    OWLIndividual i = (OWLIndividual) OWLUtils.getNamedSlotValue(inst, "process:composedOf", okb);

    if (i != null) {
      OWLSTreeNodeInfo newni = new OWLSTreeNodeInfo(i, okb);
      OWLSTreeNode node = createTree(newni, inst, new HashSet());
      // PerformTreeMapper mapper = PerformTreeMapper.getInstance();
      // mapper.printAll();
      return node;
    } else return null;
  }
Ejemplo n.º 6
0
  /**
   * Creates the tree from a ControlConstruct. It returns the root node created even though the
   * caller already has it, since the method is recursive, and this is needed internally. This
   * method is only called when the user switches to a different composite process, to recreate the
   * whole tree.
   *
   * <p>Note: This method is not used to create RootNode instances - those are created directly
   * (i.e. using new RootNode()).
   *
   * <p>We also generate Vectors of unconditional predecessor Performs, and associate those with the
   * Perform constructs using the PerformTreeMapper class. See that class for more info.
   */
  private OWLSTreeNode createTree(OWLSTreeNodeInfo ni, OWLIndividual cp, Set preds) {
    OWLIndividual inst = ni.getInstance();
    if (inst == null) {
      System.out.println("ERROR! OWLSTreeMapper.createTree(): inst is null!");
      return null;
    }

    OWLSTreeNode newnode = OWLSTreeNodeFactory.createTreeNode(ni);
    // System.out.println("Building tree for " + newnode.toString());

    if (newnode instanceof ProduceNode) {
      // Store the mapping from produce to composite process in the
      // PerformTreeMapper. This will allow us to generate the Produce's
      // parents, which we need for the ProducedBindingWidget.
      OWLIndividual produce = newnode.getInstance();
      PerformTreeMapper mapper = PerformTreeMapper.getInstance();
      mapper.put(produce, cp);
      mapper.addPredecessors(produce, preds);
    } else if (newnode instanceof PerformNode) {
      // Store the mapping from perform to composite process in the
      // PerformTreeMapper. This will allow us to generate the Performs's
      // parents, which we need for the HasDataFromWidget.
      OWLIndividual perform = newnode.getInstance();
      PerformTreeMapper mapper = PerformTreeMapper.getInstance();
      mapper.put(perform, cp);
      mapper.addPredecessors(perform, preds);
      preds.add(perform);
      // mapper.printAll();
    } else if (newnode instanceof SequenceNode) {
      OWLIndividual components = getComponents(inst);
      // OWLSList clist = new OWLSList(components, OWLSList.CC_LIST, okb);
      OWLSList clist = new OWLSList(inst, okb);
      while (clist.hasNext()) {
        OWLIndividual i = (OWLIndividual) clist.next();
        if (i == null) System.out.println("instance in list is null!");
        OWLSTreeNodeInfo newni = new OWLSTreeNodeInfo(i, okb);
        newnode.add(createTree(newni, cp, preds));
      }
    } else if (newnode instanceof SplitNode || newnode instanceof ChoiceNode) {
      OWLIndividual components = getComponents(inst);
      // OWLSList clist = new OWLSList(components, OWLSList.CC_BAG, okb);
      OWLSList clist = new OWLSList(inst, okb);
      while (clist.hasNext()) {
        HashSet mypreds = new HashSet(preds);
        OWLIndividual i = (OWLIndividual) clist.next();
        OWLSTreeNodeInfo newni = new OWLSTreeNodeInfo(i, okb);
        newnode.add(createTree(newni, cp, mypreds));
      }
    } else if (newnode instanceof SplitJoinNode || newnode instanceof AnyOrderNode) {
      OWLIndividual components = getComponents(inst);
      // OWLSList clist = new OWLSList(components, OWLSList.CC_BAG, okb);
      OWLSList clist = new OWLSList(inst, okb);
      HashSet predsIn = new HashSet(preds);
      while (clist.hasNext()) {
        OWLIndividual i = (OWLIndividual) clist.next();
        OWLSTreeNodeInfo newni = new OWLSTreeNodeInfo(i, okb);
        HashSet mypreds = new HashSet(predsIn);
        newnode.add(createTree(newni, cp, mypreds));
        preds.addAll(mypreds);
      }
    }
    // We put the then-node first and the else-node second as a convention
    // This may need to be handled better (marking the nodes somehow).
    else if (newnode instanceof IfThenElseNode) {
      OWLIndividual thenc = (OWLIndividual) OWLUtils.getNamedSlotValue(inst, "process:then", okb);
      OWLSTreeNodeInfo thenni = new OWLSTreeNodeInfo(thenc, okb);
      HashSet mypreds = new HashSet(preds);
      newnode.add(createTree(thenni, cp, mypreds));
      OWLIndividual elsec = (OWLIndividual) OWLUtils.getNamedSlotValue(inst, "process:else", okb);
      OWLSTreeNodeInfo elseni = new OWLSTreeNodeInfo(elsec, okb);
      if (elsec != null) {
        mypreds = new HashSet(preds);
        newnode.add(createTree(elseni, cp, mypreds));
      }
    } else if (newnode instanceof RepeatWhileNode) {
      OWLIndividual whileProcess =
          (OWLIndividual) OWLUtils.getNamedSlotValue(inst, "process:whileProcess", okb);
      OWLSTreeNodeInfo newni = new OWLSTreeNodeInfo(whileProcess, okb);
      HashSet mypreds = new HashSet(preds);
      newnode.add(createTree(newni, cp, mypreds));
    } else if (newnode instanceof RepeatUntilNode) {
      OWLIndividual untilProcess =
          (OWLIndividual) OWLUtils.getNamedSlotValue(inst, "process:untilProcess", okb);
      OWLSTreeNodeInfo newni = new OWLSTreeNodeInfo(untilProcess, okb);
      newnode.add(createTree(newni, cp, preds));
    } else {
      System.out.println("Unsupported control construct");
      return null;
    }
    return newnode;
  }
Ejemplo n.º 7
0
 private RDFResource getParameterType(OWLIndividual msgMap) {
   OWLIndividual param = getOwlsParameter(msgMap);
   return OWLUtils.getParameterType(param, okb);
 }