I'm trying to create a new node that is linked to an existing node for which I have the elementId. I wrote this query in the Neo4J browser to verify what I wanted to do actually worked:
MATCH (newApp: system⚁⚁application) WHERE elementId(newApp) = '4:c27fa6be-0d0f-4662-9e30-b4e7302b9104:1'
So clearly, I'm doing something wrong here, but I just don't see it. I would greatly appreciate any feedback or suggestions that anyone might have to offer here.
Your query performs a match, followed by a create. As such, the newRecordType node should be created and related to the the newApp node. The only cause I can think of is the newApp node did not match. Your elementId's are different between the two queries. Can this be the cause? If not, do you get a result when you execute just the match?
MATCH (newApp: system⚁⚁application) WHERE elementId(newApp) = '4:24d5928d-24a7-401f-bf3f-7ff4fb7766dd:47'
return newApp
The IDs don't match because it's two different runs. The Java is running in a unit test, so the IDs are constantly different - a previous part of the unit test creates the node for newApp and returns its ID, and that ID is what's used in this query.
But I'll try your suggestion, just to make sure that part is actually working.
Interesting. I will look into that. It might not be necessary the way most of my code its structured, so far, but there might come a point where that would turn out to be very handy.