Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-31-2019 04:44 PM
Hi, im trying to get products where there is a HasHolding relationship then traverse up all products where IsNewEditionOf relationship until I get to the end node and just return the end nodes
in the image layout id only want chart 1 edition 3 and chart 3 edition 4 returned, I can return all editions after the has holding relationship with MATCH (v:VesselTest{name:"Jolly Roger"})-[:HasHolding]->(holding:ProductTest)<-[:IsNewEditionOf*]-(t) return t
I cant seem to narrow it down to getting the last node.
regards
Solved! Go to Solution.
02-01-2019 06:55 AM
You might also try asserting an extra condition on the tail nodes, something like this:
MATCH (v:VesselTest{name:"Jolly Roger"})-[:HasHolding]->(holding:ProductTest)<-[:IsNewEditionOf*]-(t)
WHERE NOT (t)<-[:IsNewEditionOf]-(somethingElse)
RETURN t;
This would give you the leaves and eliminate the intermediates.
02-01-2019 04:08 AM
Hi, I ended up doing it this way MATCH (v:VesselTest{name:"Jolly Roger"})-[:HasHolding]->(holding:ProductTest)<-[:IsNewEditionOf*]-(t) WITH holding, tail(collect(t)) AS latesteditions return latesteditions
this gives me the result I expect.
02-01-2019 06:55 AM
You might also try asserting an extra condition on the tail nodes, something like this:
MATCH (v:VesselTest{name:"Jolly Roger"})-[:HasHolding]->(holding:ProductTest)<-[:IsNewEditionOf*]-(t)
WHERE NOT (t)<-[:IsNewEditionOf]-(somethingElse)
RETURN t;
This would give you the leaves and eliminate the intermediates.
All the sessions of the conference are now available online