我正在建立一个reccomendation搜索查询在cypher我已经产生了以下:
LOAD CSV WITH HEADERS FROM "file:///restaurant_data.csv" AS data
MERGE(n1:Customer{Name:data.Name, Latitude:toFloat(data.Latitude),Longitude:toFloat(data.Longitude)})
MERGE(n2:Orders{OrderId:data.Order_ID,OrderTimestamp:data.Order_ts,FoodName:data.Food_Item})
MERGE(n3:Restaurant{RestaurantName:data.Restaurant, RestLat:toFloat(data.Rest_lat), RestLong:toFloat(data.Rest_long)})
MERGE (n1)-[r1:PLACES_ORDER]->(n2)
MERGE (n2)-[r2:BELONGS_TO]->(n3)
MERGE (n3)-[r3:SERVES]->(n2)
RETURN *;
MATCH(n1:Customer{Name:"Angy"})-[:PLACES_ORDER]->(n2:Orders)<-[:SERVES]-(r:Restaurant)
WITH n2 ORDER BY n2.OrderTimestamp DESC LIMIT 5
WITH collect(distinct n2) as orders
MATCH (r:Restaurant) WHERE ALL(order in orders WHERE EXISTS((r)-[:SERVES]->(order)))
RETURN DISTINCT r.RestaurantName
我想找到ANGY的最后5个订单,并给予她推荐提供该订单的餐厅。然而,上面的查询返回no matches no records
我哪里出错了?请帮助!!!我是NEO4J的新手
1条答案
按热度按时间watbbzwu1#
最后这对我有用。