如何获取Neo4j中已有的约束?

时间:2014-02-09 11:07:40

标签: neo4j graph-databases

当我在图表上创建了一些约束时,如何才能看到它们以及消除它们?将它们视为图形元素的语法是什么?

4 个答案:

答案 0 :(得分:4)

在neo4j浏览器中,您可以使用:schema命令列出它们。 在shell中,它是schema

然后你可以用

删除它们
`DROP INDEX ON :Label(prop)` 

`DROP CONSTRAINT ON (n:Label) ASSERT n.props IS UNIQUE`

答案 1 :(得分:1)

在浏览器中,您可以使用 调用db.constraints 以获取图形上的所有约束。

有关更多信息:https://neo4j.com/docs/developer-manual/current/cypher/schema/constraints/

答案 2 :(得分:1)

要在 cypher 中执行此操作,您可以执行

CALL db.constraints;

它提供了一个约束表,您可以在执行时通过引用 name 列来删除条目

DROP CONSTRAINT constraint_name;

答案 3 :(得分:0)

运行

i.e. $vms = $(sessions).Split(" ")
$vms[0]
$vms[1]
etc etc 

似乎也给出了约束以及 DROP 语句的语法,准备复制/粘贴,例如:

call db.schemaStatements()