def update(self, request: Node) -> Optional[Node]: if self._ontology.__contains__(request.get_type( )) and request.get_id() >= 0: # The class of Node is in ontology return self.update_node(request) print(f"No such type in ontology: the {request.get_type()} is missing" ) # Error return None
def retrieve(self, request: Node = None, node_id: int = None) -> Optional[List[Node]]: if node_id is not None and node_id >= 0: return self.get_node_by_id(node_id) else: if request is not None and self._ontology.__contains__( request.get_type()): # The class of Node is in ontology return self.get_node(request) print(f"No such type in ontology: the {request.get_type()} is missing" ) # Error return None