Neo4jQuery

Labels: :IA_Function:IA_Neo4jQuery
Inherits from: Function

The Neo4jQuery executes a Cypher statement and returns its results.

Properties

Key Description Default value Possible values
autoComplete The result will contain all relationships between the returned nodes (even if the cypher query does not return them) false true | false
cypher The Cypher statement that has to be executed. any valid Cypher
name The name of the Function. Neo4jQuery
params.{myParameter} Parameters that are to be passed to the Cypher statement. a literal value
process Determines whether the query result should be processed to a nodes and relations. false true|false 0|1
store The Neo4j graph store against which the cypher statement is to be executed. application name of a configured Neo4j store

All properties can also be passed as parameters via an incoming trigger. To do so, include a property key on the incoming trigger with a $ or # as a prefix.


Outgoing triggers

Type: success

Occurrence: when the Neo4jQuery function executes successfully,.

Additional event properties (besides the inherited properties):

Key Description Possible values
data array of data as it is returned by Neo4j array
processed data after processing in case process: true object
processed.labels all node labels in the results array of strings
processed.nodes all nodes in the result array of nodes
processed.relations all relationships in the result array of relations
processed.reltypes all relation types array of strings
processed.private number of nodes /relations not being transferred to client integer
meta meta information object
meta.autoComplete autoComplete flag status boolean
meta.columns array of columns returned in result array of strings
meta.cypher Cypher statement string
meta.memory memory used in bytes integer
meta.nodecount count of nodes returned integer
meta.params parameters and values used in the cypher query object
meta.processData status of processData flag integer
meta.relcount count of relations returned integer
meta.status true if Cypher executed successfully boolean
meta.store store against which the Cypher was executed string
meta.stats Neo4j query stats object
meta.timing timing of query in ms object
meta.timing.data Time to retrieve data from Neo4j integer
meta.timing.processing Time to process data into processed integer
meta.timing.total Total time to retrieve and process data integer

Example

Imagine the following interaction graph:

NetworkView example

When you run this example, the MyQuery1 returns a list of labels and counts in MyTable1. When you click on a row with a count < 5, it displays the nodes in MyNetworkView. Otherwise, a list of names is displayed in MyTable2.

The first IA:Neo4jQuery node MyQuery1, has a type:success trigger that tp the IA:TableView node MyTable1. The trigger maps the (%).data element of the event data of the success event to the #data property of MyTable1.

MyTable1 has a type:rowClick trigger to a IA:Neo4jQuery MyQuery2. This tigger maps the (%).data.label element of the event data of the rowclick event to the $params.selectedLabel property of MyQuery2.

MyQuery2 takes $params.selectedLabel as parameter for the statement in the cypher property.

When MyQuery2 executes successfully, the success event occurs. To determine which triggers should be executed, the matching criteria on the outgoing [:TRIGGER] relations are considered:

  • (%).data[0].destination
  • type

One trigger executes when type:success AND (%).data[0].destination:NetworkView . This trigger maps (%).processed.nodes and (%).processed.relations to the #nodes and relations properties of the IA_NetworkView MyNetworkView.

The other trigger executes when type:success AND (%).data[0].destination:TableView . This trigger maps (%).data[#].name to #data property of the IA_TableView MyTable2.