Neo4j 3.0 introduced the concept of Stored Procedures, now, whilst they’re not the same as SQL based SPs, they work – and well – it’s what we’ve got!
Neo4jClient doesn’t currently have any native way to call a Stored Proc, so to get you there in the interim, we’ll use the ‘apoc.create.uuids’ proc – which returns a GUID (or multiples) and uses both the CALL and YIELD keywords.
(Sorry for lack of code highlighting….)
var gc = new GraphClient(new Uri("http://localhost:7474/db/data"));
gc.Connect();
IRawGraphClient rgc = gc;
var queryText = "CALL apoc.create.uuids(2) YIELD uuid";
var query = new CypherQuery(queryText, null, CypherResultMode.Projection);
var results = rgc.ExecuteGetCypherResults<Result>(query);
foreach (var result in results)
{
Console.WriteLine(result.uuid);
}
Using a ‘Result’ class which looks like:
public class Result
{
public Guid uuid { get; set;}
}
So, try similar approaches with other stored procs!
Obviously, the ideal will be something like gc.Call(“spName”).Yield<T>(“propertyNames”)