Hi,

I'm a few weeks into the wonderful world of Neo4j and am starting to write 
somewhat more ambitious queries. I'm struggling with one such query that 
attempts to identify a set of customers C1 who do not own a product P1 but 
who do own a product P2 that is also owned by a set of customers C2 who own 
product P1. In other words I'm attempting to determine who is likely to 
purchase P1 by correlating sales histories.

Here is my query:

start
n=node:node_auto_index(sku="123456")
match 
  (p)-[:owns]->(n), 
  (p)-[:owns]->(product), 
  (product)-[:owned_by]->(p2)
  WHERE NOT((p2)-[:owns]->(n))
return p2.name
limit 5

Breaking this down (as I understand it):

* Given product having SKU 123456 (n=node:node_auto_index(sku="123456"))
* Retrieve a list of customers who own product 123456 ((p)-[:owns]->(n),)
* Retrieve a list of products owned by these customers 
((p)-[:owns]->(product),)
* Retrieve the customers who own any of these products 
((product)-[:owned_by]->(p2))
* But make sure this last set of customers do not own SKU 123456 (WHERE 
NOT((p2)-[:owns]->(n)))
* Return their names

Interestingly when I limit the results to say 5 I receive an instantaneous 
response but when I remove the limit I receive the dreaded "Unknown error" 
in the web console. A look at the logs indicates nothing (but perhaps I'm 
looking in the wrong place, again I'm a newbie).

My questions:

* Am I even going about this in the proper way?
* If the answer to my first question is yes, any idea why it fails when I 
remove the limit?

Thanks a million, I'm really loving Neo4j.

Jason

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to