是否可以在Neo4j/OrientDB中约束边缘多重性? [英] Is it possible to constraint edge multiplicity in Neo4j / OrientDB?
本文介绍了是否可以在Neo4j/OrientDB中约束边缘多重性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道Neo4j和OrientDB是否提供了针对特定边缘类型的多重性来定义约束的可能性?
I was wondering whether Neo4j and OrientDB provide the possibility of defining constraints in terms of multiplicity for specific edge types?
推荐答案
对于OrientDB
您可以为每个标签设置进出集合的多重性.如果边的标签为"workFor",则设置从人"到公司"的最多1条边的示例:
For OrientDB
You can set multiplicity on out/in collection per label. Example to set maximum 1 edges from Person to Company if the edge's label is "workFor":
ALTER PROPERTY Person.out_workFor NOT NULL
ALTER PROPERTY Person.out_workFor MAX 1
您还可以通过以下方式设置最小值:
You can also set the minimum with:
ALTER PROPERTY Person.out_workFor MIN 1
用min&与公司只有一种关系是强制性的.
In this way with min & max it's mandatory having one and only one relationship to Company.
这篇关于是否可以在Neo4j/OrientDB中约束边缘多重性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文