Using neo4j and really enjoying its flexibility. I've been using imported data and I'm trying to perform some data clean up and I was looking for a means to mass edit all my property keys on a set of nodes. In my case, I want to make all the keys(n) upper case and replace blanks with "_" regardless of the column name.
The following sets does this but assumes you know the specific name of the key.
MATCH (c:Category) UNWIND keys = collKeys SET c.COMPANY = c.Company REMOVE c.Company return c limit 1000
The following builds out a list of current keys and then what I want the labels to be. I'm just not sure how to adjust the SET correctly.
I'm trying to find a way to perform something like the following to UPPER CASE all my keys(c)
//SET c.REPLACE(toUPPER(c.Company)," ", "") = REPLACE(toUPPER(c.Company)," ", "")
MATCH (c:Category) UNWIND keys(c) as collKeys WITH DISTINCT collKeys WITH collKeys, REPLACE(toUPPER(collKeys)," ", "_") as collUPPERKeys WHERE collKeys <> 'source' SET c.collUPPERKeys = REPLACE(toUPPER(c.collKeys)," ", "_") //<-- this is where I'm struggling as c.collUPPERKeys doesn't make sense REMOVE c.collKeys return c
Is there an apoc function might be able to do this?
I realize best practice would be to do this at import but I don't have access to that code as of yet though I intend to do this prior to moving into the neo4j dbase.
Many thanks in advance