geneontology / obographs

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

Check round-trip JSON <-> Object model is possible #52

Closed julesjacobsen closed 4 years ago

julesjacobsen commented 5 years ago

Attempting to read a JSON ontology with Jackson like so:

ObjectMapper objectMapper = new ObjectMapper();
GraphDocument graphDocument = objectMapper.readValue(Files.newInputStream(Paths.get("src/test/resources/hp.json")), GraphDocument.class);

results in:

com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of org.geneontology.obographs.model.GraphDocument: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)
 at [Source: sun.nio.ch.ChannelInputStream@471a9022; line: 2, column: 3]

This is likely due to model missing '@JsonDeserialize(builder = Node.Builder.class)' annotations.

julesjacobsen commented 4 years ago

@cmungall @balhoff @dosumis - I've added what I think are all the missing annotations allowing people to read the json documents back into memory from disk. Do you have any way of testing this is complete?