Requêtes SPARQL DBPédia

Qu’est ce que DBpedia ?

Afin d’apprendre à effectuer des requêtes SPARQL nous avons choisi d’utiliser la ressource : http://dbpedia.org/About

Le but de cette ressource est d’organiser des données structurées extraite du site web collaboratif Wikipedia.

Les données présentes concernent :

“1,445,000 persons, 735,000 places (including 478,000 populated places), 411,000 creative works (including 123,000 music albums, 87,000 films and 19,000 video games), 241,000 organizations (including 58,000 companies and 49,000 educational institutions), 251,000 species and 6,000 diseases.”

Dbpedia utilise sa propre ontologie, dont les classes sont décrites ici : http://mappings.dbpedia.org/server/ontology/classes/

Ontologies utilisées :

xml:base= »http://dbpedia.org/ontology/ » ⇒ DBPedia Ontolgy

xmlns:dc= »http://purl.org/dc/elements/1.1/ » ⇒ The Dublin Core (DC) Ontology

xmlns:prov= »http://www.w3.org/ns/prov# » ⇒ The PROV namespace

xmlns:wikidata= »http://www.wikidata.org/entity/ » ⇒ Wikidata Ontology

xmlns:foaf= »http://xmlns.com/foaf/0.1/ » ⇒ FOAF ontology

xmlns:vann= »http://purl.org/vocab/vann/ » ⇒ VANN vocabulary

xmlns:cidoccrm= »http://purl.org/NET/cidoc-crm/core# » ⇒ CIDOC Conceptual Reference Model

xmlns:dcterms= »http://purl.org/dc/terms/ » ⇒ DCMI Metadata Terms

xmlns:d0= »http://www.ontologydesignpatterns.org/ont/d0.owl# » ⇒ Ontology Design Pattern

xmlns:rdfs= »http://www.w3.org/2000/01/rdf-schema# » ⇒ Schéma RDF

xmlns:dul= »http://www.ontologydesignpatterns.org/ont/dul/DUL.owl# » ⇒ Design Pattern

xmlns:xsd= »http://www.w3.org/2001/XMLSchema# »

xmlns:owl= »http://www.w3.org/2002/07/owl# »

xmlns:rdf= »http://www.w3.org/1999/02/22-rdf-syntax-ns# »

xmlns:wgs84pos= »http://www.w3.org/2003/01/geo/wgs84_pos# »

xmlns:cc= »http://creativecommons.org/ns#« >

Ressource de DBpedia :

Données HTML, exemple pour la France :  http://dbpedia.org/page/France

Données RDF : http://wiki.dbpedia.org/Downloads2014

SPARQL Endpoint : http://dbpedia.org/sparql

15 requêtes SPARQL :

1)

Humain : “Liste de 100 personnes nées à Berlin”

SPARQL :

prefix dbpedia2: <http://dbpedia.org/property/> select ?person where { ?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin> } limit 100

2)

Humain : “Liste des 100 personnes nées à Berlin dont le nom contient “Eddie”

SPARQL :

prefix dbpedia2: <http://dbpedia.org/property/>

prefix foaf: <http://xmlns.com/foaf/0.1/>

select distinct ?person ?name where { ?person dbpedia2:birthPlace <http://dbpedia.org/resource/Berlin> . ?person foaf:name ?name . FILTER regex(?name, « Eddie »)} limit 100

 

3)

Humain : “Où est né Barack Obama ?”

SPARQL :

prefix dbpedia2: <http://dbpedia.org/property/>

prefix foaf: <http://xmlns.com/foaf/0.1/>

select distinct ?person ?birthPlace ?name where { ?person dbpedia2:birthPlace ?birthPlace . ?person foaf:name ?name . FILTER regex(?name, « Barack Obama »)} limit 100

 

4)

Humain : “Liste de 100 Sumos”

SPARQL :

select

distinct ?person

where {

?person a dbpedia-owl:SumoWrestler .

}

 

limit 100

 

5)

Humain : “Date de naissance et de mort (si elle existe) de 100 présidents”

SPARQL:

prefix dbpedia2: <http://dbpedia.org/property/>

prefix foaf: <http://xmlns.com/foaf/0.1/>

select distinct ?person ?birthDate ?deathDate ?name where { ?person dbpedia2:office ?office. ?person dbpedia2:birthDate ?birthDate . ?person foaf:name ?name . FILTER regex(?office, « president ») optional { ?person dbpedia2:deathDate ?deathDate}} limit 100

 

6)

Humain : “Sélectionner toutes les villes se trouvant au Canada”

SPARQL :

prefix rdf= »http://www.w3.org/1999/02/22-rdf-syntax-ns# »

prefix rdfs= »http://www.w3.org/2000/01/rdf-schema# »

 

SELECT DISTINCT ?city ?country

WHERE { ?city rdf:type dbpedia-owl:City ;

rdfs:label ?label ;

dbpedia-owl:country ?country

FILTER ( ?country=<http://dbpedia.org/resource/Canada>)

}

7)TVShow dont les acteurs sont classés par leur lieu de naissance

prefix dbpediaO: <http://dbpedia.org/ontology/>

select ?tv ?actor ?birthplace

where {

?tv a dbpediaO:TelevisionShow .

?tv <http://dbpedia.org/property/starring> ?actor .

?actor a dbpediaO:Person .

?actor <http://dbpedia.org/property/birthPlace> ?birthplace

} order by ?birthplace limit 100 offset 50

8)

Humain : “Sélectionner uniquement les pays Européen ainsi que leur capital et latitude et longitude”

SPARQL :

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

PREFIX yago: <http://dbpedia.org/class/yago/>

PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>

 

SELECT distinct ?country ?capital ?caplat ?caplong

WHERE {

?country rdf:type yago:EuropeanCountries .

 

?country rdf:type dbpedia-owl:Country .

?country  dbpedia-owl:capital ?capital .

OPTIONAL {

?capital geo:lat ?caplat ;

geo:long ?caplong .

}

}

ORDER BY ?country

 

9) Humain : “Les guitaristes qui ne sont pas originaires de UK”

SPARQL:

prefix foaf: <http://xmlns.com/foaf/0.1/>

 

select

distinct ?person ?name ?nationality

where {

?person foaf:name ?name .

?person dbpedia-owl:nationality ?nationality .

?person a dbpedia-owl:Guitarist

filter(?nationality != <http://dbpedia.org/resource/United_Kingdom>)

}

 

limit 100

 

10)

Humain : “Changer la description d’Aristotle (Rien de personnel) dans la base (dataset) persondata.”

SPARQL :

prefix dc:<http://purl.org/dc/elements/1.1/>

prefix dbp:<http://dbpedia.org/resource/>

delete data {

dbp:Aristotle dc:description « Greek philosopher »@en .

};

insert {

dbp:Aristotle dc:description « Greek liar ! »@en .

}

where{}

 

11) Tout supprimer dans la base :

 

prefix dbpedia2: <http://dbpedia.org/property/>

prefix foaf: <http://xmlns.com/foaf/0.1/>

 

DELETE WHERE {?x ?y ?z}

 

12) Humains : “Remplacer toutes les personnes qui ont pour “givenName” le prénom “Alan” en “William” “

SPARQL :

prefix dbpedia2: <http://dbpedia.org/property/>

prefix foaf: <http://xmlns.com/foaf/0.1/>

 

DELETE { ?person foaf:givenName ‘Alan’ }

INSERT { ?person foaf:givenName ‘William’ }

WHERE

{ ?person foaf:givenName ‘Alan’

}

 

13) Humains : “Les cinquantes meilleures équipes de football du monde d’après le classement Fifa en football et futsal masculin et féminin:(ne renvoi que les résultats en anglais”

SPARQL :

PREFIX dbpprop:<http://dbpedia.org/property/>

 

SELECT DISTINCT ?name ?rank

WHERE {?s dbpprop:fifaRank ?rank ; rdfs:label ?name

FILTER (?rank <= 50 && langMatches(lang(?name), »en »))

}

ORDER BY ?rank

 

14)

Humains : “Les institutions d’éducation du Chili classées par leurs noms”

SPARQL :

select ?ei ?name

where {?ei a <http://dbpedia.org/ontology/EducationalInstitution> .

?ei <http://dbpedia.org/property/location> <http://dbpedia.org/resource/Chile> .

?ei  dbpprop:name ?name

} order by ?name limit 100 offset 20

 

15) Humains : “Astronautes russes de moins de 35 ans”

SPARQL :

prefix foaf: <http://xmlns.com/foaf/0.1/>

 

select

distinct ?person ?nationality ?birthDate

where {

?person a dbpedia-owl:Astronaut .

?person dbpedia-owl:nationality ?nationality  .

?person dbpedia-owl:birthDate ?birthDate

filter(?nationality = <http://dbpedia.org/resource/Russia> && ?birthDate > « 1970-05-23T10:20:13+05:30″^^xsd:dateTime)

}

 

 

Auteurs

Geoffroy Clauss

Nicolas Gimenez

Maxime Lanave

Anne Mesnil

Ce contenu a été publié dans Articles, Web Sémantique, avec comme mot(s)-clé(s) , , . Vous pouvez le mettre en favoris avec ce permalien.

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *