我可以在gremlin查询中限定orientdb顶点/边类吗?
orientdb具有看似“非标准”的功能,能够创建特定类别的顶点和边我可以在gremlin查询中限定orientdb顶点/边类吗?,orientdb,gremlin,Orientdb,Gremlin,orientdb具有看似“非标准”的功能,能够创建特定类别的顶点和边 g.createVertex('class:person') 但我不清楚我是否/如何通过“标准”小精灵获得该课程的资格 我见过这样的语法: g.V(“@class”,“person”)… ,但后来有人提到了这种绕过索引的语法 有人能解释一下这个话题吗?似乎Gremlin没有采用模式功能,而且并非所有的图形数据库都支持模式,因此我认为不能直接使用Gremlin操作OrientDB模式 无论如何,您可以使用createVertex
g.createVertex('class:person')
但我不清楚我是否/如何通过“标准”小精灵获得该课程的资格
我见过这样的语法:
g.V(“@class”,“person”)…
,但后来有人提到了这种绕过索引的语法
有人能解释一下这个话题吗?似乎Gremlin没有采用模式功能,而且并非所有的图形数据库都支持模式,因此我认为不能直接使用Gremlin操作OrientDB模式 无论如何,您可以使用
createVertexType()
命令在OrientDB trhough Gremlin中创建类
g = new OrientGraphNoTx('remote:localhost/GremlinDB')
==>orientgraphnotx[remote:localhost/GremlinDB]
g.createVertexType('Person','V')
==>Person
g.V.has('@class','Person').has('name','John')
==>v(Person)[#12:0]
g.V.has('@class','Person').has('name',T.eq,'John')
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name.contains('John')}
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name == 'John'}
==>v(Person)[#12:0]
V
的顶点类Person
:
g = new OrientGraphNoTx('remote:localhost/GremlinDB')
==>orientgraphnotx[remote:localhost/GremlinDB]
g.createVertexType('Person','V')
==>Person
g.V.has('@class','Person').has('name','John')
==>v(Person)[#12:0]
g.V.has('@class','Person').has('name',T.eq,'John')
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name.contains('John')}
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name == 'John'}
==>v(Person)[#12:0]
has()
:
g = new OrientGraphNoTx('remote:localhost/GremlinDB')
==>orientgraphnotx[remote:localhost/GremlinDB]
g.createVertexType('Person','V')
==>Person
g.V.has('@class','Person').has('name','John')
==>v(Person)[#12:0]
g.V.has('@class','Person').has('name',T.eq,'John')
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name.contains('John')}
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name == 'John'}
==>v(Person)[#12:0]
has()
+T
运算符:
g = new OrientGraphNoTx('remote:localhost/GremlinDB')
==>orientgraphnotx[remote:localhost/GremlinDB]
g.createVertexType('Person','V')
==>Person
g.V.has('@class','Person').has('name','John')
==>v(Person)[#12:0]
g.V.has('@class','Person').has('name',T.eq,'John')
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name.contains('John')}
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name == 'John'}
==>v(Person)[#12:0]
包含()
:
g = new OrientGraphNoTx('remote:localhost/GremlinDB')
==>orientgraphnotx[remote:localhost/GremlinDB]
g.createVertexType('Person','V')
==>Person
g.V.has('@class','Person').has('name','John')
==>v(Person)[#12:0]
g.V.has('@class','Person').has('name',T.eq,'John')
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name.contains('John')}
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name == 'John'}
==>v(Person)[#12:0]
==
:
g = new OrientGraphNoTx('remote:localhost/GremlinDB')
==>orientgraphnotx[remote:localhost/GremlinDB]
g.createVertexType('Person','V')
==>Person
g.V.has('@class','Person').has('name','John')
==>v(Person)[#12:0]
g.V.has('@class','Person').has('name',T.eq,'John')
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name.contains('John')}
==>v(Person)[#12:0]
g.V.has('@class','Person').filter{it.name == 'John'}
==>v(Person)[#12:0]
希望它能有所帮助谢谢@LucaS,是的,我已经使用了
createVertexType
创建了V的子类,但我的问题是现在在一个小精灵查询中搜索该子类的惯用方法(例如,找到我所有名字叫“LucaS”的人)……嗨@tony_k,我错过了查询:)。我正在编辑我的答案。嗨@tony_k,我发布了一些方法,你可以使用这些方法来检索你要查找的结果。希望能有帮助。嗨@tony_k,你有机会尝试这些问题吗?谢谢@LucaS,这些问题看起来不错,我会接受你的回答。你知道“@class”和索引吗?i、 e.“@class”是否有隐式索引,这些查询是否使用它?