Esempio n. 1
0
 def setUp(self):
     """
     Set up unit test environment
     """
     event_log_path = 'FRQ9 input files/FRQ9evaluationlog1.xes'
     dcr_graph_path = 'FRQ9 input files/FRQ9_evaluation1.xml'
     self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
     self.event_log = eventlog_parser.get_event_log(event_log_path)
     self.ca = ConformanceAnalysisData()
     cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
     for trace in self.event_log.Traces:
         cc_dcr.perform_conformance_checking(trace, self.ca)
     self.violated_traces = self.ca.create_violated_traces_dict()
Esempio n. 2
0
def main():
    """
    Program main method starts by parsing the DCR graph afterwards retrieving the Event Log
    subsequently the conformance is checked
    :return:
    """
    global dcr_graph

    # input
    dcr_graph = DCRGraph.get_graph_instance(xml_path)
    event_log = eventlog_parser.get_event_log(data_path, use_celonis)
    ca = ConformanceAnalysisData()
    # throughput
    # if parallel is set: a thread pool is created
    if parallel:

        threads = []
        for trace in event_log.Traces:
            t = Thread(target=perform_conformance_checking, args=(trace, ca))
            threads.append(t)
        for t in threads:
            t.start()
        for t in threads:
            t.join()
    # sequential conformance checking (Debugging purposes)
    else:
        for trace in event_log.Traces:
            perform_conformance_checking(trace, ca)
    # output
    create_conformance_output(ca, event_log)
Esempio n. 3
0
class EvaluateFRQ9Test1(unittest.TestCase):
    """
    a is augmented with data, and checked if it can
    """
    def setUp(self):
        """
        Set up unit test environment
        """
        event_log_path = 'FRQ9 input files/FRQ9evaluationlog1.xes'
        dcr_graph_path = 'FRQ9 input files/FRQ9_evaluation1.xml'
        self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
        self.event_log = eventlog_parser.get_event_log(event_log_path)
        self.ca = ConformanceAnalysisData()
        cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
        for trace in self.event_log.Traces:
            cc_dcr.perform_conformance_checking(trace, self.ca)
        self.violated_traces = self.ca.create_violated_traces_dict()

    def test_expression_related_to_different_event_transition(self):
        """
        For the transition and Include connection is used
        a - c - d does not work when d is not included because of the data constraint related to a
        :return:
        """
        self.assertTrue(len(self.violated_traces) == 1)
        self.assertTrue(self.violated_traces['a  -c  -d'] == 1)
        self.assertTrue(self.ca.ViolatedActivities["d"] == 1)
Esempio n. 4
0
class EvaluateFRQ8Test3(unittest.TestCase):
    """
    Check if pending response transition is correctly performed with Nesting activities
    """
    def setUp(self):
        """
        Set up unit test environment
        """
        event_log_path = 'FRQ8 input files/FRQ8evaluationlog1.xes'
        dcr_graph_path = 'FRQ8 input files/FRQ8_evaluation3.xml'
        self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
        self.event_log = eventlog_parser.get_event_log(event_log_path)
        self.ca = ConformanceAnalysisData()
        cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
        for trace in self.event_log.Traces:
            cc_dcr.perform_conformance_checking(trace, self.ca)
        self.violated_traces = self.ca.create_violated_traces_dict()

    def test_pending_response_target_nesting_activity(self):
        """
        b c e
        a c d
        case should work
        :return:
        """
        self.assertTrue(len(self.violated_traces) == 0)
Esempio n. 5
0
class EvaluateFRQ8Test4(unittest.TestCase):
    """
    Check if pending response transition works properly
    """
    def setUp(self):
        """
        Set up unit test environment
        """
        event_log_path = 'FRQ8 input files/FRQ8evaluationlog1.xes'
        dcr_graph_path = 'FRQ8 input files/FRQ8_evaluation4.xml'
        self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
        self.event_log = eventlog_parser.get_event_log(event_log_path)
        self.ca = ConformanceAnalysisData()
        cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
        for trace in self.event_log.Traces:
            cc_dcr.perform_conformance_checking(trace, self.ca)
        self.violated_traces = self.ca.create_violated_traces_dict()

    def test_pending_response_target_nesting_activity(self):
        """
        b c e traces should not work because d is Pending and thereby the Nesting activity is also pending
        a c d traces should work
        :return:
        """
        self.assertTrue(len(self.violated_traces) == 1)

        self.assertTrue(self.violated_traces['b  -c  -e'] == 8)
        self.assertTrue(len(self.ca.ViolatingTraces))
        self.assertTrue(self.ca.ViolatedPending['d'] == 8)
        self.assertTrue(self.ca.ViolatedPending['NestingActivity'] == 8)
Esempio n. 6
0
class EvaluateFRQ8Test12(unittest.TestCase):
    """
    Special case with three connections
    """
    def setUp(self):
        """
        Set up unit test environment
        """
        event_log_path = 'FRQ8 input files/FRQ8evaluationlog1.xes'
        dcr_graph_path = 'FRQ8 input files/FRQ8_evaluation12.xml'
        self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
        self.event_log = eventlog_parser.get_event_log(event_log_path)
        self.ca = ConformanceAnalysisData()
        cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
        for trace in self.event_log.Traces:
            cc_dcr.perform_conformance_checking(trace, self.ca)
        self.violated_traces = self.ca.create_violated_traces_dict()

    def test_three_connections(self):
        """
        b c e
        a c d
        No case should fail
        :return:
        """
        self.assertTrue(len(self.violated_traces) == 0)
Esempio n. 7
0
class EvaluateFRQ8Test2(unittest.TestCase):
    """
    Check if exclude nesting activity is performed properly
    """
    def setUp(self):
        """
        Set up unit test environment
        :return:
        """
        event_log_path = 'FRQ8 input files/FRQ8evaluationlog1.xes'
        dcr_graph_path = 'FRQ8 input files/FRQ8_evaluation2.xml'
        self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
        self.event_log = eventlog_parser.get_event_log(event_log_path)
        self.ca = ConformanceAnalysisData()
        cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
        for trace in self.event_log.Traces:
            cc_dcr.perform_conformance_checking(trace, self.ca)
        self.violated_traces = self.ca.create_violated_traces_dict()

    def test_exclude_nesting_activity(self):
        """
        b c e must fail 8 times
        a c d must not fail
        :return:
        """
        self.assertTrue(len(self.violated_traces) == 1)
        self.assertTrue(len(self.ca.ViolatingTraces) == 8)
        self.assertTrue(self.violated_traces['b  -c  -e'] == 8)
        self.assertTrue(self.ca.ViolatedActivities['c'] == 8)
        self.assertTrue(self.ca.ViolatedActivities['e'] == 8)
Esempio n. 8
0
class EvaluateFRQ8Test11(unittest.TestCase):
    """
    Special case with target of a nested activity
    """
    def setUp(self):
        """
        Set up unit test environment
        """
        event_log_path = 'FRQ8 input files/FRQ8evaluationlog1.xes'
        dcr_graph_path = 'FRQ8 input files/FRQ8_evaluation11.xml'
        self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
        self.event_log = eventlog_parser.get_event_log(event_log_path)
        self.ca = ConformanceAnalysisData()
        cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
        for trace in self.event_log.Traces:
            cc_dcr.perform_conformance_checking(trace, self.ca)
        self.violated_traces = self.ca.create_violated_traces_dict()

    def test_response_to_nested_activity(self):
        """
        b c e
        a c d
        all traces must end happily
        :return:
        """
        self.assertTrue(len(self.violated_traces) == 0)
Esempio n. 9
0
class EvaluateFRQ8Test10(unittest.TestCase):
    """
    Checks if multiple milestone connections toward a nesting activity can be evaluated
    """
    def setUp(self):
        """
        Set up unit test environment
        """
        event_log_path = 'FRQ8 input files/FRQ8evaluationlog1.xes'
        dcr_graph_path = 'FRQ8 input files/FRQ8_evaluation10.xml'
        self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
        self.event_log = eventlog_parser.get_event_log(event_log_path)
        self.ca = ConformanceAnalysisData()
        cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
        for trace in self.event_log.Traces:
            cc_dcr.perform_conformance_checking(trace, self.ca)
        self.violated_traces = self.ca.create_violated_traces_dict()

    def test_milestone_target_nesting_activity(self):
        """
        b c e never fails
        a c d must fail twice
        :return:
        """
        self.assertTrue(len(self.violated_traces) == 1)
        self.assertTrue(self.violated_traces['a  -c  -d'] == 2)
        self.assertTrue(len(self.ca.ViolatedConnections) == 1)
Esempio n. 10
0
class EvaluateFRQ8Test7(unittest.TestCase):
    """
    Test nesting activity as condition target
    """
    def setUp(self):
        """
        Set up unit test environment
        :return:
        """
        event_log_path = 'FRQ8 input files/FRQ8evaluationlog1.xes'
        dcr_graph_path = 'FRQ8 input files/FRQ8_evaluation7.xml'
        self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
        self.event_log = eventlog_parser.get_event_log(event_log_path)
        self.ca = ConformanceAnalysisData()
        cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
        for trace in self.event_log.Traces:
            cc_dcr.perform_conformance_checking(trace, self.ca)
        self.violated_traces = self.ca.create_violated_traces_dict()

    def test_condition_target_nesting_activity(self):
        """
        condition from a to the nesting activity is introduced
        b c e fails 8 times because 'e' is blocked by the eclusion of the nesting activity
        a c d
        :return:
        """
        self.assertTrue(len(self.violated_traces) == 1)
        self.assertTrue(self.violated_traces['b  -c  -e'] == 8)
        self.assertTrue(len(self.ca.ViolatedConnections) == 1)
Esempio n. 11
0
class EvaluateFRQ8Test5(unittest.TestCase):
    """
    Test nesting activity as pending response target
    """
    def setUp(self):
        """
        Set up unit test environment
        :return:
        """
        event_log_path = 'FRQ8 input files/FRQ8evaluationlog1.xes'
        dcr_graph_path = 'FRQ8 input files/FRQ8_evaluation5.xml'
        self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
        self.event_log = eventlog_parser.get_event_log(event_log_path)
        self.ca = ConformanceAnalysisData()
        cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
        for trace in self.event_log.Traces:
            cc_dcr.perform_conformance_checking(trace, self.ca)
        self.violated_traces = self.ca.create_violated_traces_dict()

    def test_pending_response_target_nesting_activity(self):
        """
        b c e
        a c d makes e fail twice because it keeps pending
        case should work
        :return:
        """
        self.assertTrue(len(self.violated_traces) == 1)
        self.assertTrue(self.ca.ViolatedPending['e'] == 2)
Esempio n. 12
0
class EvaluateFRQ8Test1(unittest.TestCase):
    """
    Check if Include of a Nesting activity works properly
    """
    def setUp(self):
        """
        Set up unit test environment
        :return:
        """
        event_log_path = 'FRQ8 input files/FRQ8evaluationlog1.xes'
        dcr_graph_path = 'FRQ8 input files/FRQ8_evaluation1.xml'
        self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
        self.event_log = eventlog_parser.get_event_log(event_log_path)
        self.ca = ConformanceAnalysisData()
        cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
        for trace in self.event_log.Traces:
            cc_dcr.perform_conformance_checking(trace, self.ca)
        self.violated_traces = self.ca.create_violated_traces_dict()

    def test_include_nesting_activity(self):
        """
        a - c - d does not work when c is not included by the occurrence of b
        :return:
        """
        self.assertTrue(len(self.violated_traces) == 1)
        self.assertTrue(self.violated_traces['a  -c  -d'] == 2)
        self.assertTrue(self.ca.ViolatedActivities['c'] == 2)
Esempio n. 13
0
 def setUp(self):
     event_log_path = 'FRQ4 input files/FRQ4evaluationlog1.xes'
     dcr_graph_path = 'FRQ4 input files/FRQ4_evaluation.xml'
     self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
     self.event_log = eventlog_parser.get_event_log(event_log_path)
     self.ca = ConformanceAnalysisData()
     cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
     for trace in self.event_log.Traces:
         cc_dcr.perform_conformance_checking(trace, self.ca)
Esempio n. 14
0
 def setUp(self):
     """
     Unit test set up environment
     """
     event_log_path = 'FRQ7 input files/FRQ7evaluationlog2.xes'
     dcr_graph_path = 'FRQ7 input files/FRQ7_evaluation (2).xml'
     self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
     self.event_log = eventlog_parser.get_event_log(event_log_path)
     self.ca = ConformanceAnalysisData()
     cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
     for trace in self.event_log.Traces:
         cc_dcr.perform_conformance_checking(trace, self.ca)
Esempio n. 15
0
class EvaluateFRQ9Test2(unittest.TestCase):
    def setUp(self):
        """
        Set up unit test environment
        :return:
        """
        event_log_path = 'FRQ9 input files/FRQ9evaluationlog2.xes'
        dcr_graph_path = 'FRQ9 input files/FRQ9_evaluation2.xml'
        self.dcr_graph = DCRGraph.get_graph_instance(dcr_graph_path)
        self.event_log = eventlog_parser.get_event_log(event_log_path)
        self.ca = ConformanceAnalysisData()
        cc_dcr.add_dcr_graph_for_test(self.dcr_graph)
        for trace in self.event_log.Traces:
            cc_dcr.perform_conformance_checking(trace, self.ca)
        self.violated_traces = self.ca.create_violated_traces_dict()

    def test_expression_related_to_different_event_milestone(self):
        """
        The milestone between e and d is only active at one occurrence of a and thereby must fail once
        :return:
        """
        self.assertTrue(len(self.violated_traces) == 1)
        self.assertTrue(self.violated_traces['a  -c  -d  -e'] == 1)
        self.assertTrue(self.ca.ViolatedConnections['milestone-e-d'] == 1)