Search code examples
gremlintinkerpoptinkerpop3gremlin-serveramazon-neptune

Tinkerpop: Creating nested Properties


I want to create a Vertex of label foo, which contains a property child. Child property will have two properties A, B. Child in itself can contain more nested children.

If vertex foo is deleted, its all properties including child property should be deleted. My query pattern would be to query all vertexes of label foo which has property A = 'bar'

This can be easily represented by representing the child as vertices instead of property, but then the child has to be deleted by doing dfs/bfs originating from vertex foo. This is proving a costly affair. If childs are saved as property, drop operation will be saved of dfs/bfs.

How do I create nested properties and how can I query them using apache tinkerpop. Is there any other data model I can adopt to reduce the query cost.


Solution

  • Neptune does not support meta properties. Even if it would, you should not have used them. If you have hierarchical structure, and you already use a graph DB, then you should benefit from its capabilities. If just storing nested properties is your need, maybe you should look at document DB instead.

    Deleting a child vertex should not be an expensive operation:

    g.V(child_id).emit().repeat(out()).drop()