FWIW, we used JanusGraph in the early days of Uber's Risk & Safety knowledge graph, and there was a schema migration utility I wrote and briefly
described in a Graph Day talk. Open-sourcing the code may be more trouble than it is worth, but you might consider following a similar approach:
- Define schemas in a high-level language. We used the simple schema language described in the slide show, with a YAML-based serialization format. This was a precursor to the Dragon language I've mentioned a few times on this list.
- Compute diffs between adjacent versions of a schema. A diff is an ordered list of basic changes with types like the ones here.
- Translate diffs into calls to JanusGraph's schema API. Our tool mapped basic changes into instances of classes like AddPropertyKey, AddEdgeIndex, etc. which encapsulated the JG calls appropriate to each change.
Initialization of a new database is the same as applying a diff between the empty schema and the first version of the schema you intend to use to constrain your data. When you are ready to advance the graph to version 2 of your schema, apply the version1-version2 diff. Note that only backward-compatible changes can be (safely) made in this way.
Josh