Check whether a node exists, if not create

When using MERGE on full patterns, the behavior is that either the whole pattern matches, or the whole pattern is created. MERGE will not partially use existing patterns — it’s all or nothing. If partial matches are needed, this can be accomplished by splitting a pattern up into multiple MERGE clauses. http://docs.neo4j.org/chunked/stable/query-merge.html MERGE (n)-[:know {r:’123′}]->(test2 {name:’2′}) will … Read more

Neo4j – Match by multiple relationship types

Yes, you can do something like: match (gal:Person{name:”Yoav”})-[:liked|:watched|:other]->(movie:Movie) return movie Take a look in the docs: Match on multiple relationship types EDIT: From the comments: I need “and” between the relation types.. you gave me an “or” In this case, you can do: match (Yoav:Person{name:”Yoav”})-[:liked]->(movie:Movie), (Yoav)-[:watched]->(movie), (Yoav)-[:other]->(movie) return movie