Created
October 21, 2021 18:38
-
-
Save monapasan/ade6750e6a5fc0ce457a852043e28aa5 to your computer and use it in GitHub Desktop.
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
async function exportContexts(savedContexts) { | |
// Iterate through every user | |
for (let user in savedContexts) { | |
// Iterate through every context of that user | |
for (let i = 0; i < savedContexts[user].length; i++) { | |
let contextname = savedContexts[user][i]; | |
// Generate a Cypher statement to return the username, the context name and the statement text | |
let statement = | |
"MATCH (u:User{name:'" + | |
user + | |
"'})<-[:BY]-(c:Context{name:'" + | |
contextname + | |
"'})<-[:IN]-(s:Statement) return u.name as username, c.name as context, s.text as statement;"; | |
// TODO at this point we can also create the user in PostgreSQL | |
// QUESTION OLEG how to make this cycle continue iterating ONLY if the function below is executed? | |
await exportStatements(statement); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment