I want to execute cypher queries within a Java process (link).
This worked fine for all queries like MATCH xyz RETURN n, but whenever I want to execute and write execute an operation like CREATE or SET, an exception is thrown:
Exception in thread "main" org.neo4j.graphdb.QueryExecutionException: The given query is not supported at the moment in the selected cost-based planner
at org.neo4j.kernel.impl.query.QueryExecutionKernelException.asUserException(QueryExecutionKernelException.java:35)
at org.neo4j.kernel.InternalAbstractGraphDatabase.execute(InternalAbstractGraphDatabase.java:970)
at org.neo4j.kernel.InternalAbstractGraphDatabase.execute(InternalAbstractGraphDatabase.java:957)
at MainClass.embTestQuery(MainClass.java:85)
at MainClass.main(MainClass.java:28)
Code fragment:
matchingQuery = "CREATE (n:testnode) RETURN n";
try ( Transaction ignored = db.beginTx();
Result result =
db.execute( matchingQuery ))
{
while ( result.hasNext() )
{
Map<String,Object> row = result.next();
for ( Entry<String,Object> column : row.entrySet() )
{
rows += column.getKey() + ": " + column.getValue() + "; ";
}
rows += "\n";
}
}
System.out.println(rows);
Referenced Libraries:
- neo4j-consistency-check-2.2.5.jar
- neo4j-csv-2.2.5.jar
- neo4j-cypher-2.2.5.jar
- neo4j-cypher-compiler-1.9-2.0.4.jar
- neo4j-cypher-compiler-2.0-2.0.4.jar
- neo4j-cypher-compiler-2.1-2.1.8.jar
- neo4j-cypher-compiler-2.2-2.2.5.jar
- neo4j-graph-algo-2.2.5.jar
- neo4j-graph-matching-2.2.5.jar
- neo4j-import-tool-2.2.5.jar
- neo4j-io-2.2.5.jar
- neo4j-jmx-2.2.5.jar
- neo4j-kernel-2.2.5.jar
- neo4j-lucene-index-2.2.5.jar
- neo4j-primitive-collections-2.2.5.jar
- lucene-core-3.6.2.jar
- org.apache.servicemix.bundles.jline-0.9.94_1.jar
- neo4j-shell-2.2.5.jar
- neo4j-udc-2.2.5.jar
- neo4j-unsafe-2.2.5.jar