Class diagram can be rendered as object diagram textual syntax, and parsed back, without information loss

This commit is contained in:
Joeri Exelmans 2024-10-03 17:01:13 +02:00
parent f45872d3f7
commit 175edb64d9
14 changed files with 505 additions and 249 deletions

View file

@ -16,7 +16,7 @@ def bootstrap_type(type_name: str, python_type: str, scd_root: UUID, model_root:
min_c_node = bottom.create_node(str(min_c_model))
bottom.create_edge(model_root, min_c_node, f"{type_name}.lower_cardinality")
min_c_link = bottom.create_edge(class_node, min_c_node)
bottom.create_edge(model_root, min_c_link, f"{type_name}.lower_cardinality_link")
bottom.create_edge(model_root, min_c_link, f"{type_name}_lower_cardinality")
scd_node, = bottom.read_outgoing_elements(scd_root, "Integer")
scd_link, = bottom.read_outgoing_elements(scd_root, "Class_lower_cardinality")
bottom.create_edge(min_c_node, scd_node, "Morphism")
@ -27,7 +27,7 @@ def bootstrap_type(type_name: str, python_type: str, scd_root: UUID, model_root:
max_c_node = bottom.create_node(str(max_c_model))
bottom.create_edge(model_root, max_c_node, f"{type_name}.upper_cardinality")
max_c_link = bottom.create_edge(class_node, max_c_node)
bottom.create_edge(model_root, max_c_link, f"{type_name}.upper_cardinality_link")
bottom.create_edge(model_root, max_c_link, f"{type_name}_upper_cardinality")
scd_node, = bottom.read_outgoing_elements(scd_root, "Integer")
scd_link, = bottom.read_outgoing_elements(scd_root, "Class_upper_cardinality")
bottom.create_edge(max_c_node, scd_node, "Morphism")
@ -36,7 +36,7 @@ def bootstrap_type(type_name: str, python_type: str, scd_root: UUID, model_root:
constraint_node = bottom.create_node(f"isinstance(read_value(element),{python_type})")
bottom.create_edge(model_root, constraint_node, f"{type_name}.constraint")
constraint_link = bottom.create_edge(class_node, constraint_node)
bottom.create_edge(model_root, constraint_link, f"{type_name}.constraint_link")
bottom.create_edge(model_root, constraint_link, f"{type_name}_constraint")
scd_node, = bottom.read_outgoing_elements(scd_root, "ActionCode")
scd_link, = bottom.read_outgoing_elements(scd_root, "Element_constraint")
bottom.create_edge(constraint_node, scd_node, "Morphism")