Search code examples
graph-databasesgremlinamazon-neptune

how to add a list as property of vertex or edge gremlin


1.How to add a list as the value for the property for a vertex or edge. and what happens if a vertex get deleted does all its existing edges gets automatically deleted or we should remove manually and is it safe to remove a vertex.

2.How to create a vertex with JSON and how to get the output of gremlin query as JSON format.


Solution

  • How to add a list as the value for the property for a vertex or edge.

    Neptune does not support list cardinality for vertex properties nor does it support list data types for edge/vertex properties. You can however use set cardinality for vertex properties. You can read more about that here.

    what happens if a vertex get deleted does all its existing edges gets automatically deleted

    If you delete a vertex then all edges will be deleted with it.

    How to create a vertex with JSON and how to get the output of gremlin query as JSON format.

    I'm not sure what you mean here. You typically don't create vertices with JSON really. You use Gremlin and that means that you choose a method of connecting to Neptune (e.g. Java driver, Python driver, etc) and then you send Gremlin to Neptune. To create a vertex you would do: g.addV('person').property('name','mmr').