zhengyingying commented on issue #2188:
URL:
https://github.com/apache/incubator-hugegraph/issues/2188#issuecomment-1511390974
@javeme Hi, the graph data is as following.
```
connection.getHugespecial().schema().propertyKey("age").asInt().ifNotExist().create();
connection.getHugespecial().schema().propertyKey("year").asInt().ifNotExist().create();
// vertex
connection.getHugespecial().schema().vertexLabel("person").properties("age").nullableKeys("age").create();
connection.getHugespecial().schema().indexLabel("personbyage").onV("person").by("age").shard().ifNotExist().create();
// edge
connection.getHugespecial().schema().edgeLabel("knows").sourceLabel("person").targetLabel("person").properties("year").ifNotExist().create();
connection.getHugespecial().schema().edgeLabel("teach").sourceLabel("person").targetLabel("person").properties("year").ifNotExist().create();
connection.getHugespecial().schema().indexLabel("knowsbyperson").onE("knows").by("year").shard().ifNotExist().create();
connection.getHugespecial().schema().indexLabel("teachbyperson").onE("teach").by("year").shard().ifNotExist().create();
GraphManager graph = connection.getHugespecial().graph();
/** create graph data */
Vertex person1 = new Vertex("person").property("age", 12);
Vertex person2 = new Vertex("person").property("age", 23);
Vertex person3 = new Vertex("person").property("age", 24);
graph.addVertices(Arrays.asList(person1, person2, person3));
Edge edge1 = new
Edge("knows").source(person1).target(person2).property("year", 3);
Edge edge2 = new
Edge("teach").source(person1).target(person3).property("year", 2);
graph.addEdges(Arrays.asList(edge1, edge2));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]