Last active
July 11, 2016 12:34
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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