Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Neo4j

You're reading from   Learning Neo4j Run blazingly fast queries on complex graph datasets with the power of the Neo4j graph database

Arrow left icon
Product type Paperback
Published in Aug 2014
Publisher
ISBN-13 9781849517164
Length 222 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Rik Van Bruggen Rik Van Bruggen
Author Profile Icon Rik Van Bruggen
Rik Van Bruggen
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Graphs and Graph Theory – an Introduction FREE CHAPTER 2. Graph Databases – Overview 3. Getting Started with Neo4j 4. Modeling Data for Neo4j 5. Importing Data into Neo4j 6. Use Case Example – Recommendations 7. Use Case Example – Impact Analysis and Simulation 8. Visualizations for Neo4j 9. Other Tools Related to Neo4j A. Where to Find More Information Related to Neo4j B. Getting Started with Cypher Index

Specific query examples for recommendations


In this example dataset, we are going to explore a couple of interesting queries that would allow us—with the information that is available to us—to construct interesting recommendations for our hypothetical users. We will do so along different axes:

  • Product purchases

  • Brand loyalty

  • Social and/or family ties

Let's start with the first and work our way through.

Recommendations based on product purchases

Let's build this thing from the ground up. The first query we want to write is based on past purchasing behavior. We would like to find people that already share a couple of products that they have purchased in the past, but that also explicitly do not share a number of other products. In our data model, this Cypher query would go something like this:

match (p1:Person)-[:BOUGHT]->(prod1:Product)<-[:BOUGHT]-(p2:Person)-[:BOUGHT]->(prod2:Product)
where not(p1-[:BOUGHT]->prod2)
return p1.name as FirstPerson, p2.name as SecondPerson, prod1.name as...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime