你如何在Orientdb中获得独特的优势

OWA*_*DVL 5 orientdb

如何在Orientdb中使Edge唯一.

我提出的解决方案:

  • 删除边缘
  • 再创一次

但这并不好.Edge没有任何属性.

例:

create edge is_friend from #12:0 to #12:3
Run Code Online (Sandbox Code Playgroud)

如果我再次调用它,应该有一个错误,比如当你创建一个唯一索引时.

谢谢

在此输入图像描述

Lvc*_*vca 8

在Edge out和in字段中创建约束.欲获得更多信息:

http://www.orientechnologies.com/docs/last/orientdb.wiki/Graph-Schema.html#constraints

在你的情况下试试这个:

CREATE INDEX UniqueEdges ON is_friend (out, in) unique
Run Code Online (Sandbox Code Playgroud)

  • 是的,在"is_friend"类中创建"in"和"out"属性. (4认同)
  • 我得到com.orientechnologies.orient.core.index.OIndexException:索引名称:'UniqueEdges'不能在类上创建:'is_friend'因为字段:'out'在类定义中不存在. (3认同)
  • 进出都是LINK (2认同)