Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-27-2020 12:42 AM
I am using neo4j 3.5.12 Community version
We need to store logical expression in a property & execute it in run time.
if ( a> 5 & b >6)
{
return 'open'
}
What would be the best way to do in neo4j.
Thanks,
A.Anitha
Solved! Go to Solution.
03-27-2020 07:38 PM
You may want to review Max De Marzi's blog entry on decision trees, that sounds similar to what you're working with.
03-27-2020 01:52 AM
Hi @anuvisha,
Welcome to the community. you can try below
return case when ( 5> 5 and 7 >6) then 'Open' else 'Close' end
03-27-2020 07:38 PM
You may want to review Max De Marzi's blog entry on decision trees, that sounds similar to what you're working with.
03-27-2020 07:43 PM
Does the returned value need to be part of what's stored, or can that be independent of it? You may be able to use apoc.cypher.run() from APOC Procedures to help, though either the entire expression would need to be valid CYPHER (a RETURN CASE WHEN ...
type of query), or if you are only storing the a> 5 & b >6
, then you'll need to supply the Cypher that will use that in a similar query.
Be aware that this type of dynamic query string generation does risk Cypher injection, so make sure you've vetted and cleaned the properties such that it can't escape intended usage and execute arbitrary Cypher.
03-29-2020 08:36 PM
Thanks Andrew.
The return value can be independent of whats stored. It can come through a API the whole expression is dynamic set through an User Interface.
All the sessions of the conference are now available online