Created
September 14, 2018 10:50
-
-
Save sorsaffari/0b4461cc6dd05e75e3ba3dc68b85cb10 to your computer and use it in GitHub Desktop.
Phone Calls | Loading Data: template to construct insert query for a contract
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 contractTemplate(contract) { | |
const { company_name, person_id } = contract; | |
// match company | |
let graqlInsertQuery = `match $company isa company has name "${company_name}"; `; | |
// match person | |
graqlInsertQuery += `$customer isa person has phone-number "${person_id}"; `; | |
// insert contract | |
graqlInsertQuery += | |
"insert (provider: $company, customer: $customer) isa contract;"; | |
return graqlInsertQuery; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment