geneontology / obographs

Basic and Advanced OBO Graphs: specification and reference implementation
63 stars 12 forks source link

Implement ID/CURIE<->URI expansion and contraction #14

Open cmungall opened 7 years ago

cmungall commented 7 years ago

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:

balhoff commented 7 years ago

@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.

cmungall commented 7 years ago

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

jnguyenx commented 7 years ago

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

Let me know what you think.

jnguyenx commented 7 years ago

@cmungall @balhoff @kltm @kshefchek

jnguyenx commented 7 years ago

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