I have a sentence graph in neo4j and I would like to know how to do a complex query that would start and end with a node with the :WORD label and return a path between them.
The point is that I want it to have varying length and only return paths that goes through nodes with certain properties. I would like something like:
MATCH p=((p1:Word)-[r*0..4](***)-(p2:Word))
WHERE v:Variable {property = value}
RETURN p1,p2,p AS Path, length(p) AS PathSize
ORDER BY PathSize
***: Here I would like to name the nodes of the middle of the path as v and filter only the paths where the v's have a certain property. Does anyone knows how to do it?
Thank you!