0

I am trying to put together a CYPHER build script for my NEO4J database.

I have successfully put together a script to create all nodes and relationships but am struggling to find a way of scripting the creation of more than one UNIQUE constraint.

I have nodes for geographic location, skills, departments and want to make sure that each node only allows one instace of their particular type of artefact.

I can create the unique constraints as individual CYPHER queries through the web interface but not as a single build script.

1 Answers1

1

You can't do that, you can only script that with neo4j-shell.

with the shell you can do:

bin/neo4j-shell -file setup.cql

where setup.cql would be

begin
create index on :Location(name);
create index on :Skill(name);
commit

begin
create (...)
...
commit
Michael Hunger
  • 41,339
  • 3
  • 57
  • 80