Skip to content

Instantly share code, notes, and snippets.

@johnymontana
Created December 21, 2018 05:21
Show Gist options
  • Save johnymontana/a669d4bf7e7c2725c6e810c87dbe0504 to your computer and use it in GitHub Desktop.
Save johnymontana/a669d4bf7e7c2725c6e810c87dbe0504 to your computer and use it in GitHub Desktop.
CALL apoc.load.json("file:///Users/lyonwj/Desktop/pull_requests_000001.json") YIELD value
MERGE (pr:PullRequest {url: value.url})
SET pr += value{created_at: DateTime(value.created_at), closed_at: DateTime(value.closed_at), merged_at: DateTime(value.merged_at), .title, .body }
MERGE (head:Repository {url: coalesce(value.head.repo,"")})
MERGE (head)<-[h:HEAD]-(pr)
SET h = {sha: value.head.sha, ref: value.head.ref}
MERGE (base:Repository {url: value.base.repo})
MERGE (base)<-[b:BASE]-(pr)
SET b = {sha: value.base.sha, ref: value.base.ref}
MERGE (u:User {url: value.user})
MERGE (u)-[:OPENS]->(pr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment