Neo4j GraphDB Connection | How to invoke Delegate

Dear Devs, Dear Community & fellow Travellers,

I am currently working on a vvvv - Neo4j connector and Statement Library / Generator.
Neo4j is a Graph Database provider an i believe that there are endless application possibilities when used in vvvv gamma. Check out their website and docs if you haven’t already, even a noob like me could grasp the basic concepts of the query language “Cypher” in a couple of hours.

It comes with a c# driver on which is easy peasy to integrate: [NuGet Gallery | Neo4j.Driver 4.3.2](Neo4j Nuget)

Neo4j .NET

I currently run a neo4j instance on aws ec2 and have already successfully established connection out of vvvv gamma. There are three types of transactions you can perform which are:

  • Auto Commit Transactions
  • Transaction Functions
  • Explicit Transactions

I managed to get an Auto Commit Transaction going by following the example code:

public void AddPerson(string name) {
using (var session = Driver.Session()) 
session.Run("CREATE (a:Person {name: $name})", new {name});

and translating it into this:

I am now trying to use Transaction Functions as they provide more functionality and allow more complex Cipher statements.

The code example for this is the following:

public void AddPerson(string name)
using (var session = Driver.Session())
session.WriteTransaction(tx => tx.Run("CREATE (a:Person {name: $name})", new {name}));

I figuered that this would include delegates and i tinkered around a little but am stuck.
This is how far i came:

I tried different delegates/different output counts/ also the System Func`1 stuff, nothing works.
Is the delegate approach even correct? What am I doing worng?

Any help would be highly appreciated and i am looking forward to build some Cypher Statement helpers that would make live easier by the power of vvvv gamma!

Thank you for your time!

it looks correct, but you don’t need to invoke the delegate yourself, the WriteTransaction seems to do that for you. so directly connect the delegate to it’s input.


the easiest way is to start a link at the input for the delegate and then press middle click to create the delegate.

There are different overlaods of the WriteTransaction method:
you might need to chose another one that has the delegate input. in order to do that, double click the write WriteTransaction node and add the delegate input pin to the selection.

Hi Tonfilm,
Thanks! That helped a lot ! In addition I had to use Run(IStatementRunner) instead of Run(ISession) as the first one inherits from ITransaction.
Now multiple statements are transmitted without a problem.
Hope to see you at Schmiede!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.