首页 > 其他 > 详细

JanusGraph基于Gremlin使用总结

时间:2020-01-09 16:33:55      阅读:304      评论:0      收藏:0      [点我收藏+]

1,查询label为‘document‘的点

 g.V().hasLabel(‘document‘)

2,查询对应属性的点是否存在

g.V().hasLabel("document").has("doc_id","2019-09-23 17:45:26.0_00845569-a566-4270-afa7-aacc00140451")

3,删除点

g.V(‘600‘).drop() //id

4,从顶点开始单步遍历到某层(不返回单步步数超过途径的点和边)

g.V().hasLabel("document").has("doc_id","0007e43b-b3ac-4e6c-9f87-a85100a712cd_2019-10-08 09:46:04.0")
.inE()
.outV()
.inE()
.outV()
.path()

5,查看单个图的整体结构

g.V().outE().as("e").inV().has("doc_id","0007e43b-b3ac-4e6c-9f87-a85100a712cd_2019-10-08 09:46:04.0").select("e")

技术分享图片

 6,增加点和边,指定属性和label

//非叶子节点 
Vertex thisVertex = g.addV(key).property("doc_id", doc_id).next();
 g.addE(key).from(thisVertex).to(lastVertex).next();
//叶子节点
vertex = g.addV(key).property("text", text).next();
g.addE(key).from(vertex).to(lastVertex).property("index", index).next();

 

JanusGraph基于Gremlin使用总结

原文:https://www.cnblogs.com/huxinga/p/12171515.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!