I am now into my second hour of experimenting with Neo4J. Thus far, I am very very impressed with what I see. The tutorials, the Windows desktop version, the syntax of Cypher... are pretty much perfect. However, I am finding it difficult to understand just how I should make multiple changes to a node in one statement.
For the present purpose I am simply working with the default Movies database. Suppose I want to do the following
- Create a Person with an additional role of "Alien"
- Give that instance of Person the additional attribute of Peau = 'Green'
- Change my mind and decide that the attribute name/value pair should be in English rather than French
- So at this stage I want to REMOVE peau and SET skin.
Not a problem in itself if I use the following sequence
CREATE (p:Person:Alien {name:'ET'});
MATCH(a:Alien) RETURN a;
//all good Person with the extra role of fAlien now exists
MATCH(a:Alien) SET a.born = 1987 RETURN s;
//still good
MATCH(a:Alien) SET a.peau = 'Verte' RETURN a;
//our Alien now has a green skin - in French
MATCH(a:Alien) SET a.skin = 'Green' RETURN a;
//our Alien now also has a green skin in English
MATCH(a:Alien) REMOVE a.peau RETURN a;
//all good, stripped out that unrequired French peau attribute
While this works it does seem like unnecessary extra work. Surely, I should be able to SET and REMOVE in one statement. However,
MATCH(a:Alien) SET a.skin = 'Green' REMOVE a.peau = 'Verte' RETURN a;
Yes, that worked too. However, with my pgSQL background this feels a bit odd to me. Put in a comma before the REMOVE and Cypher throws up an error because it does not understand - it thinks I am attempting to continue the prior SET... . Is the way I have written the statement the only valid way to accomplish what I need here?
