From 8ddb5ac12be8f88833504c6848fa6524ac18133e Mon Sep 17 00:00:00 2001 From: Andrei Bondarenko Date: Sat, 21 Aug 2021 11:57:20 +0200 Subject: [PATCH] PN example --- bootstrap/scd.py | 1 - services/scd.py | 35 ++++++++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/bootstrap/scd.py b/bootstrap/scd.py index f16af18..19e6c59 100644 --- a/bootstrap/scd.py +++ b/bootstrap/scd.py @@ -246,7 +246,6 @@ def bootstrap_scd(state: State) -> UUID: add_mcl_morphism("Association_target_lower_cardinality.optional", "Boolean") add_mcl_morphism("Association_target_upper_cardinality.optional", "Boolean") - return mcl_root diff --git a/services/scd.py b/services/scd.py index 17ee5aa..15a5290 100644 --- a/services/scd.py +++ b/services/scd.py @@ -187,15 +187,32 @@ if __name__ == '__main__': s = State() from bootstrap.scd import bootstrap_scd scd = bootstrap_scd(s) + # Retrieve refs to primitive type models + # # integer int_type_id = s.read_dict(s.read_root(), "Integer") int_type = UUID(s.read_value(int_type_id)) - service = SCD(scd, s.create_node(), s) - service.create_class("Place") - service.create_class("Transition") - service.create_association("P2T", "Place", "Transition") - service.create_association("T2P", "Transition", "Place") + print(f"Integer Model UUID: {int_type}") # 6 + # # string + str_type_id = s.read_dict(s.read_root(), "String") + str_type = UUID(s.read_value(str_type_id)) + print(f"String Model UUID: {str_type}") # 16 + # Create LTM_PN + model_uuid = s.create_node() + print(f"LTM_PN Model UUID: {model_uuid}") # 845 + service = SCD(scd, model_uuid, s) + # Create classes + service.create_class("P") + service.create_class("T") + # Create associations + service.create_association("P2T", "P", "T") + service.create_association("T2P", "T", "P") + # Create model refs service.create_model_ref("Integer", int_type) - service.create_attribute_link("Place", "Integer", "tokens", False) - service.create_attribute_link("P2T", "Integer", "weight", False) - service.create_attribute_link("T2P", "Integer", "weight", False) - service.list_elements() + service.create_model_ref("String", int_type) + # Create class attributes + service.create_attribute_link("P", "Integer", "t", False) + service.create_attribute_link("P", "String", "n", False) + service.create_attribute_link("T", "String", "n", False) + # Create association attributes + service.create_attribute_link("P2T", "Integer", "w", False) + service.create_attribute_link("T2P", "Integer", "w", False)