From 5cec112cd8e7fa3a517d3dd17870c65bca6ee4d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Fri, 22 Sep 2023 11:44:58 +0200 Subject: [PATCH] ENH: also considere Referenzes of children of given RTs --- src/caoscrawler/identifiable_adapters.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/caoscrawler/identifiable_adapters.py b/src/caoscrawler/identifiable_adapters.py index 776baeae..2211ce89 100644 --- a/src/caoscrawler/identifiable_adapters.py +++ b/src/caoscrawler/identifiable_adapters.py @@ -212,11 +212,17 @@ identifiabel, identifiable and identified record) for a Record. # TODO: similar to the Identifiable class, Registred Identifiable should be a # separate class too if prop.name.lower() == "is_referenced_by": - for rtname in prop.value: - if (id(record) in referencing_entities - and rtname in referencing_entities[id(record)]): - identifiable_backrefs.extend(referencing_entities[id(record)][rtname]) - else: + for givenrt in prop.value: + rt_and_children = [p.name + for p in db.execute_query(f"FIND RECORDTYPE {givenrt}")] + found = False + for rtname in rt_and_children: + if (id(record) in referencing_entities + and rtname in referencing_entities[id(record)]): + identifiable_backrefs.extend( + referencing_entities[id(record)][rtname]) + found = True + if not found: # TODO: is this the appropriate error? raise NotImplementedError( f"The following record is missing an identifying property:" -- GitLab