Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-04-2021 10:09 PM
Hi,
I am working with Neo4j 4.2.3 embedded to handle a database together with GDS library 1.5.1.
I want to create a Subgraph by executing:
try (Transaction tx = graphDB.beginTx()) {
if (verbose) {
System.out.println("CREATE TEMPORARY SUBGRAPH...");
}
String subGraphQuery = "CALL gds.graph.create(" + " '" + graphName + "'," + " '" + mainLabel + "'," + " '" + mainRelationship + "'"
+ relProps + ") YIELD createMillis;";
if (verbose) {
printResult(tx.execute(subGraphQuery), false, "|", false);
} else {
tx.execute(subGraphQuery);
}
tx.commit();
}
The SUBGRAPH is only created or accessible when I print out the result (iterates over all the rows of the result).
Otherwise following CYPHER-requests run into:
Caused by: java.util.NoSuchElementException: Graph with name 'SUBGRAPH' does not exist on database 'neo4j'.
It is also working when use
Result result = tx.execute(subGraphQuery);
result.accept(null);
or
Result result = tx.execute(subGraphQuery);
result.next();
Why this?
All the sessions of the conference are now available online