From 06384386970ea556497ac52836aa0a0327486a3e Mon Sep 17 00:00:00 2001 From: MarcusRost Date: Sun, 17 Sep 2023 12:25:45 +0200 Subject: [PATCH 01/15] Added conf to gitignore --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fe8ea39..a209f38 100644 --- a/.gitignore +++ b/.gitignore @@ -134,4 +134,7 @@ dmypy.json # JetBrains IDE .idea/ -.vscode/ \ No newline at end of file +.vscode/ + +# This might be weird, but I think this is where the conf.py should be +tutorial/conf.py \ No newline at end of file From e90abf6b2bae0d6b8673d14c1839f5d49aef5a92 Mon Sep 17 00:00:00 2001 From: MarcusRost Date: Sat, 7 Oct 2023 11:19:56 +0200 Subject: [PATCH 02/15] added new branch for issue #8 --- .gitignore | 3 ++- tests/test_end_constraints.py | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a209f38..3d52a70 100644 --- a/.gitignore +++ b/.gitignore @@ -137,4 +137,5 @@ dmypy.json .vscode/ # This might be weird, but I think this is where the conf.py should be -tutorial/conf.py \ No newline at end of file +tutorial/conf.py +test.mmd \ No newline at end of file diff --git a/tests/test_end_constraints.py b/tests/test_end_constraints.py index 963c20f..0711df8 100644 --- a/tests/test_end_constraints.py +++ b/tests/test_end_constraints.py @@ -1,7 +1,8 @@ -from test_utils import init_test_setup_for_compiler +from test_utils import init_test_setup_for_compiler, init_test_setup_for_parser from file_constants import ( MULTIPLE_ENDINGS_DIAGRAM, LINEAR_SEQUENCE_DIAGRAM_WITHOUT_START_AND_END, + XOR_GATEWAY_SEQUENCE_DIAGRAM ) @@ -18,3 +19,16 @@ def test_end_constraint_is_generated_when_multiple_endings(): def test_end_constraint_is_generated_without_explicit_end_event(): res = init_test_setup_for_compiler(LINEAR_SEQUENCE_DIAGRAM_WITHOUT_START_AND_END) assert "End[second element]" in res + +def test_end_constraint_is_generated_when_multiple_endings(): + res = init_test_setup_for_parser(MULTIPLE_ENDINGS_DIAGRAM) + expected_ending_constraints = [ + "End[activity four]", + "End[action five]", + ] + assert all(constraint in res for constraint in expected_ending_constraints) + +def test_end_constraint_is_generated_when_xor_gateway(): + res = init_test_setup_for_compiler(XOR_GATEWAY_SEQUENCE_DIAGRAM) + assert "End[second element]" in res + assert "End[third element]" in res \ No newline at end of file From bd1a14c9964087de09b3a2efd121949d6fe01385 Mon Sep 17 00:00:00 2001 From: MarcusRost Date: Sat, 7 Oct 2023 15:28:51 +0200 Subject: [PATCH 03/15] Fixed issue #8 with TDD --- bpmnconstraints/parser/bpmn_parser.py | 15 +++++++++++++++ tests/test_end_constraints.py | 20 ++++++++++++-------- tests/test_init_constraints.py | 6 +++++- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/bpmnconstraints/parser/bpmn_parser.py b/bpmnconstraints/parser/bpmn_parser.py index 3bf146c..19def44 100644 --- a/bpmnconstraints/parser/bpmn_parser.py +++ b/bpmnconstraints/parser/bpmn_parser.py @@ -59,12 +59,27 @@ def run(self): self.__mark_gateway_elements() if self.transitivity: self.__add_transitivity() + self.__validate_end_constrains() return self.sequence except Exception: logging.warning( "\nCould not execute model. Make sure that model is:\n1. Formatted correctly.\n2. File ends with .xml or .json." ) + def __validate_end_constrains(self): + for cfo in self.sequence: + if cfo['is end'] and cfo['name'] in GATEWAY_NAMES: + valid_constraint = False + """ for successor in cfo['successor']: + if successor['name'] in ALLOWED_END_EVENTS: + valid_constraint = True """ + if not valid_constraint: + cfo['is end'] = False + for predecessor in cfo['predecessor']: + for item in self.sequence: + if item['name'] == predecessor['name']: + item['is end'] = True + return def __mark_gateway_elements(self): for cfo in self.sequence: predecessors = cfo.get("predecessor") diff --git a/tests/test_end_constraints.py b/tests/test_end_constraints.py index 0711df8..0b65c4b 100644 --- a/tests/test_end_constraints.py +++ b/tests/test_end_constraints.py @@ -2,7 +2,8 @@ from file_constants import ( MULTIPLE_ENDINGS_DIAGRAM, LINEAR_SEQUENCE_DIAGRAM_WITHOUT_START_AND_END, - XOR_GATEWAY_SEQUENCE_DIAGRAM + XOR_GATEWAY_SEQUENCE_DIAGRAM, + LINEAR_MERMAID_GRAPH ) @@ -15,20 +16,23 @@ def test_end_constraint_is_generated_when_multiple_endings(): ] assert all(constraint in res for constraint in expected_ending_constraints) +def test_end_constraint_is_generated_with_linear_parser(): + res = init_test_setup_for_parser(LINEAR_MERMAID_GRAPH) + assert res[-1]['is end'] == True def test_end_constraint_is_generated_without_explicit_end_event(): res = init_test_setup_for_compiler(LINEAR_SEQUENCE_DIAGRAM_WITHOUT_START_AND_END) assert "End[second element]" in res def test_end_constraint_is_generated_when_multiple_endings(): - res = init_test_setup_for_parser(MULTIPLE_ENDINGS_DIAGRAM) + res = init_test_setup_for_parser(XOR_GATEWAY_SEQUENCE_DIAGRAM) + + assert res[-1]['is end'] and res[-2]['is end'] and not res[3]['is end'] + +def test_end_constraint_is_generated_when_xor_gateway(): + res = init_test_setup_for_compiler(XOR_GATEWAY_SEQUENCE_DIAGRAM) expected_ending_constraints = [ "End[activity four]", - "End[action five]", + "End[activity five]", ] assert all(constraint in res for constraint in expected_ending_constraints) - -def test_end_constraint_is_generated_when_xor_gateway(): - res = init_test_setup_for_compiler(XOR_GATEWAY_SEQUENCE_DIAGRAM) - assert "End[second element]" in res - assert "End[third element]" in res \ No newline at end of file diff --git a/tests/test_init_constraints.py b/tests/test_init_constraints.py index e4d3c38..d4ceba8 100644 --- a/tests/test_init_constraints.py +++ b/tests/test_init_constraints.py @@ -12,4 +12,8 @@ def test_init_constraint_is_generated_without_explicit_start_event(): def test_that_each_start_has_init_constraint(): res = init_test_setup_for_compiler(MULTIPLE_STARTS_DIAGRAM) - assert ["Init[path one]", "Init[path two]"] == res + expected_init_constraints = [ + "Init[path one]", + "Init[path two]" + ] + assert all(constraint in res for constraint in expected_init_constraints) From 96cf61522d6ed1638c738462963af0f870ecca40 Mon Sep 17 00:00:00 2001 From: MarcusRostSAP Date: Sun, 8 Oct 2023 13:08:06 +0200 Subject: [PATCH 04/15] added tests for expected outcome --- bpmnconstraints/parser/bpmn_parser.py | 4 ++-- tests/test_init_constraints.py | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bpmnconstraints/parser/bpmn_parser.py b/bpmnconstraints/parser/bpmn_parser.py index 19def44..2a6eb97 100644 --- a/bpmnconstraints/parser/bpmn_parser.py +++ b/bpmnconstraints/parser/bpmn_parser.py @@ -59,14 +59,14 @@ def run(self): self.__mark_gateway_elements() if self.transitivity: self.__add_transitivity() - self.__validate_end_constrains() + self.validate_edge_cases() return self.sequence except Exception: logging.warning( "\nCould not execute model. Make sure that model is:\n1. Formatted correctly.\n2. File ends with .xml or .json." ) - def __validate_end_constrains(self): + def validate_edge_cases(self): for cfo in self.sequence: if cfo['is end'] and cfo['name'] in GATEWAY_NAMES: valid_constraint = False diff --git a/tests/test_init_constraints.py b/tests/test_init_constraints.py index d4ceba8..2473f10 100644 --- a/tests/test_init_constraints.py +++ b/tests/test_init_constraints.py @@ -1,7 +1,8 @@ -from test_utils import init_test_setup_for_compiler +from test_utils import init_test_setup_for_compiler, init_test_setup_for_parser from file_constants import ( LINEAR_SEQUENCE_DIAGRAM_WITHOUT_START_AND_END, MULTIPLE_STARTS_DIAGRAM, + XOR_GATEWAY_SEQUENCE_DIAGRAM ) @@ -17,3 +18,16 @@ def test_that_each_start_has_init_constraint(): "Init[path two]" ] assert all(constraint in res for constraint in expected_init_constraints) + +def test_missing_init_constraints_for_XOR_gate_parser(): + res = init_test_setup_for_parser(XOR_GATEWAY_SEQUENCE_DIAGRAM) + assert res[4]['is start'] and res[5]['is start'] and not res[0]['is start'] + +def test_missing_init_constraints_for_XOR_gate(): + res = init_test_setup_for_compiler(XOR_GATEWAY_SEQUENCE_DIAGRAM) + expected_init_constraints = [ + "Init[activity one]", + "Init[activity two]", + ] + assert all(constraint in res for constraint in expected_init_constraints) + \ No newline at end of file From 3db183556c3c13af4c2516e3d677672015e46d8d Mon Sep 17 00:00:00 2001 From: MarcusRostSAP Date: Sun, 8 Oct 2023 13:16:27 +0200 Subject: [PATCH 05/15] added init edge case check --- bpmnconstraints/parser/bpmn_parser.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bpmnconstraints/parser/bpmn_parser.py b/bpmnconstraints/parser/bpmn_parser.py index 2a6eb97..fd6be06 100644 --- a/bpmnconstraints/parser/bpmn_parser.py +++ b/bpmnconstraints/parser/bpmn_parser.py @@ -67,19 +67,19 @@ def run(self): ) def validate_edge_cases(self): + item_indices = {item['name']: index for index, item in enumerate(self.sequence)} + for cfo in self.sequence: + if cfo['is start'] and cfo['name'] == 'XOR': + cfo['is start'] = False + for successor in cfo['successor']: + self.sequence[item_indices[successor['name']]]['is start'] = True if cfo['is end'] and cfo['name'] in GATEWAY_NAMES: - valid_constraint = False - """ for successor in cfo['successor']: - if successor['name'] in ALLOWED_END_EVENTS: - valid_constraint = True """ - if not valid_constraint: - cfo['is end'] = False - for predecessor in cfo['predecessor']: - for item in self.sequence: - if item['name'] == predecessor['name']: - item['is end'] = True - return + cfo['is end'] = False + for predecessor in cfo['predecessor']: + self.sequence[item_indices[predecessor['name']]]['is end'] = True + + def __mark_gateway_elements(self): for cfo in self.sequence: predecessors = cfo.get("predecessor") From 517c3d5adda619b190d7cf2982bd3ce2ddad8a59 Mon Sep 17 00:00:00 2001 From: MarcusRostSAP Date: Sun, 8 Oct 2023 13:58:32 +0200 Subject: [PATCH 06/15] reformatted for lint-bot --- bpmnconstraints/parser/bpmn_parser.py | 1 - tests/test_end_constraints.py | 3 +++ tests/test_init_constraints.py | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bpmnconstraints/parser/bpmn_parser.py b/bpmnconstraints/parser/bpmn_parser.py index fd6be06..ceffc2f 100644 --- a/bpmnconstraints/parser/bpmn_parser.py +++ b/bpmnconstraints/parser/bpmn_parser.py @@ -79,7 +79,6 @@ def validate_edge_cases(self): for predecessor in cfo['predecessor']: self.sequence[item_indices[predecessor['name']]]['is end'] = True - def __mark_gateway_elements(self): for cfo in self.sequence: predecessors = cfo.get("predecessor") diff --git a/tests/test_end_constraints.py b/tests/test_end_constraints.py index 0b65c4b..e080e90 100644 --- a/tests/test_end_constraints.py +++ b/tests/test_end_constraints.py @@ -20,15 +20,18 @@ def test_end_constraint_is_generated_with_linear_parser(): res = init_test_setup_for_parser(LINEAR_MERMAID_GRAPH) assert res[-1]['is end'] == True + def test_end_constraint_is_generated_without_explicit_end_event(): res = init_test_setup_for_compiler(LINEAR_SEQUENCE_DIAGRAM_WITHOUT_START_AND_END) assert "End[second element]" in res + def test_end_constraint_is_generated_when_multiple_endings(): res = init_test_setup_for_parser(XOR_GATEWAY_SEQUENCE_DIAGRAM) assert res[-1]['is end'] and res[-2]['is end'] and not res[3]['is end'] + def test_end_constraint_is_generated_when_xor_gateway(): res = init_test_setup_for_compiler(XOR_GATEWAY_SEQUENCE_DIAGRAM) expected_ending_constraints = [ diff --git a/tests/test_init_constraints.py b/tests/test_init_constraints.py index 2473f10..afa118a 100644 --- a/tests/test_init_constraints.py +++ b/tests/test_init_constraints.py @@ -19,10 +19,12 @@ def test_that_each_start_has_init_constraint(): ] assert all(constraint in res for constraint in expected_init_constraints) + def test_missing_init_constraints_for_XOR_gate_parser(): res = init_test_setup_for_parser(XOR_GATEWAY_SEQUENCE_DIAGRAM) assert res[4]['is start'] and res[5]['is start'] and not res[0]['is start'] + def test_missing_init_constraints_for_XOR_gate(): res = init_test_setup_for_compiler(XOR_GATEWAY_SEQUENCE_DIAGRAM) expected_init_constraints = [ From 22f69752901ba5d86e59446f78d14272b1569cd6 Mon Sep 17 00:00:00 2001 From: MarcusRostSAP Date: Sun, 8 Oct 2023 14:03:33 +0200 Subject: [PATCH 07/15] further formatting --- bpmnconstraints/parser/bpmn_parser.py | 1 - tests/test_init_constraints.py | 10 +++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/bpmnconstraints/parser/bpmn_parser.py b/bpmnconstraints/parser/bpmn_parser.py index ceffc2f..74fd2a5 100644 --- a/bpmnconstraints/parser/bpmn_parser.py +++ b/bpmnconstraints/parser/bpmn_parser.py @@ -68,7 +68,6 @@ def run(self): def validate_edge_cases(self): item_indices = {item['name']: index for index, item in enumerate(self.sequence)} - for cfo in self.sequence: if cfo['is start'] and cfo['name'] == 'XOR': cfo['is start'] = False diff --git a/tests/test_init_constraints.py b/tests/test_init_constraints.py index afa118a..247776b 100644 --- a/tests/test_init_constraints.py +++ b/tests/test_init_constraints.py @@ -2,7 +2,7 @@ from file_constants import ( LINEAR_SEQUENCE_DIAGRAM_WITHOUT_START_AND_END, MULTIPLE_STARTS_DIAGRAM, - XOR_GATEWAY_SEQUENCE_DIAGRAM + XOR_GATEWAY_SEQUENCE_DIAGRAM, ) @@ -13,16 +13,13 @@ def test_init_constraint_is_generated_without_explicit_start_event(): def test_that_each_start_has_init_constraint(): res = init_test_setup_for_compiler(MULTIPLE_STARTS_DIAGRAM) - expected_init_constraints = [ - "Init[path one]", - "Init[path two]" - ] + expected_init_constraints = ["Init[path one]", "Init[path two]"] assert all(constraint in res for constraint in expected_init_constraints) def test_missing_init_constraints_for_XOR_gate_parser(): res = init_test_setup_for_parser(XOR_GATEWAY_SEQUENCE_DIAGRAM) - assert res[4]['is start'] and res[5]['is start'] and not res[0]['is start'] + assert res[4]["is start"] and res[5]["is start"] and not res[0]["is start"] def test_missing_init_constraints_for_XOR_gate(): @@ -32,4 +29,3 @@ def test_missing_init_constraints_for_XOR_gate(): "Init[activity two]", ] assert all(constraint in res for constraint in expected_init_constraints) - \ No newline at end of file From 0205dfd39e64eaf19e91c5a54d926f20360b7457 Mon Sep 17 00:00:00 2001 From: MarcusRostSAP Date: Sun, 8 Oct 2023 14:06:19 +0200 Subject: [PATCH 08/15] formatted test_end_constraints --- tests/test_end_constraints.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_end_constraints.py b/tests/test_end_constraints.py index e080e90..6bdc9ad 100644 --- a/tests/test_end_constraints.py +++ b/tests/test_end_constraints.py @@ -3,7 +3,7 @@ MULTIPLE_ENDINGS_DIAGRAM, LINEAR_SEQUENCE_DIAGRAM_WITHOUT_START_AND_END, XOR_GATEWAY_SEQUENCE_DIAGRAM, - LINEAR_MERMAID_GRAPH + LINEAR_MERMAID_GRAPH, ) @@ -18,7 +18,7 @@ def test_end_constraint_is_generated_when_multiple_endings(): def test_end_constraint_is_generated_with_linear_parser(): res = init_test_setup_for_parser(LINEAR_MERMAID_GRAPH) - assert res[-1]['is end'] == True + assert res[-1]["is end"] == True def test_end_constraint_is_generated_without_explicit_end_event(): @@ -29,7 +29,7 @@ def test_end_constraint_is_generated_without_explicit_end_event(): def test_end_constraint_is_generated_when_multiple_endings(): res = init_test_setup_for_parser(XOR_GATEWAY_SEQUENCE_DIAGRAM) - assert res[-1]['is end'] and res[-2]['is end'] and not res[3]['is end'] + assert res[-1]["is end"] and res[-2]["is end"] and not res[3]["is end"] def test_end_constraint_is_generated_when_xor_gateway(): From 8f20e772fcae3d9542a735c028f63d032df9b9df Mon Sep 17 00:00:00 2001 From: MarcusRostSAP Date: Sun, 8 Oct 2023 14:08:32 +0200 Subject: [PATCH 09/15] formatted changes in bpmn_parser --- bpmnconstraints/parser/bpmn_parser.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bpmnconstraints/parser/bpmn_parser.py b/bpmnconstraints/parser/bpmn_parser.py index 74fd2a5..a074c8d 100644 --- a/bpmnconstraints/parser/bpmn_parser.py +++ b/bpmnconstraints/parser/bpmn_parser.py @@ -67,16 +67,16 @@ def run(self): ) def validate_edge_cases(self): - item_indices = {item['name']: index for index, item in enumerate(self.sequence)} + item_indices = {item["name"]: index for index, item in enumerate(self.sequence)} for cfo in self.sequence: - if cfo['is start'] and cfo['name'] == 'XOR': - cfo['is start'] = False - for successor in cfo['successor']: - self.sequence[item_indices[successor['name']]]['is start'] = True - if cfo['is end'] and cfo['name'] in GATEWAY_NAMES: - cfo['is end'] = False - for predecessor in cfo['predecessor']: - self.sequence[item_indices[predecessor['name']]]['is end'] = True + if cfo["is start"] and cfo["name"] == "XOR": + cfo["is start"] = False + for successor in cfo["successor"]: + self.sequence[item_indices[successor["name"]]]["is start"] = True + if cfo["is end"] and cfo["name"] in GATEWAY_NAMES: + cfo["is end"] = False + for predecessor in cfo["predecessor"]: + self.sequence[item_indices[predecessor["name"]]]["is end"] = True def __mark_gateway_elements(self): for cfo in self.sequence: From a9566655f125376f83dd4e808a1b757dc0d30ca8 Mon Sep 17 00:00:00 2001 From: MarcusRostSAP Date: Sun, 8 Oct 2023 14:13:35 +0200 Subject: [PATCH 10/15] formatted 2 files for linter --- bpmnconstraints/parser/bpmn_parser.py | 1 + tests/test_end_constraints.py | 1 + 2 files changed, 2 insertions(+) diff --git a/bpmnconstraints/parser/bpmn_parser.py b/bpmnconstraints/parser/bpmn_parser.py index a074c8d..0834128 100644 --- a/bpmnconstraints/parser/bpmn_parser.py +++ b/bpmnconstraints/parser/bpmn_parser.py @@ -68,6 +68,7 @@ def run(self): def validate_edge_cases(self): item_indices = {item["name"]: index for index, item in enumerate(self.sequence)} + for cfo in self.sequence: if cfo["is start"] and cfo["name"] == "XOR": cfo["is start"] = False diff --git a/tests/test_end_constraints.py b/tests/test_end_constraints.py index 6bdc9ad..8b80d84 100644 --- a/tests/test_end_constraints.py +++ b/tests/test_end_constraints.py @@ -16,6 +16,7 @@ def test_end_constraint_is_generated_when_multiple_endings(): ] assert all(constraint in res for constraint in expected_ending_constraints) + def test_end_constraint_is_generated_with_linear_parser(): res = init_test_setup_for_parser(LINEAR_MERMAID_GRAPH) assert res[-1]["is end"] == True From 0e4bc616b4a68f91b7c76b0d21a5a7b1f5269847 Mon Sep 17 00:00:00 2001 From: MarcusRostSAP Date: Sun, 8 Oct 2023 14:17:37 +0200 Subject: [PATCH 11/15] fixed invisible space --- bpmnconstraints/parser/bpmn_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpmnconstraints/parser/bpmn_parser.py b/bpmnconstraints/parser/bpmn_parser.py index 0834128..b9358c5 100644 --- a/bpmnconstraints/parser/bpmn_parser.py +++ b/bpmnconstraints/parser/bpmn_parser.py @@ -69,7 +69,7 @@ def run(self): def validate_edge_cases(self): item_indices = {item["name"]: index for index, item in enumerate(self.sequence)} - for cfo in self.sequence: + for cfo in self.sequence: if cfo["is start"] and cfo["name"] == "XOR": cfo["is start"] = False for successor in cfo["successor"]: From 265e017c8eba7a09252ca10f2d322a93c5245487 Mon Sep 17 00:00:00 2001 From: MarcusRostSAP Date: Sun, 8 Oct 2023 14:19:20 +0200 Subject: [PATCH 12/15] formatting --- bpmnconstraints/parser/bpmn_parser.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bpmnconstraints/parser/bpmn_parser.py b/bpmnconstraints/parser/bpmn_parser.py index b9358c5..97bcbd1 100644 --- a/bpmnconstraints/parser/bpmn_parser.py +++ b/bpmnconstraints/parser/bpmn_parser.py @@ -68,7 +68,6 @@ def run(self): def validate_edge_cases(self): item_indices = {item["name"]: index for index, item in enumerate(self.sequence)} - for cfo in self.sequence: if cfo["is start"] and cfo["name"] == "XOR": cfo["is start"] = False From 85596bfcddf2dc8f08d91681d7fc981d6581c152 Mon Sep 17 00:00:00 2001 From: MarcusRostSAP Date: Sun, 8 Oct 2023 14:23:00 +0200 Subject: [PATCH 13/15] Removed unnecessary comment --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3d52a70..8138740 100644 --- a/.gitignore +++ b/.gitignore @@ -136,6 +136,5 @@ dmypy.json .vscode/ -# This might be weird, but I think this is where the conf.py should be tutorial/conf.py test.mmd \ No newline at end of file From 259095463f23be4f6c1483ca531c26b1921ae42e Mon Sep 17 00:00:00 2001 From: MarcusRostSAP <146723913+MarcusRostSAP@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:43:45 +0200 Subject: [PATCH 14/15] Update .gitignore Removed some unnecessary igonores --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 8138740..3dc4d04 100644 --- a/.gitignore +++ b/.gitignore @@ -135,6 +135,3 @@ dmypy.json .idea/ .vscode/ - -tutorial/conf.py -test.mmd \ No newline at end of file From 024d8163f9f90ef14441b40f155962500ad1cddd Mon Sep 17 00:00:00 2001 From: MarcusRostSAP <146723913+MarcusRostSAP@users.noreply.github.com> Date: Thu, 12 Oct 2023 14:19:46 +0200 Subject: [PATCH 15/15] Fix pr (#4) * Small changes based on review comments * Linting issue * lint * lint * lint --------- Co-authored-by: MarcusRostSAP --- bpmnconstraints/parser/bpmn_parser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bpmnconstraints/parser/bpmn_parser.py b/bpmnconstraints/parser/bpmn_parser.py index 97bcbd1..a61c6ee 100644 --- a/bpmnconstraints/parser/bpmn_parser.py +++ b/bpmnconstraints/parser/bpmn_parser.py @@ -59,14 +59,18 @@ def run(self): self.__mark_gateway_elements() if self.transitivity: self.__add_transitivity() - self.validate_edge_cases() + self.validate_splitting_and_joining_gateway_cases() return self.sequence except Exception: logging.warning( "\nCould not execute model. Make sure that model is:\n1. Formatted correctly.\n2. File ends with .xml or .json." ) - def validate_edge_cases(self): + def validate_splitting_and_joining_gateway_cases(self): + """Update 'is start' and 'is end' attributes of cfo based on splitting/joining gateways. + Otherwise, the parser interprets the gateways as start/end events instead of the activities. + """ + item_indices = {item["name"]: index for index, item in enumerate(self.sequence)} for cfo in self.sequence: if cfo["is start"] and cfo["name"] == "XOR":