How can we improve Azure Cosmos DB?

Support strategies on graph traversals

Currently, the graph traversal in Cosmos DB graph (usually referenced by 'g') does not support the 'withStrategies'-method that is normally part of a Tinkerpop implementation. 'withStrategies' allows e.g to enhance the traversal with custom vertex- and edge-filtering on every step (by a SubgraphStrategy).

14 votes
Vote
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
You have left! (?) (thinking…)
Daniel C. Weber shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

3 comments

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...
  • anonym commented  ·   ·  Flag as inappropriate

    The `SubgraphStrategy` might also be useful to handle permissions/different versions on the application level by providing traversal sources with different strategies to different clients. Also the `ReadOnlyStrategy` is inherently quite useful.

  • Daniel C. Weber commented  ·   ·  Flag as inappropriate

    Our use case involves filtering out parts of the graph (vertices, edges) that do not meet certain criteria, and these criteria need to be specified up front. In our case, the criteria would simply be time - we want to be able to set DateTimes for (begin/end) on certain vertices and edges and only see them when DateTime.Now falls within that range and just ignore them otherwise. We would use the 'SubGraphStrategy' for that.

    From the Tinkerpop docs:
    SubgraphStrategy is similar to PartitionStrategy in that it constrains a Traversal to certain vertices, edges, and vertex properties as determined by a Traversal-based criterion defined individually for each.

    http://tinkerpop.apache.org/docs/current/reference/#traversalstrategy

  • Daniel C. Weber commented  ·   ·  Flag as inappropriate

    Documentation on traversal strategies: http://tinkerpop.apache.org/docs/current/reference/#traversalstrategy

    The simplest application would probably the 'subgraphStrategy' which allows you to define a global filter on vertices and edges and thus lets you view a filtered subgraph. E.g. any traversal setting out from the following

    g.withStrategies(SubgraphStrategy.build().vertexProperties(hasNot('endTime')).create())

    will only see vertices that don't have a property called 'endTime'.

Feedback and Knowledge Base