Created
September 14, 2018 10:51
-
-
Save sorsaffari/80273905e71b6e5d5f1815c32cee322a to your computer and use it in GitHub Desktop.
Phone Calls | Loading Data: template to construct insert query for a call
This file contains hidden or 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
function callTemplate(call) { | |
const { caller_id, callee_id, started_at, duration } = call; | |
// match caller | |
let graqlInsertQuery = `match $caller isa person has phone-number "${caller_id}"; `; | |
// match callee | |
graqlInsertQuery += `$callee isa person has phone-number "${callee_id}"; `; | |
// insert call | |
graqlInsertQuery += `insert $call(caller: $caller, callee: $callee) isa call; $call has started-at ${started_at}; $call has duration ${duration};`; | |
return graqlInsertQuery; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment