linkml / schema-automator

Automated assistance for the schema development lifecycle
https://linkml.io/schema-automator/
BSD 3-Clause "New" or "Revised" License
33 stars 12 forks source link

Recognize inheritance patterns in json-schema to reconstruct class hierarchies #124

Open cmungall opened 6 months ago

cmungall commented 6 months ago

JSON-Schema does not support inheritance, but some people employ boolean schema composition patterns to achieve analogous representations:

https://json-schema.org/blog/posts/modelling-inheritance

Another pattern is the allOf one employed by ODK: https://github.com/INCATools/ontology-development-kit/blob/master/schema/project-schema.json

It would be useful to be able to reconstruct class hierarchies. This would be optional, as this would be partly heuristic.

This is probably best conceived of as compositional:

  1. schemauto import-json-schema is concern with strict isomorphic conversion
  2. in the linkml core, we have schema transformations to reconstruct.
    • in fact we already support the reverse with logical_model_transformer which will "unwind" hierarchies into boolean schema compositions (which is deterministic, unlike the reverse)