Greetings All,
I'm new to the community and still wrapping my head around Cypher.
I'm playing with a sample dataset in the desktop app, and I want to match all nodes that are a certain distance away from a point, but I do not want to traverse over specific relationship types.
My attempted query is this:
MATCH (p:Program {name: 'Initial Program'})-[x*1..4]-(n)
WHERE NOT x.name = 'IMPLEMENTED_BY' OR x.name = 'CREATED_BY'
RETURN p, n
The CLI gives me this error:
Type mismatch: expected Map, Node, Relationship, Point, Duration, Date, Time, LocalTime, LocalDateTime or DateTime but was List<Relationship> (line 2, column 11 (offset: 67))
"WHERE NOT x.name = 'IMPLEMENTED_BY' OR x.name = 'CREATED_BY'"
I glean from this that the variable x
is not an instance of every relationship traversed, but a set of relationships needed to connect each set of matched nodes. This leads to a few different questions:
- How do I logically represent that I never want a single relationship to be of a single type?
- How do I optimize the query? For example - I may have a relationship I want to not traverse on the root node. If this relationship leads to a large set of nodes, the memory usage would be much larger if the traversal engine first matches all nodes, then filters nodes based on the set of relationships associated with each node versus understand the relationship constraint, testing it on each hop.
I spent time in Chapter 3 of the neo4j cypher manual, however I couldn't find an example of filtering off of relationships in a variable multiple traversal scenario.
Thanks ahead of time for patience with a beginner.