简体   繁体   English

两个顶点之间的Gremlinepipeline边缘

[英]Gremlinepipeline Edges between two Vertex

To check the edge between the vertex using Gremline pipeline in java code? 要使用Java代码中的Gremline管道检查顶点之间的边缘? I am able to create the edges but if we give the same vertex again the new edge will be created. 我能够创建边,但是如果我们再次赋予相同的顶点,则会创建新边。 I want to create a unique edge between the 2 vertex. 我想在2个顶点之间创建一个唯一的边。 Any help? 有什么帮助吗? I am using orientDB 我正在使用orientDB

You can create a unique index on the Edge class that will give you that constraint 您可以在Edge类上创建唯一索引,该索引将为您提供约束

create class Foo extends V
create class FooEdge extends E
create property FooEdge.in LINK
create property FooEdge.out LINK

create index FooEdge_in_out on FooEdge (out,in) unique
insert into Foo set name = 'Foo1'
insert into Foo set name = 'Foo2'
create edge FooEdge from (select from Foo where name = 'Foo1') to (select from Foo where name = 'Foo2')
/* fail */
create edge FooEdge from (select from Foo where name = 'Foo1') to (select from Foo where name = 'Foo2')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM