Beyond the Semantic Web
- Last verification: 20230111
- Tools required for this lab:
- Neo4j Sandbox (for playing with Cypher)
- The Countries playground (for playing with GraphQL)
Prepare yourself for the lab
- Beyond the Semantic Web lecture – part about Cypher and GraphQL (slides are on the main page)
Lab instructions
1. Introduction to Cypher [45 minutes]
- We will explore the Movie Graph! with the Neo4j tools. First of all, follow one of the following links to create your own Movie Graph instance (there is a need to create an account):
- https://sandbox.neo4j.com/ (3-10 days projects)
- https://console.neo4j.io/ (1 small graph for free)
- If you are using sandbox, the Movie Graph is already loaded.
- If you are starting with blank project, first load the Movie Graph by putting
:play movie-graph
in the neo4j console
- Then explore the graph by creating the following queries in Cypher. If you need some help, take a look at the documentation.
- Select any 5 nodes
- Select any 5 relations
- Select subject, predicate and object for 5 triples
- Find one Person
- Find Person named 'Tom Hanks'
- Find movies in which Tom Hanks acted
- Find co-actors of Tom Hanks
- Find the path between the Tom Hanks and Meg Ryan
- Find title and release date of movies in which Tom Hanks acted (see Q6)
- Sort the movies (from Q9) by release date (descending order)
- Select only movies released in the 1990s (from Q10)
- Count these movies (from Q11)!
2. Introduction to GraphQL [35 minutes]
- Play with the Countries dataset in the playground using GraphQL
- First of all, run the default query (loaded when the playground starts)
- Do you understand it?
- Do you know how to get the data about Germany instead of Poland?
- If you need some help, use the docs: Introduction to GraphQL, Queries and Mutations
- But wait, how do one find out which fields are available in the dataset?
- Use the Introspection to query the schema to get the information about possible values for Country class!
3. The Graph of Thrones [any time]
- If you want to get to know the Cypher language better, check out this tutorial, which introduces a lot more elements of the language using the Game of Thrones graph as an example!
- To start the tutorial, simply enter
:play https://guides.neo4j.com/got_wwc
in neo4j console
Learn more!
Cypher
- Docs:
- Tutorials:
- neo4j-got – to start it, enter
:play https://guides.neo4j.com/got_wwc
in neo4j console - Analyzing the Graph of Thrones – to start it, enter
:play https://guides.neo4j.com/got
in neo4j console