Are there anyhow to create node by get data from dictionary below:
node = {'mike':22, 'jack':19, 'alex':24}
query = """
UNWIND {{batch}} as row
CREATE (n:SINGLE_NODE)
SET n += row
""".format(node =node )
session.run(query, node =node )
i want key for name and number for age properties.
And For relationship:
relations = {'mike|jack':1,'mike|jack':2,'jack|alex':3}
query = """
UNWIND {{relations}} as row
MATCH (from:SINGLE_NODE {{name:row.from}})
MATCH (to:SINGLE_NODE {{name:row.to}})
MERGE (from)-[rel:IS_CONNECTED]->(to)
ON CREATE SET rel += row.count
""".format(relations=relations)
session.run(query, relations =relations )
i want to split key for match node in database (ex. 'mike|jack' -> row.from = 'mike' , row.to = 'jake')
and value of key for set relationship properties.
The data in dictionary variable come from by getting word in text document and i want to avoid using list variable ( [{ },{ },...] ) because it waste too much time to keep word from text file.