Just learning about Graph Databases and NEO4J. I assume that the same distinction between compositional and aggregational relationships applies in Graph databases as in other databases.

Creating an aggregational relationship in NEO4J/Cypher, assuming we already have a Country node called 'Italy' in the database, the below query will create a Currency node called 'Euro' if one doesn't already exist and then create a relationship from Italy to Euro if that relationship doesn't already exist...

```
MATCH (co:Country {name:'Italy'}) 
MERGE (cu:Currency {name:'Euro'}) 
MERGE (co)-[cc:COUNTRYCURRENCY]->(cu) 
RETURN cc

```

If there is not already a relationship Italy->Euro but there is already a Currency node 'Euro' (for example because we had already created the Euro for it to be used by another country, eg 'France'), then the above query would not create a second duplicate node called 'Euro'. it would reuse the existing 'Euro' node and create a new relationship to it from 'Italy'. This is correct behaviour for an aggregational relationship.

So say I want to merge a compositional relationship instead. IE If a parent already has a child with specified name/properties then I don't want to create a duplicate so I need to use MERGE. But if the specified parent doesn't have this child yet and there is already a child node for a different parent with the same name/properties as this child node then I want to create a new one in the context of this parent rather than reuse the existing one. So I need to make the whole operation conditional on whether a relationship already exists between the parent and a child having given properties. Is this syntactically possible in a one-liner?