From 3eb3cb96485198fa9790cf0a9ffc828e82bc108c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Fri, 24 May 2024 11:53:33 +0200 Subject: [PATCH] maint rename" --- src/caoscrawler/identifiable_adapters.py | 4 +++- src/caoscrawler/sync_graph.py | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/caoscrawler/identifiable_adapters.py b/src/caoscrawler/identifiable_adapters.py index 89d93847..75de1a32 100644 --- a/src/caoscrawler/identifiable_adapters.py +++ b/src/caoscrawler/identifiable_adapters.py @@ -148,7 +148,7 @@ identifiabel, identifiable and identified record) for a Record. query_string = query_string[:-len(" AND ")] return query_string - def check_identifying_props(self, node, raise_exception=True): + def check_identifying_props(self, node: SyncNode, raise_exception: bool = True): """checks whether all identifying properties exist and raises an error if that's not the case. It furthermore raises an error if "name" is part of the identifiable, but the node does not have a name. @@ -180,6 +180,8 @@ identifiabel, identifiable and identified record) for a Record. else: continue + # multiple occurances are ok here. We deal with that when actually creating an + # identifiable (IDs of referenced Entities might need to get resolved first). if (len([el for el in node.properties if el.name.lower() == prop.name.lower()]) == 0): if raise_exception: i = MissingIdentifyingProperty(f"The property {prop.name} is missing.") diff --git a/src/caoscrawler/sync_graph.py b/src/caoscrawler/sync_graph.py index 738b0773..418baa54 100644 --- a/src/caoscrawler/sync_graph.py +++ b/src/caoscrawler/sync_graph.py @@ -162,7 +162,7 @@ class SyncGraph(): # Thus, it must be possible to create an # identifiable which is checked using the following function: for node in self.unchecked: - self.identifiableAdapter.check_identifying_props(node) + self.identifiableAdapter.all_identifying_properties_exist(node) def set_id_of_node(self, node: SyncNode, node_id: Optional[str] = None): """sets the ID attribute of the given SyncNode to node_id. @@ -304,7 +304,7 @@ class SyncGraph(): if no identifiable is given, the identifiable is retrieved from the identifiable adapter """ if identifiable is None: - self.identifiableAdapter.check_identifying_props(node) + self.identifiableAdapter.all_identifying_properties_exist(node) identifiable = self.identifiableAdapter.get_identifiable( node, self.backward_id_referenced_by[id(node)]) node.identifiable = identifiable @@ -570,7 +570,8 @@ class SyncGraph(): Last review by Alexander Schlemmer on 2024-05-24. """ return (node.identifiable is None and not self._identity_relies_on_unchecked_entity(node) - and self.identifiableAdapter.check_identifying_props(node, raise_exception=False)) + and self.identifiableAdapter.all_identifying_properties_exist( + node, raise_exception=False)) def _initialize_nodes(self, entities: list[db.Entity]): """ create initial set of SyncNodes from provided Entity list""" -- GitLab