Querying a social website's data

Assume that you run a social networking website. On such a website, your users might be have "friendly" relations with other users. Besides, you have access to some data related to their behavior, such as information about what items they've bought from your website.

The goal of this recipe is to capture these relationships and behavior-related data, so that we are able to derive interesting facts out of them. As it turns out, it is possible in core.logic to specify facts that are relations between data and to query these relations in goals.

In the following section, we will answer the questions: who are a given user's friends? Who is reachable from a user's network? What did someone's friend buy? You'll even see ...

Get Clojure Data Structures and Algorithms Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.