Я хочу исключить те пути, которые не начинаются с "Media Topics", Name = "Media Topics" является свойством узла внутри языков.
Вот мой запрос
MATCH path = (top:Taxonomy)-[:IS_CHILD_OF*0..]->(taxo)
WHERE NOT ()-[:IS_CHILD_OF]->(top)
WITH DISTINCT [node in nodes(path) | [(language)-[:IN_LANGUAGE{lang:'en'}]->(node) | language][0]] as languages//chn
ORDER BY size(languages) DESC
return [n in reverse(languages) | n.name ] as nodesInPath
вот мой вывод
["Media Topic", "crime, law and justice", "judiciary", "court", "trial (court)", "sentencing (criminal)", "capital punishment"]
["Media Topic", "crime, law and justice", "judiciary", "court", "trial (court)", "sentencing (criminal)", "fine (penalty)"]
["Media Topic", "crime, law and justice", "judiciary", "court", "trial (court)", "sentencing (criminal)", "prison"]
["Media Topic", "crime, law and justice", "judiciary", "court", "trial (court)", "sentencing (criminal)", "court-ordered psychiatric treatment"]
["crime, law and justice", "judiciary", "court", "trial (court)", "pre-trial"]
Теперь последняя строка не должна печататься, так как она не начинается с "Media Topi c"