Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You want a <a href="http://www.w3.org/TR/sparql11-federated-query/" rel="nofollow noreferrer">federated SPARQL query</a>. You do not need to write code (other than the SPARQL query). You'll need an endpoint that supports them, and since it requires querying multiple endpoints, you might need to run your own endpoint (that might not contain any actual data, but can do the federation for you). Based on the requirements you outlined above, you probably want a query like the following. Notice that I removed <code>?dbpediaLink</code> from the projected variables; that is, this query does not <code>SELECT ?dbpediaLink</code>, since you're probably not interested in seeing that value so much as using it to retrieve data from DBpedia. You can add it back if you want it, of course.</p> <pre class="lang-sql prettyprint-override"><code>PREFIX owl: &lt;http://www.w3.org/2002/07/owl#&gt; PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; PREFIX movie: &lt;http://data.linkedmdb.org/resource/movie/&gt; PREFIX dcterms: &lt;http://purl.org/dc/terms/&gt; SELECT ?film ?label ?subject WHERE { SERVICE &lt;http://data.linkedmdb.org/sparql&gt; { ?film a movie:film . ?film rdfs:label ?label . ?film owl:sameAs ?dbpediaLink FILTER(regex(str(?dbpediaLink), "dbpedia", "i")) } SERVICE &lt;http://dbpedia.org/sparql&gt; { ?dbpediaLink dcterms:subject ?subject } } LIMIT 50 </code></pre> <p>You cannot run that directly against the <a href="http://dbpedia.org/sparql" rel="nofollow noreferrer">DBpedia SPARQL endpoint</a>, but you can use <a href="http://jena.apache.org/documentation/query/" rel="nofollow noreferrer">Jena's ARQ</a> to run the query locally, and ARQ will do the queries to the other endpoints for you. I created an empty file, <code>data.n3</code> to pass to ARQ as the <code>--query</code> argument, and was able to run the query like this (where <code>query.sparql</code> is the query above):</p> <pre><code>$ arq --query query.sparql --data data.n3 </code></pre> <p>The results look like the following. Note that each DBpedia resource can be related to a number of categories by the <code>dcterms:subject</code> property, so even though we have a <code>LIMIT 50</code> there, we're not actually getting fifty movies, but fifty result rows. </p> <pre><code>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | film | label | subject | ================================================================================================================================================================================ | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:1960s_horror_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:Films_directed_by_Jun_Fukuda&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:Giant_monster_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:Monster_movies&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:1966_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:Godzilla_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:Japanese_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:Kaiju_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:Mothra&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:Terrorism_in_fiction&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:1960s_science_fiction_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:Sequel_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:Japanese-language_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/11&gt; | "Godzilla vs. the Sea Monster" | &lt;http://dbpedia.org/resource/Category:Mystery_Science_Theater_3000_episodes&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:1930s_musical_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:American_musical_comedy_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:American_romantic_comedy_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:American_romantic_musical_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:1935_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:American_screwball_comedy_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:Black-and-white_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:Films_directed_by_Mark_Sandrich&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:1930s_romantic_comedy_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:United_States_National_Film_Registry_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:Films_set_in_London&gt; | | &lt;http://data.linkedmdb.org/resource/film/105&gt; | "Top Hat" | &lt;http://dbpedia.org/resource/Category:RKO_Pictures_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:American_children's_fantasy_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:Best_Original_Music_Score_Academy_Award_winners&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:E.T._the_Extra-Terrestrial&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:English-language_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:1980s_science_fiction_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:1982_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:Alien_visitation_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:Amblin_Entertainment_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:Films_directed_by_Steven_Spielberg&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:1985_novels&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:American_science_fiction_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:Films_produced_by_Steven_Spielberg&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:Films_set_in_the_San_Fernando_Valley&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:Films_that_won_the_Best_Sound_Mixing_Academy_Award&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:United_States_National_Film_Registry_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:Universal_Pictures_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:Best_Drama_Picture_Golden_Globe_winners&gt; | | &lt;http://data.linkedmdb.org/resource/film/154&gt; | "E.T. the Extra-Terrestrial" | &lt;http://dbpedia.org/resource/Category:Films_that_won_the_Best_Visual_Effects_Academy_Award&gt; | | &lt;http://data.linkedmdb.org/resource/film/155&gt; | "Easy Rider" | &lt;http://dbpedia.org/resource/Category:1960s_drama_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/155&gt; | "Easy Rider" | &lt;http://dbpedia.org/resource/Category:American_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/155&gt; | "Easy Rider" | &lt;http://dbpedia.org/resource/Category:1969_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/155&gt; | "Easy Rider" | &lt;http://dbpedia.org/resource/Category:Films_shot_in_New_Orleans,_Louisiana&gt; | | &lt;http://data.linkedmdb.org/resource/film/155&gt; | "Easy Rider" | &lt;http://dbpedia.org/resource/Category:Directorial_debut_films&gt; | | &lt;http://data.linkedmdb.org/resource/film/155&gt; | "Easy Rider" | &lt;http://dbpedia.org/resource/Category:Films_about_drugs&gt; | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload