GraphQl with Neo4j

4 years ago, January 30, 2020
Reading time: 1 mins

Javascript

const CREATE_PROCESS_INSTANCE = gql` mutationCreateProcessInstance($label: String!) { CreateProcessInstance(label: $label) { id label } 
} `; 

const ADD_PROCESS_INSTANCE_INSTANCE_OF = gql` mutationAddProcessInstanceInstanceOf( $from: _ProcessInstanceInput! $to: _ProcessInput! ) { 
 AddProcessInstanceInstanceOf(from: $from, to: $to) { 
from { label } to { label } 
} 
} `;

Cypher query

MATCH 
(process:Process {id: 'inv-ordering-prcs'})-[:hasInitState]->(initState) 
CREATE (processInstance:ProcessInstance {id: 'xxx', label: '$label'}) 
CREATE (initStateInstance:StateInstance {label: 'new-request', description: '$description'}) 
CREATE (processInstance)-[:instanceOf]->(process) 
CREATE (initStateInstance)-[:instanceOf]->(initState) 
CREATE (processInstance)-[:hasInitStateInstance]->(initStateInstance) 
CREATE (processInstance)-[:currentStateInstance]->(initStateInstance) 
return processInstance
On your JavaScript file..
const CREATE_PROCESS_INSTANCE = gql` mutation CreateProcessInstance($label: String!, instanceOf: ID!, description: String!) { CreateProcessInstance(label: $label, instanceOf: $instanceOf, description: $description) { id label } } `;
Previous
Docker compose update php.ini
Next
Is the moon moving with you, when you are moving?
© 2024 Anil Maharjan