===== Beyond the Semantic Web ===== * Last verification: **20230111** * Tools required for this lab: * [[https://sandbox.neo4j.com/|Neo4j Sandbox]] (for playing with Cypher) * [[https://countries.trevorblades.com/|The Countries playground]] (for playing with GraphQL) ==== Prepare yourself for the lab ==== * //Beyond the Semantic Web// lecture -- part about Cypher and GraphQL (slides are [[start#lectures|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 [[https://neo4j.com/developer/cypher/|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 [[https://countries.trevorblades.com/|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: [[https://graphql.org/learn/|Introduction to GraphQL]], [[https://graphql.org/learn/queries/|Queries and Mutations]] - But wait, how do one find out which fields are available in the dataset? * Use the [[https://graphql.org/learn/introspection/|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 [[https://github.com/mneedham/neo4j-got|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: * [[https://neo4j.com/developer/cypher/|Cypher documentation]] * [[https://neo4j.com/docs/cypher-cheat-sheet/current/|Cypher cheat-sheet]] * Tutorials: * [[https://github.com/mneedham/neo4j-got|neo4j-got]] -- to start it, enter '':play https://guides.neo4j.com/got_wwc'' in neo4j console * [[https://www.lyonwj.com/blog/graph-of-thrones-neo4j-social-network-analysis|Analyzing the Graph of Thrones]] -- to start it, enter '':play https://guides.neo4j.com/got'' in neo4j console === GraphQL === * [[https://graphql.org/learn/|GraphQL Tutorial]]