图数据库代码

gremlin:

https://tinkerpop.apache.org/#

gremlify:

https://gremlify.com/ 账号: 邮箱 密码: 姓名开头的那个 (无法保存中文)

下载 console , 然后在console环境下学习gremlin语法

快速上手

https://gremlify.com/73cufe9i2sn

https://tinkerpop.apache.org/docs/current/tutorials/getting-started/

g.addV('person').as('1').
property(single, 'name', 'peter').
property(single, 'age', 35).addV('person').
as('2').
property(single, 'name', 'marko').
property(single, 'age', 29).addV('person').
as('3').
property(single, 'name', 'josh').
property(single, 'age', 32).addV('person').
as('4').
property(single, 'name', 'vadas').
property(single, 'age', 27).addV('software').
as('5').
property(single, 'name', 'ripple').
property(single, 'lang', 'java').
addV('software').as('6').
property(single, 'name', 'lop').
property(single, 'lang', 'java').
addE('created').from('1').to('6').
property('weight', 0.2).addE('created').
from('2').to('6').property('weight', 0.4).
addE('knows').from('2').to('3').
property('weight', 1).addE('knows').from('2').
to('4').property('weight', 0.5).
addE('created').from('3').to('6').
property('weight', 0.4).addE('created').
from('3').to('5').property('weight', 1)
g.V() // 获取所有点
g.V(1) // 获取指定点
g.V(1).values('name') // 获取指定属性的值
g.V(1).outE('knows') // 获取指定标签的边
g.V(1).outE('knows').inV().values('name') // 获取另一个点的属性的值
g.V(1).out('knows').values('name') // 上一句的缩写
g.V(1).out('knows').has('age', gt(30)).values('name') // 获取年龄大于30的点的属性的值

应用开发技巧

https://tinkerpop.apache.org/docs/current/tutorials/the-gremlin-console/#application-devs

已知的事实是datagrip不支持gremlin-server连接

没找到可用的可视化工具,直接用gremlin-console

警告

gremlin-console感觉比较原始,不支持语法智能提示