monarch-initiative / biolink-api

API for linked biological knowledge
https://api.monarchinitiative.org/api/
BSD 3-Clause "New" or "Revised" License
63 stars 25 forks source link

Wrong JSON-LD Context ? #204

Open lpalbou opened 5 years ago

lpalbou commented 5 years ago

When using the BioLink API resource ontol/labeler, if I use the following CURIE (ZFIN:ZDB-GENE-000403-1), I get a Server Error.

Looking at local logs, I can then see that BioLink is sending this SPARQL query: SELECT ?label WHERE { <http://zfin.org/ZDB-GENE-000403-1> rdfs:label ?label }

And this returns no result because the URI is incorrect: ontol/labeler has created the URI http://zfin.org/ZDB-GENE-000403-1 instead of http://identifiers.org/zfin/ZDB-GENE-000403-1.

I think the correct link to the JSON-LD Context to be used is (@cmungall confirm ?): https://github.com/prefixcommons/biocontext/blob/master/registry/go_context.jsonld

[EDIT] I have tracked down the call stack and in curie_util.py, the ontology/labeler is asking to get the URI from the default curie maps: default_curie_maps = [read_biocontext('monarch_context'),read_biocontext('obo_context')]

And indeed, monarch_context is different for ZFIN: https://github.com/prefixcommons/biocontext/blob/master/registry/monarch_context.jsonld

Related to: https://github.com/monarch-initiative/dipper/issues/582

cmungall commented 5 years ago

OK, here's what is happening. The codebase is intended to be generic, but makes some default assumptions about which JSON-LD context files to use. Currently the priority order is monarch>go.

I think this should be done on the basis of which triplestore is queried - e.g. for rdf.geneontology.org, go_context should be passed as an argument to expand_uri in ontobio.sparql_ontol_utils.

@deepakunni3 @kshefchek what are your thoughts on best way to weave this in?

cmungall commented 5 years ago

Of course, we should be using the same URIs for as many projects as possible, particularly GO+Monarch. See https://github.com/monarch-initiative/dipper/issues/582

deepakunni3 commented 5 years ago

@cmungall Yes, it would be more apt to have a source specific JSON-LD context. Perhaps we can have this defined in the config.

diatomsRcool commented 5 years ago

Julie asked me to help with this issue. Is it resolved now? Seems like a quick fix would be to change the code so its using the correct JSON-LD context, but from what Chris is saying it sounds like there's a deeper problem to solve and that may be where I can apply my efforts.