From 33599e307558e16715227db931408c3381ed0d07 Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Tue, 18 Jun 2024 13:51:18 +0200 Subject: [PATCH] Link annotation objects --- src/omero_rdf/__init__.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/omero_rdf/__init__.py b/src/omero_rdf/__init__.py index 7854d22..a207968 100644 --- a/src/omero_rdf/__init__.py +++ b/src/omero_rdf/__init__.py @@ -388,14 +388,16 @@ def descend( handler.emit((pltid, DCTERMS.isPartOf, scrid)) handler.emit((scrid, DCTERMS.hasPart, pltid)) for annotation in scr.listAnnotations(None): - handler(annotation) + annid = handler(annotation) + handler.emit((annid, DCTERMS.isPartOf, scrid)) return scrid elif isinstance(target, Plate): plt = self._lookup(gateway, "Plate", target.id) pltid = handler(plt) for annotation in plt.listAnnotations(None): - handler(annotation) + annid = handler(annotation) + handler.emit((annid, DCTERMS.isPartOf, pltid)) for well in plt.listChildren(): wid = handler(well) # No descend handler.emit((wid, DCTERMS.isPartOf, pltid)) @@ -410,7 +412,8 @@ def descend( prj = self._lookup(gateway, "Project", target.id) prjid = handler(prj) for annotation in prj.listAnnotations(None): - handler(annotation) + annid = handler(annotation) + handler.emit((annid, DCTERMS.isPartOf, prjid)) for ds in prj.listChildren(): dsid = self.descend(gateway, ds._obj, handler) handler.emit((dsid, DCTERMS.isPartOf, prjid)) @@ -421,7 +424,8 @@ def descend( ds = self._lookup(gateway, "Dataset", target.id) dsid = handler(ds) for annotation in ds.listAnnotations(None): - handler(annotation) + annid = handler(annotation) + handler.emit((annid, DCTERMS.isPartOf, dsid)) for img in ds.listChildren(): imgid = self.descend(gateway, img._obj, handler) handler.emit((imgid, DCTERMS.isPartOf, dsid)) @@ -436,7 +440,8 @@ def descend( handler.emit((imgid, DCTERMS.hasPart, pixid)) for annotation in img.listAnnotations(None): img._loadAnnotationLinks() - handler(annotation) + annid = handler(annotation) + handler.emit((annid, DCTERMS.isPartOf, imgid)) for roi in self._get_rois(gateway, img): handler(roi) return imgid