German-BioImaging / omero-rdf

A plugin for exporting RDF from OMERO
GNU General Public License v2.0
4 stars 5 forks source link

Only dataset URLs are being fetched and none image's #14

Closed marimeireles closed 1 month ago

marimeireles commented 1 month ago

While converting our OMERO data from the JSON endpoint I've noticed some (or all? I'm not certain) datasets get triples with real URL addresses, though images only have their URIs fetched.

We're building an integration with sparnatural and would like the users be able to click the results of a search in order to see the images that the search returned.

There are many ways of manipulating the URI results in order to have the URL shown in the UI for the user, however, I thought this might be a common problem that other people might run in to and decided to open the issue here.

I'm looking at this part of the code:

        elif isinstance(target, Dataset):
            ds = self._lookup(gateway, "Dataset", target.id)
            dsid = handler(ds)
            for annotation in ds.listAnnotations(None):
                handler(annotation)
            for img in ds.listChildren():
                imgid = self.descend(gateway, img._obj, handler)
                handler.emit((imgid, DCTERMS.isPartOf, dsid))
                handler.emit((dsid, DCTERMS.hasPart, imgid))
            return dsid

        elif isinstance(target, Image):
            img = self._lookup(gateway, "Image", target.id)
            imgid = handler(img)
            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)
            for roi in self._get_rois(gateway, img):
                handler(roi)
            return imgid

Is this the right spot if I'd like to change so images also fetch the URL besides the URI? I'm not entirely sure how the datasets are obtaining URLs anyway. This seems to be just a coincidence?

Any pointers would be appreciated, I'll try to tackle this in the following days. If you're interested let me know and I'm happy to contribute it upstream!

joshmoore commented 1 month ago

Hi @marimeireles, I'm not completely following. Can you share the RDF that you are seeing and how you would like to see it changed?

marimeireles commented 1 month ago

Sorry for the delay on the response Josh. What I wanted here was to fetch the URLs of images I'm downloading from the JSON endpoint. However, I've inspected my endpoint and they simply do not exist. Only URIs. So, I'll get around it by writing a script that adds URL triples to my data... So my images can have real links connected to them. I'm sure this is a common feature desired by people using this kind of data, however, I'm not sure if it makes sure to include it in the omero-rdf package. Thank you, I guess I'll close the issue as not relevant to the project?

joshmoore commented 4 weeks ago

I think I see what you mean. Pretty sure @andrawaag is doing similar with his construct statements. Maybe something like https://schema.org/image or https://schema.org/thumbnailUrl ?