コード例 #1
0
 @Override
 public PetriNet mine(LogReader logReader) {
   if (logReader != null) {
     // Mine the log for a Petri net.
     AlphaPPProcessMiner miningPlugin = new AlphaPPProcessMiner();
     PetriNetResult result = (PetriNetResult) miningPlugin.mine(logReader);
     return result.getPetriNet();
   } else {
     System.err.println("No log reader could be constructed.");
     return null;
   }
 }
コード例 #2
0
ファイル: NullIndex.java プロジェクト: CaoAo/BeehiveZ
  public TreeSet<ProcessQueryResult> getPetriNet(Object o) {
    TreeSet<ProcessQueryResult> ret = new TreeSet<ProcessQueryResult>();
    if (o instanceof PetriNet) {
      PetriNet q = (PetriNet) o;
      DataManager dm = DataManager.getInstance();
      String strSelectPetriNet = "select process_id, pnml from petrinet";
      ResultSet rs =
          dm.executeSelectSQL(strSelectPetriNet, 0, Integer.MAX_VALUE, dm.getFetchSize());
      try {
        while (rs.next()) {
          PetriNet c = null;
          if (dm.getDBName().equalsIgnoreCase("postgresql")
              || dm.getDBName().equalsIgnoreCase("mysql")) {
            String str = rs.getString("pnml");
            byte[] temp = str.getBytes();
            c = PetriNetUtil.getPetriNetFromPnmlBytes(temp);
          } else if (dm.getDBName().equalsIgnoreCase("derby")) {
            InputStream in = rs.getAsciiStream("pnml");
            PnmlImport pnml = new PnmlImport();
            PetriNetResult result = (PetriNetResult) pnml.importFile(in);
            c = result.getPetriNet();
            result.destroy();
            in.close();
          } else {
            System.out.println(dm.getDBName() + " unsupported");
            System.exit(-1);
          }
          long process_id = rs.getLong("process_id");

          if (Ullman4PetriNet.subGraphIsomorphism(q, c)) {
            ret.add(new ProcessQueryResult(process_id, 1));
          }
          c.destroyPetriNet();
        }
        java.sql.Statement stmt = rs.getStatement();
        rs.close();
        stmt.close();
      } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }

    return ret;
  }