Skip to content

Commit 42cac03

Browse files
authored
Merge pull request #17 from joshmoore/issue-16
Link annotation objects
2 parents 0f7568e + 33599e3 commit 42cac03

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/omero_rdf/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,16 @@ def descend(
388388
handler.emit((pltid, DCTERMS.isPartOf, scrid))
389389
handler.emit((scrid, DCTERMS.hasPart, pltid))
390390
for annotation in scr.listAnnotations(None):
391-
handler(annotation)
391+
annid = handler(annotation)
392+
handler.emit((annid, DCTERMS.isPartOf, scrid))
392393
return scrid
393394

394395
elif isinstance(target, Plate):
395396
plt = self._lookup(gateway, "Plate", target.id)
396397
pltid = handler(plt)
397398
for annotation in plt.listAnnotations(None):
398-
handler(annotation)
399+
annid = handler(annotation)
400+
handler.emit((annid, DCTERMS.isPartOf, pltid))
399401
for well in plt.listChildren():
400402
wid = handler(well) # No descend
401403
handler.emit((wid, DCTERMS.isPartOf, pltid))
@@ -410,7 +412,8 @@ def descend(
410412
prj = self._lookup(gateway, "Project", target.id)
411413
prjid = handler(prj)
412414
for annotation in prj.listAnnotations(None):
413-
handler(annotation)
415+
annid = handler(annotation)
416+
handler.emit((annid, DCTERMS.isPartOf, prjid))
414417
for ds in prj.listChildren():
415418
dsid = self.descend(gateway, ds._obj, handler)
416419
handler.emit((dsid, DCTERMS.isPartOf, prjid))
@@ -421,7 +424,8 @@ def descend(
421424
ds = self._lookup(gateway, "Dataset", target.id)
422425
dsid = handler(ds)
423426
for annotation in ds.listAnnotations(None):
424-
handler(annotation)
427+
annid = handler(annotation)
428+
handler.emit((annid, DCTERMS.isPartOf, dsid))
425429
for img in ds.listChildren():
426430
imgid = self.descend(gateway, img._obj, handler)
427431
handler.emit((imgid, DCTERMS.isPartOf, dsid))
@@ -436,7 +440,8 @@ def descend(
436440
handler.emit((imgid, DCTERMS.hasPart, pixid))
437441
for annotation in img.listAnnotations(None):
438442
img._loadAnnotationLinks()
439-
handler(annotation)
443+
annid = handler(annotation)
444+
handler.emit((annid, DCTERMS.isPartOf, imgid))
440445
for roi in self._get_rois(gateway, img):
441446
handler(roi)
442447
return imgid

0 commit comments

Comments
 (0)