File size: 3,593 Bytes
8097001
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import pm4py
import os
from pm4py.util import constants, pandas_utils
import importlib.util
import unittest


class SimplifiedInterface2Test(unittest.TestCase):
    def test_import_ocel_sqlite_1(self):
        ocel = pm4py.read_ocel("input_data/ocel/newocel.sqlite")

    def test_import_ocel_sqlite_2(self):
        ocel = pm4py.read_ocel_sqlite("input_data/ocel/newocel.sqlite")

    def test_export_ocel_sqlite(self):
        ocel = pm4py.read_ocel("input_data/ocel/newocel.jsonocel")
        pm4py.write_ocel(ocel, "test_output_data/newocel2.sqlite")
        os.remove("test_output_data/newocel2.sqlite")

    def test_reduce_invisibles(self):
        net, im, fm = pm4py.read_pnml("input_data/running-example.pnml")
        pm4py.reduce_petri_net_invisibles(net)

    def test_reduce_implicit_places(self):
        net, im, fm = pm4py.read_pnml("input_data/running-example.pnml")
        pm4py.reduce_petri_net_implicit_places(net, im, fm)

    def test_language_df(self):
        for legacy_obj in [True, False]:
            log = pm4py.read_xes("input_data/running-example.xes", return_legacy_log_object=legacy_obj)
            pm4py.get_stochastic_language(log)

    def test_language_log(self):
        log = pm4py.read_xes("input_data/running-example.xes", return_legacy_log_object=True)
        pm4py.get_stochastic_language(log)

    def test_language_model(self):
        net, im, fm = pm4py.read_pnml("input_data/running-example.pnml")
        pm4py.get_stochastic_language(net, im, fm)

    def test_conversion_df_to_nx(self):
        for legacy_obj in [True, False]:
            log = pm4py.read_xes("input_data/running-example.xes", return_legacy_log_object=legacy_obj)
            pm4py.convert_log_to_networkx(log)

    def test_conversion_log_to_nx(self):
        log = pm4py.read_xes("input_data/running-example.xes", return_legacy_log_object=True)
        pm4py.convert_log_to_networkx(log)

    def test_conversion_ocel_to_nx(self):
        ocel = pm4py.read_ocel("input_data/ocel/example_log.jsonocel")
        pm4py.convert_ocel_to_networkx(ocel)

    def test_conversion_df_to_ocel(self):
        for legacy_obj in [True, False]:
            log = pm4py.read_xes("input_data/running-example.xes", return_legacy_log_object=legacy_obj)
            pm4py.convert_log_to_ocel(log)

    def test_conversion_log_to_ocel(self):
        log = pm4py.read_xes("input_data/running-example.xes", return_legacy_log_object=True)
        pm4py.convert_log_to_ocel(log)

    def test_conversion_ocelcsv_to_ocel(self):
        dataframe = pandas_utils.read_csv("input_data/ocel/example_log.csv")
        pm4py.convert_log_to_ocel(dataframe, activity_column="ocel:activity", timestamp_column="ocel:timestamp")

    def test_conversion_petri_to_nx(self):
        net, im, fm = pm4py.read_pnml("input_data/running-example.pnml")
        nx_digraph = pm4py.convert_petri_net_to_networkx(net, im, fm)

    def test_stochastic_language(self):
        if importlib.util.find_spec("pyemd"):
            log1 = pm4py.read_xes("input_data/running-example.xes")
            log2 = pm4py.read_xes("input_data/running-example.xes", return_legacy_log_object=True)
            lang1 = pm4py.get_stochastic_language(log1)
            lang2 = pm4py.get_stochastic_language(log2)
            pm4py.compute_emd(lang1, lang2)

    def test_hybrid_ilp_miner(self):
        for legacy_obj in [True, False]:
            log = pm4py.read_xes("input_data/running-example.xes", return_legacy_log_object=legacy_obj)
            pm4py.discover_petri_net_ilp(log)


if __name__ == "__main__":
    unittest.main()