From 938752ffe44a8e363d988ecedbdb23b3ab6d8be0 Mon Sep 17 00:00:00 2001 From: Andrei Bondarenko Date: Mon, 16 Aug 2021 09:53:45 +0200 Subject: [PATCH] REfctored name --- bootstrap/primitive.py | 14 +++++++------- services/bottom/V0.py | 4 ++-- services/primitives/boolean_type.py | 6 +++--- services/primitives/float_type.py | 6 +++--- services/primitives/integer_type.py | 6 +++--- services/primitives/string_type.py | 6 +++--- services/primitives/type_type.py | 6 +++--- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/bootstrap/primitive.py b/bootstrap/primitive.py index bf286d4..5500b6c 100644 --- a/bootstrap/primitive.py +++ b/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") diff --git a/services/bottom/V0.py b/services/bottom/V0.py index 52c4ec3..cfa32eb 100644 --- a/services/bottom/V0.py +++ b/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 [] diff --git a/services/primitives/boolean_type.py b/services/primitives/boolean_type.py index 52826a6..9ab1852 100644 --- a/services/primitives/boolean_type.py +++ b/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") diff --git a/services/primitives/float_type.py b/services/primitives/float_type.py index 28e223d..3d92a20 100644 --- a/services/primitives/float_type.py +++ b/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") diff --git a/services/primitives/integer_type.py b/services/primitives/integer_type.py index add224a..87ebd7d 100644 --- a/services/primitives/integer_type.py +++ b/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") diff --git a/services/primitives/string_type.py b/services/primitives/string_type.py index c95518a..e1a5a87 100644 --- a/services/primitives/string_type.py +++ b/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") diff --git a/services/primitives/type_type.py b/services/primitives/type_type.py index bdb8a1d..e7031c2 100644 --- a/services/primitives/type_type.py +++ b/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")