Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-15-2021 05:00 PM
is there a way to 'store' specific paths as variables / references?
e.g.
(a)-[R]->(b)-[S]->(z) is stored as path1 (rl example 'LA to New York via Atlanta')
(a)-[T]->(c)-[U]->(w)-[V]->(z) is stored as path2 (rl example 'LA to New York via Dallas and Miami')
This example (just like my use case) the same 'origin' / 'destination' can have multiple 'valid' paths, but it's vital to detail the exact path that particular use-case takes.
Having these alternative paths stored against variable names for easy referencing querying etc.
Even if stored as a json doc or anything - or can be stored directly into the database somehow?
(am struggling with google / searching due to difficult / overlapping terminology here)
Many thanks
09-22-2021 10:52 AM
Cypher supports storing specific paths in a variable like this
MATCH p=(a)-[R]->(b)-[S]->(z)
RETURN p
The path(s) returned by the search are stored in the variable p.
You mentioned 'specific path' but I suspect by your example that you might be looking for a way to store the 'path search pattern'? Like an alias I guess? Where are you running this query? In Neo4j Desktop? Saving cypher is easy to do in application code, the cypher is just a string.
09-22-2021 04:06 PM
Here is one solution that I provided in an earlier post. Check this:
All the sessions of the conference are now available online