CREATE CONSTRAINT c1 IF NOT EXISTS FOR (c:Class) REQUIRE c.ID IS UNIQUE;CREATE CONSTRAINT c2 IF NOT EXISTS FOR (c:Class) REQUIRE c.NAME IS UNIQUE;CREATE CONSTRAINT c3 IF NOT EXISTS FOR (m:Method) REQUIRE m.ID IS UNIQUE;CREATE CONSTRAINT c4 IF NOT EXISTS FOR (m:Method) REQUIRE m.SIGNATURE IS UNIQUE;CREATE INDEX index1 IF NOT EXISTS FOR (m:Method) ON (m.NAME);CREATE INDEX index2 IF NOT EXISTS FOR (m:Method) ON (m.CLASSNAME);CREATE INDEX index3 IF NOT EXISTS FOR (m:Method) ON (m.NAME, m.CLASSNAME);CREATE INDEX index4 IF NOT EXISTS FOR (m:Method) ON (m.NAME, m.NAME0);CREATE INDEX index5 IF NOT EXISTS FOR (m:Method) ON (m.SIGNATURE);CREATE INDEX index6 IF NOT EXISTS FOR (m:Method) ON (m.NAME0);CREATE INDEX index7 IF NOT EXISTS FOR (m:Method) ON (m.NAME0, m.CLASSNAME);:schema//查看表库:sysinfo //查看数据库信息
若想删除约束:
DROP CONSTRAINT c1;DROP CONSTRAINT c2;DROP CONSTRAINT c3;DROP CONSTRAINT c4;DROP INDEX index1;DROP INDEX index2;DROP INDEX index3;DROP INDEX index4;DROP INDEX index5;DROP INDEX index6;DROP INDEX index7;
match (source:Method) where source.NAME="readObject"match (m1:Method) where m1.NAME="transform"and m1.CLASSNAME="org.apache.commons.collections.Transformer"call apoc.algo.allSimplePaths(m1, source, "<CALL|ALIAS",6) yield pathwhere any(n innodes(path) where n.CLASSNAME="java.util.PriorityQueue")returnpathlimit10