-
-
Notifications
You must be signed in to change notification settings - Fork 94
Description
Hi,
Very impressed to see all the work which has gone into the recent Cypher improvements, and recent bolt support - we've been looking at various graph databases of late and this makes life much easier!
There is a pattern which I've used previously on Neo4j (and it also seems to work on memgraph), which doesn't work on ArcadeDB and I was wondering if this was something you are able to support.
I'll often create or update multiple nodes in a single shot, using UNWIND to loop over a list in the params. I use a CASE subquery to determine whether the parameter map for a single "thing" is present, and if not, don't set that property (allowing me to only set/update a subset of properties for each "thing" separately).
e.g.
UNWIND $things AS thing
MERGE (t:Thing {id: thing.id})
SET (CASE WHEN thing.propA IS NOT NULL THEN t END).propA = thing.propA WITH t, thing
SET (CASE WHEN thing.propB IS NOT NULL THEN t END).propB = thing.propB WITH t, thing
SET (CASE WHEN thing.propC IS NOT NULL THEN t END).propC = thing.propC
Obviously an alternative is to generate custom queries for each "thing", but from past experience this results in either posting a huge query at the server which kills the parser/planner/any kind of query caching (at least on Neo4j), or you have to send lots of individual queries in a single transaction.
I've put together a simple test case which can be run against Neo4j or an embedded ArcadeDB instance (sorry, might not be fully up to date with all the latest Java conventions, I've been writing Kotlin for a couple of years, hopefully it's clear enough!). There is a comment in the test code about constraints not being supported, but I see you've actually closed an issue to fix that just today, so please ignore it!
When run against ArcadeDB the properties are simply not set at all.
Many thanks