Gremlin and OrientDB

56 views
Skip to first unread message

Amrutha Valli

unread,
Jun 21, 2016, 2:55:09 AM6/21/16
to OrientDB
Hi,

I am create vertices and Edges using gremlin can you help me how to create a unique id and create indexes uisng gremlin below is how i am creating vertices and edges .I want to persist my gremlin generated ids in the database

        OrientGraph graph = new OrientGraph("remote:localhost/frddb", "admin", "admin");
          Vertex v1 = graph.addVertex("class:Person");
v1.setProperty("name", "AA");
Vertex v2 = graph.addVertex("class:Person");
v2.setProperty("name", "BB");
      graph.addEdge( "frd" ,v1, v2, "frd");

I am using this in java

alessand...@gmail.com

unread,
Jun 21, 2016, 4:10:43 AM6/21/16
to OrientDB
Hi Amrutha,
when you create a class, that class has already a unique id field.



Hope it helps

Amrutha Valli

unread,
Jun 21, 2016, 4:38:29 AM6/21/16
to OrientDB
But i dont want to use this id i want to create a id can i do it 

alessand...@gmail.com

unread,
Jun 21, 2016, 5:27:31 AM6/21/16
to OrientDB
You can use

 g.createKeyIndex("id", Vertex.class)

Kind regards,
Alessandro

Amrutha Valli

unread,
Jun 21, 2016, 6:53:48 AM6/21/16
to OrientDB
For Every  node is it possible  to create a unique id  using gremlin
Reply all
Reply to author
Forward
0 new messages