From cc957f15123117d0d5bc0cbf43d78cbea4c8f668 Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Wed, 13 Mar 2024 16:54:05 +0100 Subject: [PATCH] Fix pixels containment and add hasPart --- src/omero_rdf/__init__.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/omero_rdf/__init__.py b/src/omero_rdf/__init__.py index c34de7a..7854d22 100644 --- a/src/omero_rdf/__init__.py +++ b/src/omero_rdf/__init__.py @@ -386,6 +386,7 @@ def descend( for plate in scr.listChildren(): pltid = self.descend(gateway, plate._obj, handler) handler.emit((pltid, DCTERMS.isPartOf, scrid)) + handler.emit((scrid, DCTERMS.hasPart, pltid)) for annotation in scr.listAnnotations(None): handler(annotation) return scrid @@ -400,9 +401,9 @@ def descend( handler.emit((wid, DCTERMS.isPartOf, pltid)) for idx in range(0, well.countWellSample()): img = well.getImage(idx) - imgid = handler(img.getPrimaryPixels()) - handler(img) # No descend + imgid = self.descend(gateway, img._obj, handler) handler.emit((imgid, DCTERMS.isPartOf, wid)) + handler.emit((wid, DCTERMS.hasPart, imgid)) return pltid elif isinstance(target, Project): @@ -413,6 +414,7 @@ def descend( for ds in prj.listChildren(): dsid = self.descend(gateway, ds._obj, handler) handler.emit((dsid, DCTERMS.isPartOf, prjid)) + handler.emit((prjid, DCTERMS.hasPart, dsid)) return prjid elif isinstance(target, Dataset): @@ -421,17 +423,17 @@ def descend( for annotation in ds.listAnnotations(None): handler(annotation) for img in ds.listChildren(): - imgid = handler(img) # No descend + imgid = self.descend(gateway, img._obj, handler) handler.emit((imgid, DCTERMS.isPartOf, dsid)) - handler(img.getPrimaryPixels()) - for annotation in img.listAnnotations(None): - handler(annotation) + handler.emit((dsid, DCTERMS.hasPart, imgid)) return dsid elif isinstance(target, Image): img = self._lookup(gateway, "Image", target.id) imgid = handler(img) - handler(img.getPrimaryPixels()) + pixid = handler(img.getPrimaryPixels()) + handler.emit((pixid, DCTERMS.isPartOf, imgid)) + handler.emit((imgid, DCTERMS.hasPart, pixid)) for annotation in img.listAnnotations(None): img._loadAnnotationLinks() handler(annotation) @@ -440,7 +442,7 @@ def descend( return imgid else: - self.ctx.die(111, "TBD: %s" % target.__class__.__name__) + self.ctx.die(111, "unknown target: %s" % target.__class__.__name__) def _get_rois(self, gateway, img): params = ParametersI()