Browse Source

REfctored name

Andrei Bondarenko 4 years ago
parent
commit
938752ffe4

+ 7 - 7
bootstrap/primitive.py

@@ -7,15 +7,15 @@ def bootstrap_type(type_name: str, python_type: str, scd_root: UUID, model_root:
     # create class
     class_node = bottom.create_node()  # create class node
     bottom.create_edge(model_root, class_node, type_name)  # attach to model
-    scd_node, = bottom.read_outgoing_nodes(scd_root, "Class")  # retrieve type
+    scd_node, = bottom.read_outgoing_elements(scd_root, "Class")  # retrieve type
     bottom.create_edge(class_node, scd_node, "Morphism")  # create morphism link
     # set min_cardinality
     min_c_node = bottom.create_node(1)
     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")
-    scd_node, = bottom.read_outgoing_nodes(scd_root, "Integer")
-    scd_link, = bottom.read_outgoing_nodes(scd_root, "Class_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")
     bottom.create_edge(min_c_link, scd_link, "Morphism")
     # set max_cardinality
@@ -23,8 +23,8 @@ def bootstrap_type(type_name: str, python_type: str, scd_root: UUID, model_root:
     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")
-    scd_node, = bottom.read_outgoing_nodes(scd_root, "Integer")
-    scd_link, = bottom.read_outgoing_nodes(scd_root, "Class_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")
     bottom.create_edge(max_c_link, scd_link, "Morphism")
     # set constraint
@@ -32,8 +32,8 @@ def bootstrap_type(type_name: str, python_type: str, scd_root: UUID, model_root:
     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")
-    scd_node, = bottom.read_outgoing_nodes(scd_root, "ActionCode")
-    scd_link, = bottom.read_outgoing_nodes(scd_root, "Element_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")
     bottom.create_edge(constraint_link, scd_link, "Morphism")
     

+ 2 - 2
services/bottom/V0.py

@@ -64,14 +64,14 @@ class Bottom:
             edges = [e for e in edges if read_label(e) == label]
         return edges
 
-    def read_incoming_nodes(self, target: UUID, label=None) -> List[UUID]:
+    def read_incoming_elements(self, target: UUID, label=None) -> List[UUID]:
         edges = self.read_incoming_edges(target, label)
         if edges is None or len(edges) == 0:
             return []
         else:
             return [self.read_edge_source(e) for e in edges]
 
-    def read_outgoing_nodes(self, source: UUID, label=None) -> List[UUID]:
+    def read_outgoing_elements(self, source: UUID, label=None) -> List[UUID]:
         edges = self.read_outgoing_edges(source, label)
         if edges is None or len(edges) == 0:
             return []

+ 3 - 3
services/primitives/boolean_type.py

@@ -7,13 +7,13 @@ class Boolean:
     def __init__(self, model: UUID, state: State):
         self.model = model
         self.bottom = Bottom(state)
-        type_model_id_node, = self.bottom.read_outgoing_nodes(state.read_root(), "Boolean")
+        type_model_id_node, = self.bottom.read_outgoing_elements(state.read_root(), "Boolean")
         self.type_model = UUID(self.bottom.read_value(type_model_id_node))
 
     def create(self, value: bool):
         if "boolean" in self.bottom.read_keys(self.model):
-            instance, = self.bottom.read_outgoing_nodes(self.model, "boolean")
+            instance, = self.bottom.read_outgoing_elements(self.model, "boolean")
             self.bottom.delete_element(instance)
         _instance = self.bottom.create_edge(self.model, self.bottom.create_node(value), "boolean")
-        _type, = self.bottom.read_outgoing_nodes(self.type_model, "Boolean")
+        _type, = self.bottom.read_outgoing_elements(self.type_model, "Boolean")
         self.bottom.create_edge(_instance, _type, "Morphism")

+ 3 - 3
services/primitives/float_type.py

@@ -7,13 +7,13 @@ class Float:
     def __init__(self, model: UUID, state: State):
         self.model = model
         self.bottom = Bottom(state)
-        type_model_id_node, = self.bottom.read_outgoing_nodes(state.read_root(), "Float")
+        type_model_id_node, = self.bottom.read_outgoing_elements(state.read_root(), "Float")
         self.type_model = UUID(self.bottom.read_value(type_model_id_node))
 
     def create(self, value: float):
         if "float" in self.bottom.read_keys(self.model):
-            instance, = self.bottom.read_outgoing_nodes(self.model, "float")
+            instance, = self.bottom.read_outgoing_elements(self.model, "float")
             self.bottom.delete_element(instance)
         _instance = self.bottom.create_edge(self.model, self.bottom.create_node(value), "float")
-        _type, = self.bottom.read_outgoing_nodes(self.type_model, "Float")
+        _type, = self.bottom.read_outgoing_elements(self.type_model, "Float")
         self.bottom.create_edge(_instance, _type, "Morphism")

+ 3 - 3
services/primitives/integer_type.py

@@ -7,13 +7,13 @@ class Integer:
     def __init__(self, model: UUID, state: State):
         self.model = model
         self.bottom = Bottom(state)
-        type_model_id_node, = self.bottom.read_outgoing_nodes(state.read_root(), "Integer")
+        type_model_id_node, = self.bottom.read_outgoing_elements(state.read_root(), "Integer")
         self.type_model = UUID(self.bottom.read_value(type_model_id_node))
 
     def create(self, value: int):
         if "string" in self.bottom.read_keys(self.model):
-            instance, = self.bottom.read_outgoing_nodes(self.model, "integer")
+            instance, = self.bottom.read_outgoing_elements(self.model, "integer")
             self.bottom.delete_element(instance)
         _instance = self.bottom.create_edge(self.model, self.bottom.create_node(value), "integer")
-        _type, = self.bottom.read_outgoing_nodes(self.type_model, "Integer")
+        _type, = self.bottom.read_outgoing_elements(self.type_model, "Integer")
         self.bottom.create_edge(_instance, _type, "Morphism")

+ 3 - 3
services/primitives/string_type.py

@@ -7,13 +7,13 @@ class String:
     def __init__(self, model: UUID, state: State):
         self.model = model
         self.bottom = Bottom(state)
-        type_model_id_node, = self.bottom.read_outgoing_nodes(state.read_root(), "String")
+        type_model_id_node, = self.bottom.read_outgoing_elements(state.read_root(), "String")
         self.type_model = UUID(self.bottom.read_value(type_model_id_node))
 
     def create(self, value: str):
         if "string" in self.bottom.read_keys(self.model):
-            instance, = self.bottom.read_outgoing_nodes(self.model, "string")
+            instance, = self.bottom.read_outgoing_elements(self.model, "string")
             self.bottom.delete_element(instance)
         _instance = self.bottom.create_edge(self.model, self.bottom.create_node(value), "string")
-        _type, = self.bottom.read_outgoing_nodes(self.type_model, "String")
+        _type, = self.bottom.read_outgoing_elements(self.type_model, "String")
         self.bottom.create_edge(_instance, _type, "Morphism")

+ 3 - 3
services/primitives/type_type.py

@@ -7,13 +7,13 @@ class Integer:
     def __init__(self, model: UUID, state: State):
         self.model = model
         self.bottom = Bottom(state)
-        type_model_id_node, = self.bottom.read_outgoing_nodes(state.read_root(), "Type")
+        type_model_id_node, = self.bottom.read_outgoing_elements(state.read_root(), "Type")
         self.type_model = UUID(self.bottom.read_value(type_model_id_node))
 
     def create(self, value: tuple):
         if "string" in self.bottom.read_keys(self.model):
-            instance, = self.bottom.read_outgoing_nodes(self.model, "type")
+            instance, = self.bottom.read_outgoing_elements(self.model, "type")
             self.bottom.delete_element(instance)
         _instance = self.bottom.create_edge(self.model, self.bottom.create_node(value), "type")
-        _type, = self.bottom.read_outgoing_nodes(self.type_model, "Type")
+        _type, = self.bottom.read_outgoing_elements(self.type_model, "Type")
         self.bottom.create_edge(_instance, _type, "Morphism")