Click here to load reader
Upload
yijun-chen
View
1.046
Download
1
Embed Size (px)
Citation preview
Web sémantique – les requête SPARQL
Yijun CHEN et Jixiao DU
Requête No.1Objectif: Trouver la ville la plus grande d’allemagnePREFIX owl: <http://www.w3.org/2002/07/owl#>PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>PREFIX foaf: <http://xmlns.com/foaf/0.1/>PREFIX dc: <http://purl.org/dc/elements/1.1/>PREFIX : <http://dbpedia.org/resource/>PREFIX dbpedia2: <http://dbpedia.org/property/>PREFIX dbpedia: <http://dbpedia.org/>PREFIX skos: <http://www.w3.org/2004/02/skos/core#>PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT distinct ?ville WHERE
{ :Germany dbpedia2:largestCity ?ville.} ORDER BY ?ville
Résultat:Ville"capital"@en
Requête No.2Objectif: Trouver le capital d’Allemagne
PREFIX dbo: <http://dbpedia.org/ontology/>SELECT distinct ?ville WHERE {
:Germany dbpedia2:capital ?ville.} ORDER BY ?ville
Résultat:
SPARQL results:ville:Berlin
Requête No.3Objectif: Trouver tous les pays et ses langues officielle et capital.PREFIX dbo: <http://dbpedia.org/ontology/>select * where{?x dbo:officialLanguage ?z.?x dbo:capital ?y.
}Résultat:(ici, on liste que des premierslignes durésultat)
X Y Z
:Vietnam :Vietnamese_language :Hanoi
:Azerbaijan :Azerbaijani_language :Baku
:Nakhchivan :Azerbaijani_language :Nakhchivan_%28city%29
:Madagascar :Malagasy_language :Antananarivo
:Nepal :Nepali_language :Kathmandu
:Cambodia :Khmer_language :Phnom_Penh
:Czech_Republic :Czech_language :Prague
Requête No.4Objectif: Trouver les pays dont la langue officielle est français
PREFIX dbo: <http://dbpedia.org/ontology/>
select * where{?x dbo:officialLanguage :French_language.?x dbo:capital ?y.
}Résultat:(ici, on liste que des premierslignes durésultat)
X Y
:Republic_of_the_Congo :Brazzaville
:Gabon :Libreville
:Togo :Lom%C3%A9
:Benin :Porto-Novo
:Chad :N%27Djamena
:Haiti :Port-au-Prince
:French_Southern_and_Antarctic_Lands :Port-aux-Fran%C3%A7ais
Étudier la classe ville
Requête No.5Objectif: Afficher les listes de twin city qui a plus de 1000000 de personnesPREFIX dbo: <http://dbpedia.org/ontology/>
select *where{?ville dbo:twinCity ?ville_twin.?ville dbo:populationTotal ?populationTotal.filter (1000000<?populationTotal)
}
Requête No.5Résultat:
ville ville_twin populationTotal:Cape_Town :Nice 3497097:Harare :Prato 1600000:Makassar :Aden 1334090:Cape_Town :Haifa 3497097:Harare :Lago 1600000:Cape_Town :Aachen 3497097:Nairobi :Denver 3138295:Harare :Munich 1600000:Makassar :Hakodate,_Hokkaid%C5%8D 1334090:Harare :Nottingham 1600000:Makassar :Wellington 1334090:Cape_Town :Saint_Petersburg 3497097:Cape_Town :Miami-Dade_County,_Florida 3497097:Harare :Cincinnati 1600000:Makassar :Peshawar 1334090:Nairobi :Colorado 3138295:Cape_Town :Hangzhou 3497097:Makassar :Qingdao 1334090:Makassar :Lismore 1334090
Requête No.6Objectif: Chercher des personnes qui sont né en chine avec le nom chenSELECT distinct ?name ?person ?birthPlace ?givenNameWHERE{?person foaf:name ?name.?person dbpedia2:birthPlace ?birthPlace .?person foaf:givenName ?givenName.FILTER regex (?birthPlace,"China*")FILTER regex (?givenName, "Chen")}ORDER BY ?nameRésultat: