[DISCUSS] Finalizing the look and feel of Schema Management APIs from JanusGraph clients(Py/.NET/JS)


Debasish Kanhar <d.k...@...>
 

Per my understanding, TinkerPop expects all GLVs across all variants to be aligned as much as possible. But since the same holds true for TinkerPop, doesn't mean it has to hold true for JanusGraph clients too. We can try to align as much as possible, but having a 100% match is always going to be difficult.

This post is to try to reach a common point regarding the same, so that we can have a standard framework when Florian adds the same feature to his .NET lib or else if someone like Chris adds it to JS lib.

Before we start discussion how the current APIs are build, and if modifications are needed, let me give everyone a background.

Based on DISCUSS THREAD it looks more or less like we are going to start with Client version as 0.1.0
PR#4 is in final stages of review for Python clients.
PR#1 addresses addition of .Net drivers.

Once those are released, the above mentioned PRs, the following generic features will still be missing:
  1. Geopredicates for .NET
  2. GeoShapes beyond Point and Circle.
  3. Schema management.
This post is regarding how we should develop our APIs for Schema management.I've a branch under my personal repository where I've developed those APIs for Schema management. You can also follow issues on that repo if needed. The APIs are developed, and arent unittested yet, so unit testing will follow once we have finalized the API structure.

As part of next major release, the following APIs have been developed:

Connect to JanusGraph running & creating management and traversal objects on it like in Java.

graph = JanusGraph().connect(url="13.71.86.240", port="8182", bindings="g", graph="graph")
management = graph.openManagement()
g = graph.traversal()

Add Property Keys:
nameBuilder = management.propertyKeyBuilder()
name = nameBuilder.makePropertyKey("name").dataType("String").make()

Build Composite Index:
nameIndexBuilder = management.buildCompositeIndex("name", "Vertex")
nameIdx = nameIndexBuilder.addKey("name").unique().make()

Build Mixed Index:
ageBuilder = management.propertyKeyBuilder()
age = ageBuilder.makePropertyKey("age").dataType("Integer").make()

ageIdxBuilder = management.buildMixedIndex("vertices", "Vertex")
ageIdx = ageIdxBuilder.addKey("age").make("search")

Build Edge Label:
battled = management.edgeLabelBuilder().makeEdgeLabel("battled").signature("time").make()

Build Vertex centric index (Expects that the property key time is already added using PropertyKeyBuilder API and EdgeLabel is created using EdgeLabel APIs)

battledIdxBuilder = management.buildVertexCentricIndex("battlesByTime")
battledIdx = battledIdxBuilder.addEdge("battled").direction("BOTH").order("decr").on(["time"]).make()

Build Vertex Label:
demigod = management.vertexLabelBuilder().makeVertexLabel("demigod").make()

Similarly, we also have end point APIs for awaitGraphIndex, reIndex, getOpenInstances and forceCloseInstance and commit.

Let me know your comments for the same.

Thanks