In this recipe, you will learn how to model retail data using Neo4j.
Install the Neo4j graph database over the host machine using the recipe described in Chapter 1, Getting Started with Neo4j. This installation process will depend on your preference for your machine OS type.
Let's model this data to build a retail insight engine:
Customer – [HAVE] – Location Customer – [BUYS] – Product[s] Product – [HAVE] – Categories Customer-[LOOKS]- Product[s]
The following screenshot shows the retail graph modeling:
Let's answer some questions on the basis of our retail graph, which are as follows:
The day on which there is the highest sale of wine: Let's find out on which day there is the highest sale of wine. In this, we will also make use of an aggregated model, where the given dates will be aggregated on the basis of days, as follows:
MATCH (p:Product{name:"perfume"})-[r:SOLD_ON]->(d:date)<-[X:DAY_OF_WEEK]-(w:Weekday) RETURN w, count(r)...