RAMification + pattern matching: put typing information straight into the Vertices, as a Python attribute (don't put it in separate Vertices+Edges).

This commit is contained in:
Joeri Exelmans 2024-09-10 13:18:14 +02:00
parent 700a4d103f
commit ae5eaedb4b
8 changed files with 284 additions and 129 deletions

View file

@ -11,6 +11,7 @@ class Integer:
self.type_model = UUID(self.bottom.read_value(type_model_id_node))
def create(self, value: int):
# delete existing integer, if there is one
if "string" in self.bottom.read_keys(self.model):
instance, = self.bottom.read_outgoing_elements(self.model, "integer")
self.bottom.delete_element(instance)
@ -18,3 +19,7 @@ class Integer:
self.bottom.create_edge(self.model, _instance, "integer")
_type, = self.bottom.read_outgoing_elements(self.type_model, "Integer")
self.bottom.create_edge(_instance, _type, "Morphism")
def read(self):
instance, = self.bottom.read_outgoing_elements(self.model, "integer")
return self.bottom.read_value(instance)