Database Reference
In-Depth Information
}
} catch (Exception e) {e.printStackTrace();}
Perform the following steps to compile and run the preceding code snippets from the IDE:
1. Stop your Neo4j server (if it is already running).
2. Provide all the JAR files from
<$NEO4J_HOME>/lib/
in the classpath.
3. Add or import
org.neo4j.graphdb.schema.*
as an additional package.
4. Wrap the code around the transaction in a try and catch block:
try (Transac-
tion tx = graphDb.beginTx()) {}
.
try-with-resources
is
available only with Java 1.7 and above.
5. Initialize the Java variable,
DBLocation
, with the location of your Neo4j data-
base as per your local filesystem, which is generally available at
<$NEO4J_HOME>/data/graph.db
.
The constraints can be deleted by using
ConstraintDefinition#drop
.
Note
Creating the constraint automatically creates the index on the same column and will be
deleted as soon as the constraint is dropped.