【问题标题】:How do you make in Orientdb the edge to be unique您如何在 Orientdb 中打造独一无二的优势
【发布时间】:2015-01-04 17:48:43
【问题描述】:

如何在 Orientdb 中使 Edge 独一无二。

我想出的解决方案:

  • 删除边缘
  • 再次创建它

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

示例:

create edge is_friend from #12:0 to #12:3

如果我再次调用它,应该会出现错误,例如创建唯一索引时。

谢谢

【问题讨论】:

    标签: orientdb


    【解决方案1】:

    在 Edge out 和 in 字段上创建一个约束。欲了解更多信息:

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

    在你的情况下试试这个:

    CREATE INDEX UniqueEdges ON is_friend (out, in) unique
    

    【讨论】:

    • 很抱歉,我从文档中不明白如何使 EDGE 独一无二。这些示例适用于 Vertex 类.. [我可以为顶点创建一个唯一的字段,这很容易......]。如果有帮助,我已经用图片更新了我的答案...
    • 我得到 com.orientechnologies.orient.core.index.OIndexException: Index with name : 'UniqueEdges' cannot be created on class : 'is_friend' 因为字段:'out' 在类定义中不存在。
    • 对,在“is_friend”类中创建属性“in”和“out”。
    • 好的...应该是什么类型的?
    • 进出都是LINK
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-28
    • 1970-01-01
    • 2014-10-15
    • 2011-12-30
    • 1970-01-01
    • 2013-04-06
    相关资源
    最近更新 更多