Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-30-2021 10:12 AM
Hi,
we are using neo4j with GDS in a spring project (kotlin) and want to test our repository functions. For this we are using an in-memory database with neo4j-harness.
When I try to create a GDS graph in my test function, neo4j does not find any nodes. This seems like a bug. Our graph consist out of nodes labelled "User" and nodes labelled "Post". Users are connected to Posts via a "LIKED" relationship. The following illustrates my problem:
@Test
internal fun `gds graph create`() {
// this returns 9 nodes as expected
val nodeQuery = "MATCH (u:User) RETURN id(u) AS id UNION MATCH (p:Post) RETURN id(p) AS id"
val nodes = neo4jClient.query(nodeQuery).fetch().all()
// this returns 4 relationships as expected
val relationshipQuery = "MATCH (u:User) - [:LIKED] -> (p:Post) RETURN id(u) AS source, id(p) AS target"
val relationships = neo4jClient.query(relationshipQuery).fetch().all()
// this throws an exception: "Node-Query returned no nodes"
val graphQuery = "CALL gds.graph.create.cypher('test', '$nodeQuery', '$relationshipQuery')"
val graph = neo4jClient.query(graphQuery).fetch().all()
}
The exception thrown is the following:
Failed to invoke procedure `gds.graph.create.cypher`: Caused by: java.lang.IllegalArgumentException: Node-Query returned no nodes; Error code 'Neo.ClientError.Procedure.ProcedureCallFailed'
org.springframework.dao.InvalidDataAccessResourceUsageException: Failed to invoke procedure `gds.graph.create.cypher`: Caused by: java.lang.IllegalArgumentException: Node-Query returned no nodes; Error code 'Neo.ClientError.Procedure.ProcedureCallFailed'
at org.springframework.data.neo4j.core.Neo4jPersistenceExceptionTranslator.translateImpl(Neo4jPersistenceExceptionTranslator.java:105)
at org.springframework.data.neo4j.core.Neo4jPersistenceExceptionTranslator.translateExceptionIfPossible(Neo4jPersistenceExceptionTranslator.java:91)
at org.springframework.data.neo4j.core.DefaultNeo4jClient.potentiallyConvertRuntimeException(DefaultNeo4jClient.java:174)
at org.springframework.data.neo4j.core.DefaultNeo4jClient.access$400(DefaultNeo4jClient.java:55)
at org.springframework.data.neo4j.core.DefaultNeo4jClient$DefaultRecordFetchSpec.all(DefaultNeo4jClient.java:315)
at de.iptk.groupj.user.adapter.database.UserSimilarityRepositoryImplTest.am i insane$TinTok_integration(UserSimilarityRepositoryImplTest.kt:37)
This is our configuration for the in-memory database:
val database: Neo4j = Neo4jBuilders.newInProcessBuilder()
.withDisabledServer()
.withConfig(GraphDatabaseSettings.plugin_dir, pluginDir.file.toPath())
.withConfig(GraphDatabaseSettings.procedure_unrestricted, listOf("gds.*"))
.withConfig(GraphDatabaseSettings.procedure_allowlist, listOf("apoc.trigger.*", "gds.*"))
.withConfig(ApocSettings.apoc_trigger_enabled, true)
.withProcedure(GraphCreateProc::class.java)
.withProcedure(GraphDropProc::class.java)
.withProcedure(GraphListProc::class.java)
.withProcedure(NodeSimilarityStreamProc::class.java)
.withProcedure(Trigger::class.java)
.build()
Is there something we need to additionally enable in the database configuration to get this to work?
Any help is appreciated, including where I would need to file a bug report for this, as I am not sure if it's related to neo4j, spring-data or GDS.
Kind Regards,
Jan
02-05-2021 05:22 PM
If the node query, run independently, returns 9 nodes, then you shouldn't get that error from the graph create procedure. Do you get the same error if you run the same procedure call in Cypher shell?
If you want to file a bug report, the best place is: Issues · neo4j/graph-data-science · GitHub
All the sessions of the conference are now available online