Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-18-2021 11:28 AM
I'm trying to go from product -> category then back down to products in the same category, and I can't for the life of me understand why this query isn't working.
Here's the data model I'm working off of. The names are scratched out and I've drawn some arrows to convey what I'm after:
This was the original query I ran:
MATCH (p:product {product_name: 'ANTHEM MAXX'})
MATCH (p)<-[*1]-(s:shelf)//-[*:hasname]->(rec:product)
MATCH (s)-[:hasName]->(rec:product)
RETURN rec
But I just get 'ANTHEM MAXX' returned. It's like there's some problem with the way I've specified the data model that ties shelf and product together too tightly.
This query did work:
MATCH (p:product {product_name: 'ANTHEM MAXX'})
MATCH (p)<-[:hasName]-(s:shelf)
MATCH (rec:product {gl_shelf: p.gl_shelf})
WHERE NOT rec.product_name = p.product_name
RETURN DISTINCT rec.product_name
But I want to understand where the earlier queries went wrong.
All the sessions of the conference are now available online