Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-20-2023 11:57 AM - edited 01-20-2023 12:04 PM
Hello. There is a graph.
create
(a:Node {title:"A", ordered:false, active: true}),
(aa:Node {title:"AA", ordered: true, active: true}),
(ab:Node {title:"AB", ordered: false, active: true}),
(ac:Node {title:"AC", ordered: false, active: false}),
(aaa:Node {title:"AAA", ordered: false, active: true}),
(aab:Node {title:"AAB", ordered: false, active: true}),
(aac:Node {title:"AAC", ordered: false, active: true}),
(a)-[:RELATED_WITH { order: 1 }]->(aa),
(a)-[:RELATED_WITH { order: 2 }]->(ab),
(a)-[:RELATED_WITH { order: 3 }]->(ac),
(aa)-[:RELATED_WITH{ order: 1 }]->(aaa),
(aa)-[:RELATED_WITH{ order: 2 }]->(aab),
(aa)-[:RELATED_WITH{ order: 3 }]->(aac)
return *;
For a given start node (for example "A"), I need to find all subnodes, but I can only go down to active nodes (active = true). Also, if a node has the "ordered = true" property set, then I only need to descend to the first active node.
For example, for the graph above, a subtree is expected to be found:
A --> AA -> AAA
|__-> AB
Please help me to make a select (match) query.
All the sessions of the conference are now available online