Is there a clause in Cypher that would allow me to rename property o.operating_system
into o.os
? I already have values assigned to a property.
Asked
Active
Viewed 27 times
0

Kelvin Lawrence
- 14,674
- 2
- 16
- 38

ShymPi1999
- 51
- 3
1 Answers
0
In general, with Cypher/openCypher, you can do this by copying the old property and then removing it. As a concrete example, using the air-routes data set (tested using Amazon Neptune but it should work elsewhere). In this example we change the property called code
to a new one named iata
.
MATCH (a:airport {code: 'SFO'})
SET a.iata = a.code
REMOVE a.code
RETURN a
And we can see the update has worked...
{
"results": [
{
"a": {
"~id": "23",
"~entityType": "node",
"~labels": [
"airport"
],
"~properties": {
"desc": "San Francisco International Airport",
"lon": -122.375,
"runways": 4,
"type": "airport",
"country": "US",
"region": "US-CA",
"lat": 37.6189994812012,
"iata": "SFO",
"elev": 13,
"city": "San Francisco",
"icao": "KSFO",
"longest": 11870
}
}
}
]
}

Kelvin Lawrence
- 14,674
- 2
- 16
- 38
-
If I've had any relationships do I need to recreate them? – ShymPi1999 Mar 02 '23 at 11:15
-
If you are just updating a node property, any relationships that node has should be unaffected. – Kelvin Lawrence Mar 02 '23 at 13:24