Does neo4j have a "trigger" mechanism via Cypher? (similar to percolators in ElasticSearch)

Update

The answer below was accurate in 2014. It's mostly accurate in 2018.

But now there is a way of implementing triggers in Neo4j provided by Max DeMarzi which is pretty good, and will get the job done.

Original answer below.

No, it doesn't.

You might be able to get something similar to what you want by using a TransactionEventHandler object, which basically lets you bind a piece of code (in java) to the processing of a transaction.

I'd be really careful with running cypher in this context though. Depending on what kind of matching you want to do, you could really slaughter performance by running that each time new data is created in the graph. Usually triggers in an RDBMS are specific to inserts or updates on a particular table. In Neo4J, the closest equivalent you might have is on creating/modifying a node of a certain type of label. If your app has any number of different node classes, it wouldn't make sense to run your trigger code whenever new relationships/nodes are created, because most of the time the node type probably wouldn't be relevant to the trigger code.

Related reading: Do graph databases support triggers? and a feature request for triggers in neo4j

Tags:

Neo4J

Cypher