Am 15.04.2014 um 18:53 schrieb Kevin Burton <[email protected]>:

> The documentation on MERGE gives the following example:
> 
> MATCH (charlie:Person { name:'Charlie Sheen' }),(wallStreet:Movie { 
> title:'Wall Street' })
> MERGE (charlie)-[r:ACTED_IN]->(wallStreet)
> RETURN r
> 
> It states that "Charlie Sheen had already been marked as acting on Wall 
> Street, so the existing relationship is found and returned. " 

> My question is what if the nodes 'charlie' and 'wallstreet' exist but there 
> is no 'ACTED_IN' relationship? 
then it will be created

> Also to further complicate things say that Person has a constraint on 'name' 
> to be unique and Movie has a constraint on 'title' to be unique. Since there 
> is (in my scenario) no 'ACTED_IN' relationship MERGE fails to match but also 
> because of the constraits all of the nodes cannot be created. So in this case 
> will the RETURN r be null?

no, 
MERGE for paths works with bound identifiers.

so if both charlie and wallStreet are bound it uses them and doesn't create a 
new node, only if one is not bound it will create a new node, to create a new 
sub-path.


> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to