Skip to content

Instantly share code, notes, and snippets.

@sorsaffari
Created September 14, 2018 10:51
Show Gist options
  • Save sorsaffari/80273905e71b6e5d5f1815c32cee322a to your computer and use it in GitHub Desktop.
Save sorsaffari/80273905e71b6e5d5f1815c32cee322a to your computer and use it in GitHub Desktop.
Phone Calls | Loading Data: template to construct insert query for a call
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