Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4j - convert set of node's attributes from string to int [duplicate]

If I have a set of nodes with the same attributes in Neo4j, is there a way to convert the type of a certain attribute from string to int (or vice versa) for all of those nodes?

like image 296
Sergei Wallace Avatar asked Feb 06 '16 02:02

Sergei Wallace


People also ask

What is coalesce in Neo4j?

The function coalesce() returns the first non- null value in the given list of expressions. Syntax: coalesce(expression [, expression]*) Returns: The type of the value returned will be that of the first non- null expression.

Can u relabel node in Neo4j?

You can change the nodes associated with a label but you can't change the type of a relationship. Conceptually, if you take your chicken out of one coop and put it in another you haven't altered the substance of the chicken.

What is unwind in Neo4j?

UNWIND expands a list into a sequence of rows.

How do you create a relationship between existing nodes in Neo4j?

In Neo4j to create relationship between nodes you have to use the CREATE statement like we used to create nodes. lets create relation between two already created nodes.


1 Answers

How about

MATCH (n:Type)
WHERE <filter if required>
SET n.strProp = toInt(n.strProp)

and

MATCH (n:Type)
WHERE <filter if required>
SET n.intProp = toString(n.intProp)
like image 124
Luanne Avatar answered Oct 17 '22 23:10

Luanne