Gremlin and OrientDB

已查看 56 次
跳至第一个未读帖子

Amrutha Valli

未读,
2016年6月21日 02:55:092016/6/21
收件人 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

未读,
2016年6月21日 04:10:432016/6/21
收件人 OrientDB
Hi Amrutha,
when you create a class, that class has already a unique id field.



Hope it helps

Amrutha Valli

未读,
2016年6月21日 04:38:292016/6/21
收件人 OrientDB
But i dont want to use this id i want to create a id can i do it 

alessand...@gmail.com

未读,
2016年6月21日 05:27:312016/6/21
收件人 OrientDB
You can use

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

Kind regards,
Alessandro

Amrutha Valli

未读,
2016年6月21日 06:53:482016/6/21
收件人 OrientDB
For Every  node is it possible  to create a unique id  using gremlin
回复全部
回复作者
转发
0 个新帖子