German-BioImaging / omero-rdf

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

Regarding Omero RDF turtle file. missing linkage of Annotaion. #16

Closed ArghaSarker closed 2 months ago

ArghaSarker commented 3 months ago

issue 1:

i have noticed that, inside Omero-RDF file, not all the nodes are connected. for example, project, dataset, image, pixels. all those nodes are connected. and If I have a annotation for this nodes, the connection triples in "haspart" and "isPartof" missing. while creating a graph visualization out of it, i can see that, it sees it as a separate graph, not connected.

in this graph, the annotations are represented as a different map.

original

this is the same graph, after connecting the map annotation and declaring the relationship with haspart .

after_adding_linkage

joshmoore commented 3 months ago

Hi @ArghaSarker. Thanks for opening the issue! It looks like each of the calls to handler(annotation) like at https://github.com/German-BioImaging/omero-rdf/blob/main/src/omero_rdf/__init__.py#L439C17-L439C36 are going to need emit() calls OR we refactor the emitting of hasPart etc. within the handler __call__ itself.

andrawaag commented 3 months ago

I stumbled on the same issue. I was able to extract the link with the following sparql query.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ome-xml: <http://www.openmicroscopy.org/Schemas/OME/2016-06#>
PREFIX ome: <http://www.openmicroscopy.org/rdf/2016-06/ome_core/>

SELECT ?annotation ?user ?datasetLabel ?datasetLabelAnnotation WHERE {
    VALUES ?user {"<USER>"}
    ?annotation rdf:type ome-xml:MapAnnotation ;
              ome:Map [ome:Key "User" ; ome:Value ?user] .
   ?annotation ome:Map [ome:Key "Dataset" ; ome:Value ?datasetLabelAnnotation] .
   ?dataset ome:Name ?datasetLabel .
    FILTER (?datasetLabelAnnotation = ?datasetLabel)

} LIMIT 10

I was thinking of working around this with a CONSTRUCT query, but I am not sure how many ome:Key I need to consider to get all links to an Annotation