How to return object from user-defined Neo4j function -


i have complicated query this:

match path = allshortestpaths( ... ) path, reduce(x={             specificstamp: "",             specificcount: 0,             ...         },         r in relationships(path) |             case when ...                 {                     specificstamp: some-expr(x),                     specificcount: another-expr(x),                     ...                 }             ...             end         ) pobj order pobj.specificstamp, pobj.specificcount return head(collect(path)) path, pobj.specificstamp stamp, count(*) cnt order length(path), stamp 

the logic in real code more complex, including nested case , many complex duplicating expressions...

to simplify problem, better put reduce logic separate function. neo4j user defined functions can return single value.

which type of return value corresponds cypher expression: {specificstamp: "", specificcount: 0}?

may object? according documentation object means any type.

may map? map template? map<string,string> conflicts map<string,integer>

return map<string,integer> or map<string,object>

see valid types: https://neo4j.com/docs/developer-manual/current/extending-neo4j/cypher-functions/#writing-udf


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -