你如何让 Orientdb 成为独一无二的优势 [英] How do you make in Orientdb the edge to be unique

查看:40
本文介绍了你如何让 Orientdb 成为独一无二的优势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How do I make a Edge unique in Orientdb.

我想出的解决方案:

  • 删除边
  • 重新创建

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

but it's not nice. Edge is without any properties.

示例:

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

如果我再次调用它,应该会出现像创建唯一索引时那样的错误.

and if I call it again, there should be an error like when you make a unique index.

谢谢

推荐答案

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

Create a constraint on Edge out and in fields. For more information:

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

在你的情况下试试这个:

In your case try this:

CREATE INDEX UniqueEdges ON is_friend (out, in) unique

这篇关于你如何让 Orientdb 成为独一无二的优势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆