First of all, I'm a complete newbie with neo4j and cypher so I apologize if this is a dumb question. Right now I'm not creating any actual database, I'm just practicing in a sandbox with silly hypotethical databases I come up with to practice, then try to formulate queries.
My problem is the following: let's say I have a database with a number of animals, each having the property "class"
MERGE (a:Animal {name: 'cat'})
ON CREATE SET a.class = 'mammal'
MERGE (a:Animal {name: 'lizard'})
ON CREATE SET a.class = 'reptile'
MERGE (a:Animal {name: 'ant'})
ON CREATE SET a.class = 'insect'
Now let's say I want to know which of these animals has four limbs based on their class. Is there a way for me to tell the the graph I want to add the property
a.limbs = 4
to every animal that already has the property "mammal" and "reptile" (let's pretend snakes don't exist), and not to a single node? And if I can do that, what would the query which could be interpreted as "show me every animal who has four limbs" be?
Many thanks
question from:
https://stackoverflow.com/questions/65928424/creating-a-relationship-between-all-nodes-with-a-set-property-with-cypher 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…