Reputation: 363
Within a graph there are Person-Nodes which have properties with information about the birthday and place of birth of a person e.g.
Jaroslavice 8.10.1679
Alcudia 26.7.1689
Is it possible to get ISO-dates and the place out of that property of type text and put it in new properties ?
Upvotes: 1
Views: 122
Reputation: 11216
It is certainly possible.
One way would be to search for nodes that do not contain your new property; then use the split
function to divide the text on spaces
and periods; and then reassemble the date in the format you require.
Something like this...
MATCH (person:Person)
WHERE NOT exists(person.birthdate)
WITH person,
split(person.informations,' ')[0] AS place,
split(person.informations,' ')[1] AS date
WITH person,
place,
split(date,'.')[0] AS day,
split(date,'.')[1] AS month,
split(date,'.')[2] AS year
SET person.birth_place = place,
person.birthdate = substring('0000', 0, 4 - size(year)) + year
+ '-'
+ substring('00', 0, 2 - size(month)) + month
+ '-'
+ substring('00', 0, 2 - size(day)) + day
Upvotes: 3