Skip to content

Instantly share code, notes, and snippets.

@Hkazanci93
Created November 18, 2021 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hkazanci93/ff2709e80093c7aee823a7badb9795c7 to your computer and use it in GitHub Desktop.
Save Hkazanci93/ff2709e80093c7aee823a7badb9795c7 to your computer and use it in GitHub Desktop.
MATCH (me:Person {userid:$userid}) ${categories
.map(
(cat, index) =>
'MERGE (cat' + index + ':Category {name: $cat' + index + '})'
)
.join(
' '
)}
MERGE (sentiment:Sentiment {name: $sentiment})
CREATE (me)-[:posted]->(post:Post {text:$text,created:$now})
MERGE (post)-[:hasSentiment]->(sentiment) ${categories
.map((cat, index) => 'MERGE (post)-[:inCategory]->(cat' + index + ')')
.join(' ')}
RETURN post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment