This article is a part of a series intended to show how to use Memgraph on real-world data to retrieve some interesting and useful information.
We highly recommend checking out the other articles from this series which are listed in our tutorial overview section.
TED is a nonprofit organization devoted to spreading ideas, usually in the form of short, powerful talks. Today, TED talks are influential videos from expert speakers on almost all topics — from science to business to global issues. Here we present a small dataset which consists of 97 talks, show how to model this data as a graph and demonstrate a few example queries.
- Each TED talk has a main speaker, so we
identify two types of nodes —
- We add an edge of type
Gavepointing to a
Talkfrom its main
- Each speaker has a name so we can add property
- We'll add properties
- Each talk is given in a specific TED event, so we can
InEventbetween talk and event.
- Talks are tagged with keywords to facilitate searching, hence we
HasTagbetween talk and tag.
- Users give ratings to each talk by selecting up to three
predefined string values. Therefore we add node
Ratingwith these values as property
user_countbetween talk and rating nodes.
You have two options for exploring this dataset.
If you just want to take a look at the dataset and try out a few queries, open
Memgraph Playground and continue with
the tutorial there. Note that you will not be able to execute
On the other hand, if you would like to add changes to the dataset, download the
Memgraph Lab desktop application and navigate
Datasets tab in the sidebar. From there, choose the dataset
TED talks and continue with the tutorial.
In the queries below, we are using Cypher to query Memgraph via the console.
1) Find all talks given by specific speaker:
2) Find the top 20 speakers with most talks given:
3) Find talks related by tag to specific talk and count them:
4) Find 20 most frequently used tags:
5) Find 20 talks most rated as "Funny". If you want to query by other ratings, possible values are: Obnoxious, Jaw-dropping, OK, Persuasive, Beautiful, Confusing, Longwinded, Unconvincing, Fascinating, Ingenious, Courageous, Funny, Informative and Inspiring.
6) Find inspiring talks and their speakers from the field of technology:
7) Now let's see one real-world example — how to make a real-time recommendation. If you've just watched a talk from a certain speaker (e.g. Hans Rosling) you might be interested in finding more talks from the same speaker on a similar topic:
The following few queries are focused on extracting information about TED events.
8) Find how many talks were given per event:
9) Find the most popular tags in the specific event:
10) Discover which speakers participated in more than 2 events:
11) For each speaker search for other speakers that participated in same events: