obographs icon indicating copy to clipboard operation
obographs copied to clipboard

Implement ID/CURIE<->URI expansion and contraction

Open cmungall opened this issue 8 years ago • 5 comments

We want to be able to expand and contract URIs using either a simple yaml curie map or a JSON-LD file. The latter provides certain advantages such as being a standard, and also allow recursive application of rules.

Doing this using a yaml map should be very easy. However, we end up implementing this code multiple times, it might be worth abstracting this into a separate java library. This could live in the org.prefixcommons space. Having a common library might be useful in other ways - e.g. centralization of validation etc.

These are some places where this is already implemented:

  • Phenopackets
    • https://github.com/phenopackets/phenopacket-reference-implementation/issues/9 implemented by @balhoff
  • ROBOT
    • https://github.com/ontodev/robot/issues/9 implemented by @jamesaoverton
  • SciGraph
    • See https://github.com/SciGraph/SciGraph/blob/master/SciGraph-core/src/main/java/io/scigraph/owlapi/curies/CurieUtil.java by @jnguyenx
  • Minerva
    • See https://github.com/geneontology/minerva/issues/49 cc @kltm
  • owlsim-v3
    • TODO https://github.com/monarch-initiative/owlsim-v3/issues/24

cmungall avatar Nov 22 '16 01:11 cmungall

@cmungall anything missing from the interface specified here?

https://github.com/phenopackets/phenopacket-reference-implementation/blob/master/src/main/java/org/phenopackets/api/util/ContextUtil.java

One thing I see is maybe passing a collection of identifiers to expand all at once, getting back a Map with the results.

Any thoughts on the type vs. value nuances for expansion? (e.g. https://github.com/monarch-initiative/owlsim-v3/issues/24#issuecomment-252710979) Enforcing that distinction is where my code deviates somewhat from ROBOT.

I think it would be easy to add a function for creating a JSON-LD context from a simple YAML prefix map.

balhoff avatar Nov 28 '16 20:11 balhoff

For the general purpose module @jguyenx is writing we'd want to avoid all the JSON-LD edge cases and have a straightforward transform that is independent of where we are in the document.

I think your code is a good starting point, we may be able to reuse it directly

cmungall avatar Nov 28 '16 21:11 cmungall

Here's my first draft: https://github.com/prefixcommons/curie-util

Let me know what you think.

jnguyenx avatar Dec 06 '16 22:12 jnguyenx

@cmungall @balhoff @kltm @kshefchek

jnguyenx avatar Dec 10 '16 01:12 jnguyenx

Pushed to Maven Central: http://search.maven.org/#artifactdetails%7Corg.prefixcommons%7Ccurie-util%7C0.0.1%7Cjar

jnguyenx avatar Dec 14 '16 19:12 jnguyenx