ncbo / ontologies_api

Hypermedia API for NCBO's ontology-related projects
http://data.bioontology.org
Other
25 stars 10 forks source link

Broken `links` in objects returned by mappings endpoint #85

Closed pkalita-lbl closed 2 years ago

pkalita-lbl commented 2 years ago

I'm attempting to start from the mappings of one class and explore the mappings of each of the mapped classes. Using the links field seems like the natural solution. But sometimes those links don't resolve correctly. For example, if I start with: https://data.bioontology.org/ontologies/FMA/classes/http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7202/mappings?display_context=false, one of the results is:

    {
        "id": null,
        "source": "LOOM",
        "classes": [
            {
                "@id": "http://purl.org/sig/ont/fma/fma7202",
                "@type": "http://www.w3.org/2002/07/owl#Class",
                "links": {
                    "self": "https://data.bioontology.org/ontologies/FMA/classes/http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7202",
                    "ontology": "https://data.bioontology.org/ontologies/FMA",
                    "children": "https://data.bioontology.org/ontologies/FMA/classes/http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7202/children",
                    "parents": "https://data.bioontology.org/ontologies/FMA/classes/http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7202/parents",
                    "descendants": "https://data.bioontology.org/ontologies/FMA/classes/http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7202/descendants",
                    "ancestors": "https://data.bioontology.org/ontologies/FMA/classes/http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7202/ancestors",
                    "instances": "https://data.bioontology.org/ontologies/FMA/classes/http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7202/instances",
                    "tree": "https://data.bioontology.org/ontologies/FMA/classes/http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7202/tree",
                    "notes": "https://data.bioontology.org/ontologies/FMA/classes/http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7202/notes",
                    "mappings": "https://data.bioontology.org/ontologies/FMA/classes/http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7202/mappings",
                    "ui": "http://bioportal.bioontology.org/ontologies/FMA?p=classes&conceptid=http%3A%2F%2Fpurl.org%2Fsig%2Font%2Ffma%2Ffma7202"
                }
            },
            {
                "@id": "http://purl.obolibrary.org/obo/NCIT_C12377",
                "@type": "http://www.w3.org/2002/07/owl#Class",
                "links": {
                    "self": "https://data.bioontology.org/ontologies/MS/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FNCIT_C12377",
                    "ontology": "https://data.bioontology.org/ontologies/MS",
                    "children": "https://data.bioontology.org/ontologies/MS/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FNCIT_C12377/children",
                    "parents": "https://data.bioontology.org/ontologies/MS/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FNCIT_C12377/parents",
                    "descendants": "https://data.bioontology.org/ontologies/MS/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FNCIT_C12377/descendants",
                    "ancestors": "https://data.bioontology.org/ontologies/MS/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FNCIT_C12377/ancestors",
                    "instances": "https://data.bioontology.org/ontologies/MS/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FNCIT_C12377/instances",
                    "tree": "https://data.bioontology.org/ontologies/MS/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FNCIT_C12377/tree",
                    "notes": "https://data.bioontology.org/ontologies/MS/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FNCIT_C12377/notes",
                    "mappings": "https://data.bioontology.org/ontologies/MS/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FNCIT_C12377/mappings",
                    "ui": "http://bioportal.bioontology.org/ontologies/MS?p=classes&conceptid=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FNCIT_C12377"
                }
            }
        ],
        "process": null,
        "@id": "",
        "@type": "http://data.bioontology.org/metadata/Mapping"
    },

Looking at classes[1].links.mappings I see https://data.bioontology.org/ontologies/MS/classes/http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FNCIT_C12377/mappings. But when I request that endpoint, the response is:

{
    "errors": [
        "Class with id `http://purl.obolibrary.org/obo/NCIT_C12377` not found in ontology"
    ],
    "status": 404
}
mdorf commented 2 years ago

This is yet another unfortunate side effect of the behavior documented in ncbo/ontologies_linked_data#117. It happens due to the fact that for performance reasons, the mapping code does not filter out previous submissions of the same ontology. This results in duplicate or orphan (in this case) mappings. Please see the ticket above for a more detailed description.

I've added a notation to the original ticket to references this issue. @pkalita-lbl , please use ncbo/ontologies_linked_data#117 for any additional communication regarding this behavior, so we can track it in one place.

We are not able to fix it at present. Work is underway to migrate BioPortal from 4store triple-store backend to a more performant AllegroGraph system. Once the migration is complete, we can re-visit ncbo/ontologies_linked_data#117.

pkalita-lbl commented 2 years ago

Apologies for the noise! I didn't make the connection that this was a side effect of https://github.com/ncbo/ontologies_linked_data/issues/117. Thank you for clarifying.

mdorf commented 2 years ago

Apologies for the noise! I didn't make the connection that this was a side effect of ncbo/ontologies_linked_data#117. Thank you for clarifying.

Not at all! You've brought up yet another side effect of this problem that had not been documented. This is of great help!