(c:Customer)-[:ordered]->(p:Product)-[:category]->(:Category)
Now, say that there are 2:
c-[:ordered]->(:Product { name: "pants", quantity: 10})
c-[:ordered]->(:Product { name: "shirt", quantity: 5})
Now, say that if I only want to cross the category relationship if the p.quantity > 6
In the most basic way, I would do:
(c:Customer)-[:ordered]->(p:Product)-[:category]->(cat:Category)
WHERE p.quantity > 6
However, I figured that maybe neo4j would (non-optimally) traverse the entire path _then_ filter where on top of the path.
So what I did was:
MATCH (c:Customer)-[:ordered]->(p:Product)
WHERE p.quantity > 6
WITH p
MATCH p-[:category]->(cat:Category)
This, I figured, would then allow neo4j to cross out to all the product nodes, as I would need them anyway in order to filter out the ones which have a quantity of less than 6.
Now... finally to my question.
The following URL:
http://docs.neo4j.org/chunked/stable/query-match.html
states that:WHERE defines the MATCH patterns in more detail. The predicates are part of the pattern description, not a filter applied after the matching is done.
So, my question is, if the predicates (specifically p.quantity > 6) are part of the pattern description, and _not_ applied _after_ matching (therefore applied before or during), then cutting the query with the WITHs would be a moot point
So, I would think that
(c:Customer)-[:ordered]->(p:Product)-[:category]->(cat:Category)
WHERE p.quantity > 6
--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
neo4j-browser, version: 2.0.0
--
You received this message because you are subscribed to a topic in the Google Groups "Neo4j" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/neo4j/sPUjrAoJwyY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to neo4j+un...@googlegroups.com.