ORM of nebula-java
一个 nebula-java 的 ORM 框架,graph ocean 意为图海洋,
与 Nebula Graph 的星云相匹配,星辰大海。
详细见 graph-ocean 设计文档:https://github.com/Anyzm/graph-ocean/blob/main/graph-ocean-design.md
maven项目引入坐标:
<dependency>
<groupId>io.github.anyzm</groupId>
<artifactId>graph-ocean</artifactId>
<version>1.0.0</version>
</dependency>
NebulaGraphMapper nebulaGraphMapper = nebulaGraphMapper(nebulaPoolSessionManager(
nebulaPool(nebulaPoolConfig())));
User user = new User("UR123", "张三");
//保存顶点
int i = nebulaGraphMapper.saveVertexEntities(Lists.newArrayList(user));
//查询顶点
List<User> users = nebulaGraphMapper.fetchVertexTag(User.class, "UR123");
//保存边和查询边类似
Follow follow = new Follow("UR123", "UR234", 1);
//保存边
nebulaGraphMapper.saveEdgeEntities(Lists.newArrayList(follow));
//查询出边
List<Follow> follows = nebulaGraphMapper.goOutEdge(Follow.class, "UR123");
//查询反向边
List<Follow> fans = nebulaGraphMapper.goReverseEdge(Follow.class, "UR123");
//查询API
VertexQuery query = NebulaVertexQuery.build().fetchPropOn(User.class, "UR123")
.yield("userName");
QueryResult rows = nebulaGraphMapper.executeQuery(query);
拥有丰富的 API,详情请见测试用例:com.github.anyzm.graph.ocean.GraphOceanExample