Skip to content

Instantly share code, notes, and snippets.

@dawngerpony
Last active July 11, 2016 12:34
Show Gist options
  • Save dawngerpony/fbb2076c3bb41e0265460382975d88cc to your computer and use it in GitHub Desktop.
Save dawngerpony/fbb2076c3bb41e0265460382975d88cc to your computer and use it in GitHub Desktop.
Python code to print out a Cypher statement (or set of statements) to make changes to a neo4j database for adding UPPIdentifier nodes.
letters = "0123456789abcdef"
s = ""
for c in letters:
s += "\"{}\",".format(c)
letters = s.strip(',')
statement = """WITH [{}] AS letters
UNWIND letters as l
MATCH (o:Organisation)
WHERE o.uuid STARTS WITH l
MERGE (indent:Identifier:UPPIdentifier{{value:o.uuid}})-[:IDENTIFIES]->(o)
RETURN count(indent)
""".format(letters)
print statement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment