UNPKG

graphdb-workbench-tests

Version:
765 lines (764 loc) 45.2 kB
[ { "guideName": { "en": "1 The Star Wars guide", "fr": "⚒Le guide sur Star Wars" }, "guideDescription": { "en": "The Star Wars guide is a beginner's guide showing repository creation, importing RDF data from a file, starting to explore data from the visual graph, and executing SPARQL queries. It takes approximately 30 minutes to complete.", "fr": "⚒Un guide de base montrant la création de répertoire, l'importation de RDF à partir d'un fichier, un graphique visuel et certaines requêtes SPARQL." }, "guideLevel": 0, "guideOrder": 1, "options": { "repositoryIdBase": "starwars" }, "steps": [ { "guideBlockName": "welcome" }, { "guideBlockName": "create-repository" }, { "guideBlockName": "select-repository-dropdown" }, { "guideBlockName": "enable-autocomplete" }, { "guideBlockName": "import-rdf-file", "options": { "resourcePath": "starwars", "resourceFile": "starwars.ttl" } }, { "guideBlockName": "visual-graph", "options": { "easyGraphInputText": "lu", "iri": "https://swapi.co/resource/human/1", "iriLabel": "Luke Skywalker" } }, { "guideBlockName": "visual-graph-node-focus", "options": { "iri": "https://swapi.co/resource/human/1", "iriLabel": "Luke Skywalker" } }, { "guideBlockName": "visual-graph-link-focus", "options": { "fromIri": "https://swapi.co/resource/human/1", "fromIriLabel": "Luke Skywalker", "toIri": "https://swapi.co/vocabulary/Character", "toIriLabel": "Character", "iriLabel": "type", "extraContent": { "en": "This tells us that one of the RDF types for <b>{{fromIriLabel}}</b> is <b>{{toIriLabel}}</b>.", "fr": "⚒Cela nous indique que l'un des types RDF pour <b>{{fromIriLabel}}</b> est <b>{{toIriLabel}}</b>." } } }, { "guideBlockName": "visual-graph-node-focus", "options": { "iri": "https://swapi.co/vocabulary/Mammal", "iriLabel": "Mammal", "content": "", "extraContent": { "en": "<b>{{iriLabel}}</b> is another RDF type for <b>Luke Skywalker</b>.", "fr": "⚒<b>{{iriLabel}}</b> est un autre type RDF pour <b>Luke Skywalker</b>." } } }, { "guideBlockName": "visual-graph-link-focus", "options": { "fromIri": "https://swapi.co/resource/human/1", "fromIriLabel": "Luke Skywalker", "toIri": "https://swapi.co/resource/vehicle/14", "toIriLabel": "Snowspeeder", "iriLabel": "vehicle", "content": "", "extraContent": { "en": "This connection tells us that <b>{{fromIriLabel}}</b> has a <b>{{iriLabel}}</b> called <b>{{toIriLabel}}</b>. In addition, it shows the reverse relation <b>pilot</b>, which links <b>{{toIriLabel}}</b> to <b>{{fromIriLabel}}</b>.", "fr": "⚒Cette connexion nous indique que <b>{{fromIriLabel}}</b> a un <b>{{iriLabel}}</b> appelé <b>{{toIriLabel}}</b>. De plus, il montre la relation inverse <b>pilot</b>, qui relie <b>{{toIriLabel}}</b> à <b>{{fromIriLabel}}</b>." } } }, { "guideBlockName": "visual-graph-node-focus", "options": { "fromIriLabel": "Luke Skywalker", "iri": "https://swapi.co/resource/vehicle/30", "iriLabel": "Imperial Speeder Bike", "content": "", "extraContent": { "en": "<b>{{fromIriLabel}}</b> has another <b>vehicle</b> called <b>{{iriLabel}}</b>. Again, the reverse relation <b>pilot</b> links <b>{{iriLabel}}</b> to <b>{{fromIriLabel}}</b>.", "fr": "⚒<b>{{fromIriLabel}}</b> a un autre <b>vehicle</b> appelé <b>{{iriLabel}}</b>. Encore une fois, la relation inverse <b>pilot</b> relie <b>{{iriLabel}}</b> à <b>{{fromIriLabel}}</b>." } } }, { "guideBlockName": "visual-graph-properties", "options": { "iri": "https://swapi.co/resource/film/1", "iriLabel": "A New Hope", "focusProperties": [ { "property": "types", "message": { "en": "We can see that <b>{{iriLabel}}</b> has a single type, <b>voc:Film</b>.", "fr": "⚒Nous pouvons voir que <b>{{iriLabel}}</b> a un seul type, <b>voc:Film</b>." } }, { "property": "voc:releaseDate", "message": { "en": "This shows the actual release date of <b>{{iriLabel}}</b>." } }, { "property": "voc:episodeId", "skipGenericMessage": true, "message": { "en": "The property <b>voc:episodeId</b> tells us that <b>{{iriLabel}}</b> was envisioned as the 4th movie in the series, even though it was the first to be released in 1977." } } ] } }, { "guideBlockName": "visual-graph-expand", "options": { "iri": "https://swapi.co/resource/film/1", "iriLabel": "A New Hope" } }, { "guideBlockName": "visual-graph-node-focus", "options": { "iri": "https://swapi.co/resource/droid/2", "iriLabel": "C-3PO", "content": "", "extraContent": { "en": "Node expansion enriches the graph by showing nodes connected to the expanded node, such as the character <b>{{iriLabel}}</b>.", "fr": "⚒L'expansion des nœuds enrichit le graphique en montrant les nœuds connectés au nœud étendu, comme le caractère <b>{{iriLabel}}</b>." } } }, { "guideBlockName": "visual-graph-node-focus", "options": { "iri": "https://swapi.co/resource/planet/1", "iriLabel": "Tatooine", "content": "", "extraContent": { "en": "The planet <b>{{iriLabel}}</b>, which was already shown before expanding, is now linked to both <b>Luke Skywalker</b> and <b>A New Hope</b>.", "fr": "⚒La planète <b>{{iriLabel}}</b>, qui était déjà montrée avant de s'agrandir, est maintenant liée à la fois à <b>Luke Skywalker</b> et à <b>A New Hope</b>." } } }, { "guideBlockName": "execute-sparql-query", "options": { "queries": [ { "query": "SELECT * {\n <https://swapi.co/resource/human/1> ?p ?o\n}\n", "queryExtraContent": { "en": "The query selects RDF statements whose <i>subject</i> is <b>Luke Skywalker</b> (identified by the IRI <b>https://swapi.co/resource/human/1</b>).", "fr": "⚒La requête sélectionne les déclarations RDF dont le <i>sujet</i> est <b>Luke Skywalker</b> (identifié par l'IRI <b>https://swapi.co/resource/human/1</b> )." }, "resultExtraContent": { "en": "The variables <b>?p</b> and <b>?o</b> correspond to the <i>predicate</i> and <i>object</i> of the RDF statements.", "fr": "⚒Les variables <b>?p</b> et <b>?o</b> correspondent au <i>prédicat</i> et à l'<i>objet</i> des déclarations RDF." } }, { "query": "PREFIX voc: <https://swapi.co/vocabulary/>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n\nSELECT * {\n <https://swapi.co/resource/human/1> voc:film ?movie .\n ?movie rdfs:label ?movieName .\n}\n", "queryExtraContent": { "en": "The query selects all movies where <b>Luke Skywalker</b> is one of the characters and illustrates the simplest SPARQL join, using the same variable <b>?movie</b> in two different statement patterns.", "fr": "⚒La requête sélectionne tous les films où <b>Luke Skywalker</b> est l'un des personnages et illustre la jointure SPARQL la plus simple, en utilisant la même variable <b>?movie</b> dans deux modèles d'instructions différents." }, "resultExtraContent": { "en": "The variables <b>?movie</b> and <b>?movieName</b> contain each movie's IRI and name respectively.", "fr": "⚒Les variables <b>?movie</b> et <b>?movieName</b> contiennent respectivement l'IRI et le nom de chaque film." } }, { "query": "PREFIX voc: <https://swapi.co/vocabulary/>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n\nSELECT * {\n <https://swapi.co/resource/human/1> voc:film ?movie .\n ?movie rdfs:label ?movieName ;\n voc:releaseDate ?movieReleaseDate .\n} ORDER BY ?movieReleaseDate\n", "queryExtraContent": { "en": "The query builds upon the previous query but adds an additional join to fetch each movie's release date, and also sorting the results by the release date.", "fr": "⚒La requête s'appuie sur la requête précédente mais ajoute une jointure supplémentaire pour récupérer la date de sortie de chaque film, et également trier les résultats par date de sortie." }, "resultExtraContent": { "en": "The new variable <b>?movieReleaseDate</b> contains the release date and the results are sorted by it. We can clearly see that <b>A New Hope</b> was released first.", "fr": "⚒La nouvelle variable <b>?movieReleaseDate</b> contient la date de sortie et les résultats sont triés en fonction de celle-ci. Nous pouvons clairement voir que <b>A New Hope</b> est sorti en premier." } } ] } }, { "guideBlockName": "guide-end" } ] }, { "guideName": { "en": "2 The Star Wars guide User Interactive flow", "fr": "⚒Le guide sur Star Wars" }, "guideDescription": { "en": "The Star Wars guide is a beginner's guide showing repository creation, importing RDF data from a file, starting to explore data from the visual graph, and executing SPARQL queries. It takes approximately 30 minutes to complete.", "fr": "⚒Un guide de base montrant la création de répertoire, l'importation de RDF à partir d'un fichier, un graphique visuel et certaines requêtes SPARQL." }, "guideLevel": 0, "guideOrder": 1, "options": { "repositoryIdBase": "starwars-user-interactive" }, "steps": [ { "guideBlockName": "welcome" }, { "guideBlockName": "create-repository" }, { "guideBlockName": "select-repository-dropdown" }, { "guideBlockName": "enable-autocomplete" }, { "guideBlockName": "import-rdf-file", "options": { "resourcePath": "starwars", "resourceFile": "starwars-user-interactive.ttl" } }, { "guideBlockName": "visual-graph", "options": { "easyGraphInputText": "lu", "iri": "https://swapi.co/resource/human/1", "iriLabel": "Luke Skywalker" } }, { "guideBlockName": "visual-graph-node-focus", "options": { "iri": "https://swapi.co/resource/human/1", "iriLabel": "Luke Skywalker" } }, { "guideBlockName": "visual-graph-link-focus", "options": { "fromIri": "https://swapi.co/resource/human/1", "fromIriLabel": "Luke Skywalker", "toIri": "https://swapi.co/vocabulary/Character", "toIriLabel": "Character", "iriLabel": "type", "extraContent": { "en": "This tells us that one of the RDF types for <b>{{fromIriLabel}}</b> is <b>{{toIriLabel}}</b>.", "fr": "⚒Cela nous indique que l'un des types RDF pour <b>{{fromIriLabel}}</b> est <b>{{toIriLabel}}</b>." } } }, { "guideBlockName": "visual-graph-node-focus", "options": { "iri": "https://swapi.co/vocabulary/Mammal", "iriLabel": "Mammal", "content": "", "extraContent": { "en": "<b>{{iriLabel}}</b> is another RDF type for <b>Luke Skywalker</b>.", "fr": "⚒<b>{{iriLabel}}</b> est un autre type RDF pour <b>Luke Skywalker</b>." } } }, { "guideBlockName": "visual-graph-link-focus", "options": { "fromIri": "https://swapi.co/resource/human/1", "fromIriLabel": "Luke Skywalker", "toIri": "https://swapi.co/resource/vehicle/14", "toIriLabel": "Snowspeeder", "iriLabel": "vehicle", "content": "", "extraContent": { "en": "This connection tells us that <b>{{fromIriLabel}}</b> has a <b>{{iriLabel}}</b> called <b>{{toIriLabel}}</b>. In addition, it shows the reverse relation <b>pilot</b>, which links <b>{{toIriLabel}}</b> to <b>{{fromIriLabel}}</b>.", "fr": "⚒Cette connexion nous indique que <b>{{fromIriLabel}}</b> a un <b>{{iriLabel}}</b> appelé <b>{{toIriLabel}}</b>. De plus, il montre la relation inverse <b>pilot</b>, qui relie <b>{{toIriLabel}}</b> à <b>{{fromIriLabel}}</b>." } } }, { "guideBlockName": "visual-graph-node-focus", "options": { "fromIriLabel": "Luke Skywalker", "iri": "https://swapi.co/resource/vehicle/30", "iriLabel": "Imperial Speeder Bike", "content": "", "extraContent": { "en": "<b>{{fromIriLabel}}</b> has another <b>vehicle</b> called <b>{{iriLabel}}</b>. Again, the reverse relation <b>pilot</b> links <b>{{iriLabel}}</b> to <b>{{fromIriLabel}}</b>.", "fr": "⚒<b>{{fromIriLabel}}</b> a un autre <b>vehicle</b> appelé <b>{{iriLabel}}</b>. Encore une fois, la relation inverse <b>pilot</b> relie <b>{{iriLabel}}</b> à <b>{{fromIriLabel}}</b>." } } }, { "guideBlockName": "visual-graph-properties", "options": { "iri": "https://swapi.co/resource/film/1", "iriLabel": "A New Hope", "focusProperties": [ { "property": "types", "message": { "en": "We can see that <b>{{iriLabel}}</b> has a single type, <b>voc:Film</b>.", "fr": "⚒Nous pouvons voir que <b>{{iriLabel}}</b> a un seul type, <b>voc:Film</b>." } }, { "property": "voc:releaseDate", "message": { "en": "This shows the actual release date of <b>{{iriLabel}}</b>." } }, { "property": "voc:episodeId", "skipGenericMessage": true, "message": { "en": "The property <b>voc:episodeId</b> tells us that <b>{{iriLabel}}</b> was envisioned as the 4th movie in the series, even though it was the first to be released in 1977." } } ] } }, { "guideBlockName": "visual-graph-expand", "options": { "iri": "https://swapi.co/resource/film/1", "iriLabel": "A New Hope" } }, { "guideBlockName": "visual-graph-node-focus", "options": { "iri": "https://swapi.co/resource/droid/2", "iriLabel": "C-3PO", "content": "", "extraContent": { "en": "Node expansion enriches the graph by showing nodes connected to the expanded node, such as the character <b>{{iriLabel}}</b>.", "fr": "⚒L'expansion des nœuds enrichit le graphique en montrant les nœuds connectés au nœud étendu, comme le caractère <b>{{iriLabel}}</b>." } } }, { "guideBlockName": "visual-graph-node-focus", "options": { "iri": "https://swapi.co/resource/planet/1", "iriLabel": "Tatooine", "content": "", "extraContent": { "en": "The planet <b>{{iriLabel}}</b>, which was already shown before expanding, is now linked to both <b>Luke Skywalker</b> and <b>A New Hope</b>.", "fr": "⚒La planète <b>{{iriLabel}}</b>, qui était déjà montrée avant de s'agrandir, est maintenant liée à la fois à <b>Luke Skywalker</b> et à <b>A New Hope</b>." } } }, { "guideBlockName": "execute-sparql-query", "options": { "queries": [ { "query": "SELECT * {\n <https://swapi.co/resource/human/1> ?p ?o\n}\n", "queryExtraContent": { "en": "The query selects RDF statements whose <i>subject</i> is <b>Luke Skywalker</b> (identified by the IRI <b>https://swapi.co/resource/human/1</b>).", "fr": "⚒La requête sélectionne les déclarations RDF dont le <i>sujet</i> est <b>Luke Skywalker</b> (identifié par l'IRI <b>https://swapi.co/resource/human/1</b> )." }, "resultExtraContent": { "en": "The variables <b>?p</b> and <b>?o</b> correspond to the <i>predicate</i> and <i>object</i> of the RDF statements.", "fr": "⚒Les variables <b>?p</b> et <b>?o</b> correspondent au <i>prédicat</i> et à l'<i>objet</i> des déclarations RDF." } }, { "query": "PREFIX voc: <https://swapi.co/vocabulary/>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n\nSELECT * {\n <https://swapi.co/resource/human/1> voc:film ?movie .\n ?movie rdfs:label ?movieName .\n}\n", "queryExtraContent": { "en": "The query selects all movies where <b>Luke Skywalker</b> is one of the characters and illustrates the simplest SPARQL join, using the same variable <b>?movie</b> in two different statement patterns.", "fr": "⚒La requête sélectionne tous les films où <b>Luke Skywalker</b> est l'un des personnages et illustre la jointure SPARQL la plus simple, en utilisant la même variable <b>?movie</b> dans deux modèles d'instructions différents." }, "resultExtraContent": { "en": "The variables <b>?movie</b> and <b>?movieName</b> contain each movie's IRI and name respectively.", "fr": "⚒Les variables <b>?movie</b> et <b>?movieName</b> contiennent respectivement l'IRI et le nom de chaque film." } }, { "query": "PREFIX voc: <https://swapi.co/vocabulary/>\nPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n\nSELECT * {\n <https://swapi.co/resource/human/1> voc:film ?movie .\n ?movie rdfs:label ?movieName ;\n voc:releaseDate ?movieReleaseDate .\n} ORDER BY ?movieReleaseDate\n", "queryExtraContent": { "en": "The query builds upon the previous query but adds an additional join to fetch each movie's release date, and also sorting the results by the release date.", "fr": "⚒La requête s'appuie sur la requête précédente mais ajoute une jointure supplémentaire pour récupérer la date de sortie de chaque film, et également trier les résultats par date de sortie." }, "resultExtraContent": { "en": "The new variable <b>?movieReleaseDate</b> contains the release date and the results are sorted by it. We can clearly see that <b>A New Hope</b> was released first.", "fr": "⚒La nouvelle variable <b>?movieReleaseDate</b> contient la date de sortie et les résultats sont triés en fonction de celle-ci. Nous pouvons clairement voir que <b>A New Hope</b> est sorti en premier." } } ] } }, { "guideBlockName": "guide-end" } ] }, { "guideName": { "en": "3 The Movies database guide" }, "guideDescription": { "en": "The Movies database guide is a beginner's guide showing repository creation, importing RDF data from a file, starting to explore data from the class hierarchy, some SPARQL queries and exlporing RDF with the tabular view. It takes approximately 30 minutes to complete." }, "guideLevel": 0, "guideOrder": 2, "options": { "repositoryIdBase": "movies" }, "steps": [ { "guideBlockName": "welcome" }, { "guideBlockName": "create-repository" }, { "guideBlockName": "select-repository-dropdown" }, { "guideBlockName": "enable-autocomplete" }, { "guideBlockName": "import-rdf-file", "options": { "resourcePath": "movies", "resourceFile": "movies.ttl" } }, { "guideBlockName": "class-hierarchy", "options": { "introExtraContent": { "en": "In this dataset, there is a single top-level class, <b>schema:Movie</b>, and two subclasses (the smaller circles inside). This tells us that the dataset has to do with movies." }, "zoomIris": [ { "iri": "schema:Movie", "postExtraContent": { "en": "The two subclasses, <b>imdb:BlackandWhiteMovie</b> and <b>imdb:ColorMovie</b>, tell us that the movies are divided into black-and-white and color ones, and there are more color movies than black-and-white ones since the <b>imdb:ColorMovie</b> circle is larger." } } ] } }, { "guideBlockName": "class-hierarchy-instances", "options": { "iri": "imdb:ColorMovie", "focusInstances": [ "imdb:title/Superman", "imdb:title/Mulan" ], "followCountLink": true } }, { "guideBlockName": "execute-sparql-query", "options": { "queries": [ { "query": "PREFIX imdb: <http://academy.ontotext.com/imdb/>\nSELECT * {\n imdb:title\\/PiratesoftheCaribbeanAtWorldsEnd ?p ?o .\n}\n", "queryExtraContent": { "en": "The query selects RDF statements whose <i>subject</i> is the movie <b>Pirates of the Caribbean At World's End</b> (identified by the IRI <b>imdb:title/PiratesoftheCaribbeanAtWorldsEnd</b>). Note that we need to escape the / in the shortened IRI." }, "resultExtraContent": { "en": "The variables <b>?p</b> and <b>?o</b> correspond to the <i>predicate</i> and <i>object</i> of the RDF statements. We can see that the director (via the predicate <b>schema:director</b>) is identified by the IRI <b>imdb:person/GoreVerbinski</b> (scroll down if necessary)" } }, { "query": "PREFIX imdb: <http://academy.ontotext.com/imdb/>\nPREFIX schema: <http://schema.org/>\n\nSELECT * { \n ?movie a imdb:ColorMovie ;\n schema:name ?movieName ;\n schema:commentCount ?commentCount .\n} ORDER BY DESC(?commentCount)\n", "queryExtraContent": { "en": "The query selects all color movies by class (<b>a</b> is a short-hand notation for <b>rdf:type</b>) and then performs two joins to fetch the movie's name (via the <b>schema:name</b> predicate), and the movie's number of comments (via the <b>schema:commentCount</b> predicate). Finally, the result must be ordered by the number of comments in descending order." }, "resultExtraContent": { "en": "The variables <b>?movie</b>, <b>?movieName</b> and <b>?commentCount</b> contain each movie's IRI, name and number of comments respectively. We can see that the movie with the most comments, <b>The Dark Knight Rises</b>, comes on top." } } ] } }, { "guideBlockName": "table-graph-explore", "options": { "iri": "http://academy.ontotext.com/imdb/title/DjangoUnchained", "iriLabel": "imdb:title/DjangoUnchained", "subSteps": [ { "type": "link", "iri": "http://academy.ontotext.com/imdb/person/QuentinTarantino", "iriLabel": "imdb:person/QuentinTarantino" }, { "type": "table", "content": { "en": "The table now shows RDF statements where <b>Quentin Tarantino</b> is in the subject position only." } }, { "type": "role", "role": "all", "extraContent": { "en": "In this way, we'll be able to see more statements related to <b>Quentin Tarantino</b>." } }, { "type": "table", "extraContent": { "en": "The table now shows RDF statements where <b>Quentin Tarantino</b> is any position, such as <i>subject</i> or <i>object</i>." } }, { "type": "visual", "iri": "http://academy.ontotext.com/imdb/person/QuentinTarantino", "iriLabel": "imdb:person/QuentinTarantino", "extraContentVisualIntro": { "en": "Let's go back to the table now &mdash; don't worry, the {{'visual.graph.label'|translate}} view is covered in more detail in the <b>Star Wars guide</b>." } }, { "type": "row", "row": 11, "extraContent": { "en": "Most RDF statements describe <b>Quentin Tarantino</b> as the director but he was the lead actor in <b>Reservoir Dogs</b>." } }, { "type": "row", "row": 12, "content": { "en": "If we look carefully, we'll notice that he was not only the lead actor but also the director of <b>Reservoir Dogs</b>." }, "extraContent": { "en": "Let's try to find all movies where the lead actor and the director are the same person with SPARQL." } } ] } }, { "guideBlockName": "execute-sparql-query", "options": { "showIntro": false, "queries": [ { "query": "PREFIX schema: <http://schema.org/>\nPREFIX imdb: <http://academy.ontotext.com/imdb/>\n\nSELECT * { \n\t?movie schema:director ?person ;\n imdb:leadActor ?person .\n} ORDER BY ?person\n", "queryExtraContent": { "en": "The query selects RDF statements that have the same <i>subject</i> (<b>?movie</b>) and the same <i>object</i> (<b>?person</b>). For any given movie and person, there must be RDF statements that link the movie and the person with both the <b>schema:director</b> and the <b>imdb:leadActor</b> <i>predicate</i>." }, "resultExtraContent": { "en": "The results show the movies and persons where the same person is both a leading actor and a director. The results are ordered by the person since we specified <b>ORDER BY ?person</b>. We can easily see that <b>Clint Eastwood</b> has made a lot of movies like that (scroll down if needed)." } }, { "query": "PREFIX schema: <http://schema.org/>\nPREFIX imdb: <http://academy.ontotext.com/imdb/>\n\nSELECT ?person (COUNT(?movie) as ?numMovies) { \n\t?movie schema:director ?person ;\n imdb:leadActor ?person .\n} GROUP BY ?person ORDER BY DESC(?numMovies)\n", "queryExtraContent": { "en": "Just like the previous query, we select movies and people that are both the leading actor and the director. In this query, we also use <b>GROUP BY ?person</b> to group the results by person and <b>COUNT(?movie)</b> to count how many movies per person satisfy the criteria. The count is returned in the <b>?numMovies</b> variable." }, "resultExtraContent": { "en": "Since we also used <b>ORDER BY DESC(?numMovies)</b> to order the results by movie count in descending order, we can easily see that both <b>Clint Eastwood</b> and <b>Woody Allen</b> made 10 movies where they were the leading actor and the director." } } ] } }, { "guideBlockName": "guide-end" } ] }, { "guideName": { "en": "4 The Movies database guide" }, "guideDescription": { "en": "The Movies database guide is a beginner's guide showing repository creation, importing RDF data from a file, starting to explore data from the class hierarchy, some SPARQL queries and exlporing RDF with the tabular view. It takes approximately 30 minutes to complete." }, "guideLevel": 0, "guideOrder": 2, "options": { "repositoryIdBase": "movies-user-interactive" }, "steps": [ { "guideBlockName": "welcome" }, { "guideBlockName": "create-repository" }, { "guideBlockName": "select-repository-dropdown" }, { "guideBlockName": "enable-autocomplete" }, { "guideBlockName": "import-rdf-file", "options": { "resourcePath": "movies", "resourceFile": "movies-user-interactive.ttl" } }, { "guideBlockName": "class-hierarchy", "options": { "introExtraContent": { "en": "In this dataset, there is a single top-level class, <b>schema:Movie</b>, and two subclasses (the smaller circles inside). This tells us that the dataset has to do with movies." }, "zoomIris": [ { "iri": "schema:Movie", "postExtraContent": { "en": "The two subclasses, <b>imdb:BlackandWhiteMovie</b> and <b>imdb:ColorMovie</b>, tell us that the movies are divided into black-and-white and color ones, and there are more color movies than black-and-white ones since the <b>imdb:ColorMovie</b> circle is larger." } } ] } }, { "guideBlockName": "class-hierarchy-instances", "options": { "iri": "imdb:ColorMovie", "focusInstances": [ "imdb:title/Superman", "imdb:title/Mulan" ], "followCountLink": true } }, { "guideBlockName": "execute-sparql-query", "options": { "queries": [ { "query": "PREFIX imdb: <http://academy.ontotext.com/imdb/>\nSELECT * {\n imdb:title\\/PiratesoftheCaribbeanAtWorldsEnd ?p ?o .\n}\n", "queryExtraContent": { "en": "The query selects RDF statements whose <i>subject</i> is the movie <b>Pirates of the Caribbean At World's End</b> (identified by the IRI <b>imdb:title/PiratesoftheCaribbeanAtWorldsEnd</b>). Note that we need to escape the / in the shortened IRI." }, "resultExtraContent": { "en": "The variables <b>?p</b> and <b>?o</b> correspond to the <i>predicate</i> and <i>object</i> of the RDF statements. We can see that the director (via the predicate <b>schema:director</b>) is identified by the IRI <b>imdb:person/GoreVerbinski</b> (scroll down if necessary)" } }, { "query": "PREFIX imdb: <http://academy.ontotext.com/imdb/>\nPREFIX schema: <http://schema.org/>\n\nSELECT * { \n ?movie a imdb:ColorMovie ;\n schema:name ?movieName ;\n schema:commentCount ?commentCount .\n} ORDER BY DESC(?commentCount)\n", "queryExtraContent": { "en": "The query selects all color movies by class (<b>a</b> is a short-hand notation for <b>rdf:type</b>) and then performs two joins to fetch the movie's name (via the <b>schema:name</b> predicate), and the movie's number of comments (via the <b>schema:commentCount</b> predicate). Finally, the result must be ordered by the number of comments in descending order." }, "resultExtraContent": { "en": "The variables <b>?movie</b>, <b>?movieName</b> and <b>?commentCount</b> contain each movie's IRI, name and number of comments respectively. We can see that the movie with the most comments, <b>The Dark Knight Rises</b>, comes on top." } } ] } }, { "guideBlockName": "table-graph-explore", "options": { "iri": "http://academy.ontotext.com/imdb/title/DjangoUnchained", "iriLabel": "imdb:title/DjangoUnchained", "subSteps": [ { "type": "link", "iri": "http://academy.ontotext.com/imdb/person/QuentinTarantino", "iriLabel": "imdb:person/QuentinTarantino" }, { "type": "table", "content": { "en": "The table now shows RDF statements where <b>Quentin Tarantino</b> is in the subject position only." } }, { "type": "role", "role": "all", "extraContent": { "en": "In this way, we'll be able to see more statements related to <b>Quentin Tarantino</b>." } }, { "type": "table", "extraContent": { "en": "The table now shows RDF statements where <b>Quentin Tarantino</b> is any position, such as <i>subject</i> or <i>object</i>." } }, { "type": "visual", "iri": "http://academy.ontotext.com/imdb/person/QuentinTarantino", "iriLabel": "imdb:person/QuentinTarantino", "extraContentVisualIntro": { "en": "Let's go back to the table now &mdash; don't worry, the {{'visual.graph.label'|translate}} view is covered in more detail in the <b>Star Wars guide</b>." } }, { "type": "row", "row": 11, "extraContent": { "en": "Most RDF statements describe <b>Quentin Tarantino</b> as the director but he was the lead actor in <b>Reservoir Dogs</b>." } }, { "type": "row", "row": 12, "content": { "en": "If we look carefully, we'll notice that he was not only the lead actor but also the director of <b>Reservoir Dogs</b>." }, "extraContent": { "en": "Let's try to find all movies where the lead actor and the director are the same person with SPARQL." } } ] } }, { "guideBlockName": "execute-sparql-query", "options": { "showIntro": false, "queries": [ { "query": "PREFIX schema: <http://schema.org/>\nPREFIX imdb: <http://academy.ontotext.com/imdb/>\n\nSELECT * { \n\t?movie schema:director ?person ;\n imdb:leadActor ?person .\n} ORDER BY ?person\n", "queryExtraContent": { "en": "The query selects RDF statements that have the same <i>subject</i> (<b>?movie</b>) and the same <i>object</i> (<b>?person</b>). For any given movie and person, there must be RDF statements that link the movie and the person with both the <b>schema:director</b> and the <b>imdb:leadActor</b> <i>predicate</i>." }, "resultExtraContent": { "en": "The results show the movies and persons where the same person is both a leading actor and a director. The results are ordered by the person since we specified <b>ORDER BY ?person</b>. We can easily see that <b>Clint Eastwood</b> has made a lot of movies like that (scroll down if needed)." } }, { "query": "PREFIX schema: <http://schema.org/>\nPREFIX imdb: <http://academy.ontotext.com/imdb/>\n\nSELECT ?person (COUNT(?movie) as ?numMovies) { \n\t?movie schema:director ?person ;\n imdb:leadActor ?person .\n} GROUP BY ?person ORDER BY DESC(?numMovies)\n", "queryExtraContent": { "en": "Just like the previous query, we select movies and people that are both the leading actor and the director. In this query, we also use <b>GROUP BY ?person</b> to group the results by person and <b>COUNT(?movie)</b> to count how many movies per person satisfy the criteria. The count is returned in the <b>?numMovies</b> variable." }, "resultExtraContent": { "en": "Since we also used <b>ORDER BY DESC(?numMovies)</b> to order the results by movie count in descending order, we can easily see that both <b>Clint Eastwood</b> and <b>Woody Allen</b> made 10 movies where they were the leading actor and the director." } } ] } }, { "guideBlockName": "guide-end" } ] } ]