Skip to content
Neo4j Triggers on Steroids
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src fixed queries loader Feb 2, 2019
.gitignore initial commit Jan 29, 2019
.travis.settings.xml initial commit Jan 29, 2019
.travis.yml Update copyright, move to openjdk8, upgrade to 3.5.5 Jun 29, 2019 prepare for 3.5.6 Jul 19, 2019
gpl.txt initial commit Jan 29, 2019
pom.xml [maven-release-plugin] prepare for next development iteration Jul 19, 2019

GraphAware Neo4j Triggers


Build Status | Products | Downloads | Javadoc | Latest Release:

GraphAware Triggers is a simple library that automatically executes defined Cypher statements during Transaction Events.


Download the following two .jar files and install them in the plugins directory of your Neo4j installation

Make sure to download the versions that are compatible with your Neo4j installation, for example the Triggers Module in version is compatible with Neo4j 3.5.4 and the framework, the last bit specifies the version of the module itself.

Next, add the following configuration in your neo4j.conf file to register the Triggers module:


# TR becomes the module ID (you will need to use this ID in other config below):
# Where the trigger file is located, full path or path relative to the /conf directory of Neo4j

Using GraphAware Triggers

The triggers are defined in a simple JSON file, for example :

  "nodes_created": [
      "condition": "hasLabel('Document')",
      "statement": "MATCH (n) WHERE id(n) = $id SET n.createdAt = timestamp()"
      "condition": "hasLabel('NE_Company')",
      "statement": "MATCH (n) WHERE id(n) = $id MERGE (e:Entity:Company {value: n.value}) MERGE (n)-[:REFERS_TO]->(e)"
  "relationships_created": [
      "condition": "isType('FATHER_OF')",
      "statement": "MATCH (from)-[r]->(to) WHERE id(r) = $id MERGE (to)-[:CHILD_OF]->(from)"
  "relationships_updated": [
      "condition": "isType('SIMILAR_TO') && hasProperty('relevance')",
      "statement": "MATCH (from)-[r]->(to) WHERE id(r) = $id MATCH (to)<-[sim:SIMILAR_TO]-(conn) WITH to, sum(r.relevance) AS total SET to.totalInfluence = total"

The definitions file lets you define for which events, with which condition a trigger will occur, and the Cypher statement the trigger will execute.

Automatically, the graph object ID of the transaction element, a node or a relationship, is given as the id parameter to the statement.

The different events currently supported are

  • nodes_created
  • nodes_updated
  • nodes_deleted
  • relationships_created
  • relationships_updated
  • relationships_deleted

The Expressions for the condition follow the conditions available in the [GraphAware Common Inclusion Policies](

Reloading the definition

While the database is running, you can change your JSON file and reload the definiton with the following procedure :

CALL ga.triggers.reload()

Using query files

Writing a long cypher query on a single line for complying with the JSON specification can be cumbersome. That's why we allow users to write their queries in distinct .cypher or .cyp files and reference them in the definition.

For example, with the following file structure of neo4j :

    - bin /
    - certificates /
    - conf /
        - neo4j.conf
        - triggers.json
        - queries /
            - add-type-as-label.cypher

And the content of add-type-as-label.cypher being :

CALL apoc.create.addLabels(id(n), [n.type])
YIELD node RETURN node

You can use the query written in this file in your triggers.json definition as follows :

  "nodes_created": [
      "condition": "hasLabel('Node')",
      "namedQuery": "add-type-as-label"

You will need to specify the directory holding the queries by adding the following line to your Neo4j configuration :


Note on Versioning Scheme

The version number has two parts. The first four numbers indicate compatibility with Neo4j GraphAware Framework. The last number is the version of the Triggers library. For example, version is version 1 of the Triggers library compatible with GraphAware Neo4j Framework


Copyright (c) 2013-2019 GraphAware

GraphAware is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see

You can’t perform that action at this time.