Need Neo4J Cyphers
Budget: $10 – $30 USD
Need cyphers for the following scenarios.
1. Create node only if one with specific attribute doesn’t already exist.
Example: If node Person with Id== 12345 doesn’t exist create node Person with properties Id=12345, birthYear=1903
2. Create node and sub node only if main node specific attribute doesn’t already exist. Example: If node Person with Id==12345 doesn’t exist, create node person with properties Id=12345, birthYear=1903 and node Habits with properties “exercise” = “daily”. Link Habits node to Person node with relationship type “BELONGS_TO”
3. Create Node and attribute if none exists. If either node or attribute exists update attribute. If node exists without attribute add attribute. Examples:
a) If node Person with Id==12345 doesn’t exist, create node Person with properties Id=12345, birthYear=1903.
b) If node Person with Id== 12345 exists with no attribute “birthyear” add attribute birthYear=1903.
c) If node Person with Id== 12345 exists with attribute “birthyear”==1903 update attribute birthYear=1944.
4. Create subnode and attribute if none exists. If either subnode or attribute exists update attribute. If node exists without attribute add attribute. Examples:
a. If node Person with Id== 12345 does not have subnode “Habits”, create subnode with properties “exercise” = “daily”. Link Habits node to Person node with relationship type “BELONGS_TO”.
b. If node Person with Id== 12345 exists and has subnode “Habits”, but subnode does not have property “exercise” == “daily”, create property “exercise” == “daily”.
c. If node Person with Id== 12345 has subnode “Habits”, but subnode property “exercise” != “daily”, update property “exercise” == “daily”.
1. Create node only if one with specific attribute doesn’t already exist.
Example: If node Person with Id== 12345 doesn’t exist create node Person with properties Id=12345, birthYear=1903
2. Create node and sub node only if main node specific attribute doesn’t already exist. Example: If node Person with Id==12345 doesn’t exist, create node person with properties Id=12345, birthYear=1903 and node Habits with properties “exercise” = “daily”. Link Habits node to Person node with relationship type “BELONGS_TO”
3. Create Node and attribute if none exists. If either node or attribute exists update attribute. If node exists without attribute add attribute. Examples:
a) If node Person with Id==12345 doesn’t exist, create node Person with properties Id=12345, birthYear=1903.
b) If node Person with Id== 12345 exists with no attribute “birthyear” add attribute birthYear=1903.
c) If node Person with Id== 12345 exists with attribute “birthyear”==1903 update attribute birthYear=1944.
4. Create subnode and attribute if none exists. If either subnode or attribute exists update attribute. If node exists without attribute add attribute. Examples:
a. If node Person with Id== 12345 does not have subnode “Habits”, create subnode with properties “exercise” = “daily”. Link Habits node to Person node with relationship type “BELONGS_TO”.
b. If node Person with Id== 12345 exists and has subnode “Habits”, but subnode does not have property “exercise” == “daily”, create property “exercise” == “daily”.
c. If node Person with Id== 12345 has subnode “Habits”, but subnode property “exercise” != “daily”, update property “exercise” == “daily”.
Related categories:
Neo4j