Take for the Game of Throne sandbox for example, I want return a list of Characters with their name, alligance if any, killed in which episode if valid, and who killed this Charater if valid. I can get alligance from LOYAL_TO relationship, and I can get killed in which episode via VICTIM_IN and HAPPENED_IN relationship, and killer name via VICTIM_IN and KILLER_IN relationship.
Can someone help me to know which capabilities I should use in Memgraph to achieve this? I can do this in neo4j via pattern match in RETURN clause
What we actually need is the capability of pattern comprehension capability in return cluase in neo4j 3.2 ( What is pattern comprehension and custom projection in neo4j cypher)
The cypher you provided during our last call works in the GoT Death scenarios, but doesn't work in our real like scenarios
EXPLAIN MATCH (c:Character)-[:LOYAL_TO]->(a:Allegiance)
OPTIONAL MATCH (c)-[:VICTIM_IN]->(d:Death)-[:HAPPENED_IN]->(e:Episode),(d)<-[:KILLER_IN]-(killer:Character)
RETURN c.name AS character_name, a.name AS allegiance_name, collect(DISTINCT e.name) AS episode_names, collect(DISTINCT killer.name) AS killer_names;
Because this requires both two path in OPTIONAL MATCH succeeded, and we can get additional info d,e,killer. When oen path doesn't match any thing, say if Death doesn't have a killer for data quality reason, then I can not get the episode info which actually exists.
p.s it seems that this capability of using two path in OPTIONAL MATCH has been documented yet.
Another way to solve our issue is to use MAGE neighours.at_hop capability, we are still trying to modify the source code, like you suggested.