Exemple #1
0
  /**
   * EPML2PNML
   *
   * @param args String[]
   */
  private static void EPML2PNML(String[] args) {
    if (args.length != 2) {
      System.out.println("���ṩEPML�ļ�·����PNML���Ŀ¼!");
      System.exit(-1);
    }
    epmlImport epml = new epmlImport();
    // load the single epml file
    String filename = args[0];
    try {
      EPCResult epcRes = (EPCResult) epml.importFile(new FileInputStream(filename));
      // convert all epc models to pnml files
      ArrayList<ConfigurableEPC> alEPCs = epcRes.getAllEPCs();
      PnmlExport export = new PnmlExport();
      for (ConfigurableEPC epc : alEPCs) {
        String id = epc.getIdentifier();
        if (id.equals("1An_klol")
            || id.equals("1An_l1y8")
            || id.equals("1Ex_dzq9")
            || id.equals("1Ex_e6dx")
            || id.equals("1Ku_9soy")
            || id.equals("1Ku_a4cg")
            || id.equals("1Or_lojl")
            || id.equals("1Pr_d1ur")
            || id.equals("1Pr_djki")
            || id.equals("1Pr_dkfa")
            || id.equals("1Pr_dl73")
            || id.equals("1Ve_musj")
            || id.equals("1Ve_mvwz")) continue;
        // save pnml files to the same folder
        File outFile = new File(args[1] + "/" + id + ".pnml");
        if (outFile.exists()) continue;
        FileOutputStream fos = new FileOutputStream(outFile);
        PetriNet petri = AMLtoPNML.convert(epc);
        try {
          export.export(new ProvidedObject("PetriNet", new Object[] {petri}), fos);
        } catch (Exception ex1) {
          ex1.printStackTrace(System.out);
        }
      }
    } catch (IOException ex) {
      ex.printStackTrace(System.out);
    }

    System.out.println("EPML Conversion Done");
  }
 private IntervalXYDataset getHistrogrammedDataAttributes(
     String[] attributes, long barsize, long timesize) {
   IntervalXYDataset dataset = null;
   if (no_intervals) {
     dataset = new XYSeriesCollection();
   } else {
     dataset = new YIntervalSeriesCollection();
   }
   for (int index = 0; index < attributes.length; index++) {
     Histogram histogram = new Histogram(barsize);
     String attribute = attributes[index];
     for (ProcessInstance pi : mylog.getInstances()) {
       Date begin;
       try {
         begin = pi.getAuditTrailEntryList().get(0).getTimestamp();
       } catch (Exception e) {
         Message.add(e.getMessage(), Message.ERROR);
         return null;
       } // starting time of process instance
       int j = 0;
       for (AuditTrailEntry ate : pi.getListOfATEs()) {
         if (ate.getAttributes().containsKey(attribute)) {
           Double val;
           val = Double.valueOf(ate.getAttributes().get(attribute));
           if (xbox.getSelectedIndex() == 2) {
             histogram.addValue(j, val);
           }
           if (xbox.getSelectedIndex() == 3) {
             histogram.addValue(timediff(begin, ate.getTimestamp()), val);
           }
           j++;
         }
       }
     }
     if (no_intervals) {
       ((XYSeriesCollection) dataset).addSeries(histogram.getXYSeries(attribute, timesize));
     } else {
       ((YIntervalSeriesCollection) dataset)
           .addSeries(histogram.getYIntervalSeries(attribute, timesize));
     }
   }
   return dataset;
 }
Exemple #3
0
  private static void AML2PNML(String[] args) {
    if (args.length != 3) {
      System.out.println("���ṩAML����Ŀ¼��PNML���Ŀ¼�Լ��ֵ��ļ�!");
      System.exit(-1);
    }
    System.out.println("����Ŀ¼��" + args[0]);
    System.out.println("���Ŀ¼��" + args[1]);
    System.out.println("�ֵ��ļ���" + args[2]);
    // load the dict
    AMLtoPNML.loadDict(args[2]);
    File srcDir = new File(args[0]);
    File[] lstAML = srcDir.listFiles();
    PnmlExport export = new PnmlExport();
    for (int i = 0; i < lstAML.length; i++) {
      if (lstAML[i].isDirectory()) {
        continue;
      }
      System.out.print(lstAML[i].getName() + "==>");
      try {
        FileInputStream fis = new FileInputStream(lstAML[i]);
        int idx = lstAML[i].getName().indexOf(".xml");
        File outFile = new File(args[1] + "/" + lstAML[i].getName().substring(0, idx) + ".pnml");
        FileOutputStream fos = new FileOutputStream(outFile);
        EPCResult epcRes = (EPCResult) AMLtoPNML.importFile(fis);
        ConfigurableEPC epc = epcRes.getMainEPC();
        PetriNet petri = AMLtoPNML.convert(epc);
        export.export(new ProvidedObject("PetriNet", new Object[] {petri}), fos);
        System.out.println(outFile.getName());
      } catch (FileNotFoundException ex) {
        ex.printStackTrace(System.out);
      } catch (IOException ioe) {
        ioe.printStackTrace(System.out);
      } catch (Exception e) {
        e.printStackTrace(System.out);
      }
    }

    System.out.println("Conversion Done");
  }