Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
thatcamp_2014:donnees_de_la_communaute_europeenne [2014/10/08 10:36] Francesco Beretta |
thatcamp_2014:donnees_de_la_communaute_europeenne [2014/10/14 08:55] Francesco Beretta [Requêtes depuis Fuseki] |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ===== Sites/Données ===== | ||
- | http://www.lespetitescases.net/ou-s-amuser-avec-sparql | ||
+ | Un exemple de [[http://live.dbpedia.org/page/Italy|page DBPedia (live) concernant l'Italie]] | ||
+ | |||
+ | |||
+ | [[http://eurostat.linked-statistics.org/|Eurostat linked data]] | ||
+ | |||
+ | [[http://datahub.io/dataset/linked-nuts|Linked NUTS]] | ||
+ | |||
+ | [[http://ec.europa.eu/eurostat/ramon/index.cfm?TargetUrl=DSP_PUB_WELC|RAMON | ||
+ | Eurostat's Metadata Server ]] | ||
+ | |||
+ | ==== Le site utilisé – sans SPARQL ==== | ||
+ | |||
+ | http://estatwrap.ontologycentral.com/ | ||
+ | |||
+ | |||
+ | http://estatwrap.ontologycentral.com/table_of_contents.html | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ====== Un jeu de données de test ====== | ||
+ | |||
+ | |||
+ | http://www.lespetitescases.net/ou-s-amuser-avec-sparql | ||
Un point d'accès: | Un point d'accès: | ||
http://wifo5-03.informatik.uni-mannheim.de/eurostat/ | http://wifo5-03.informatik.uni-mannheim.de/eurostat/ | ||
+ | |||
\\ | \\ | ||
Ligne 15: | Ligne 40: | ||
- | ====== Exemples ====== | + | |
- | + | ||
<code> | <code> | ||
Ligne 51: | Ligne 77: | ||
<code> | <code> | ||
PREFIX countries: <http://wifo5-04.informatik.uni-mannheim.de/eurostat/resource/countries/> | PREFIX countries: <http://wifo5-04.informatik.uni-mannheim.de/eurostat/resource/countries/> | ||
- | SELECT DISTINCT ?s ?name ?geocodeProvince ?parentCountryGeocode ?populationTotal WHERE { | + | SELECT |
+ | # MAX(?s) (count(*) as ?nombre) ?geocodeProvince | ||
+ | |||
+ | DISTINCT (MIN(?s) as ?identifiant) (GROUP_CONCAT(?name ; separator="|") as ?concatName) ?geocodeProvince (MIN(?parentCountryGeocode) as ?siglePays) (MIN(?populationTotal) as ?population) (count(*) as ?nombre) | ||
+ | |||
+ | WHERE { | ||
?s rdf:type eurostat:regions. | ?s rdf:type eurostat:regions. | ||
?s eurostat:name ?name. | ?s eurostat:name ?name. | ||
Ligne 59: | Ligne 90: | ||
?parentCountry eurostat:geocode ?parentCountryGeocode | ?parentCountry eurostat:geocode ?parentCountryGeocode | ||
} | } | ||
- | ORDER BY ?parentCountryGeocode ?name</code> | + | GROUP BY ?geocodeProvince |
+ | ORDER BY ?parentCountryGeocode ?name ?geocodeProvince</code> | ||
+ | |||
+ | |||
+ | ====== Requêtes dans Fuseki ====== | ||
+ | |||
+ | |||
+ | <code> | ||
+ | PREFIX dc: <http://purl.org/dc/elements/1.1/> | ||
+ | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
+ | PREFIX meg: <http://mon_espace.org/graph/> | ||
+ | PREFIX apf: <http://jena.hpl.hp.com/ARQ/property#> | ||
+ | PREFIX eus: <http://ec.europa.eu/eurostat/ramon/ontologies/geographic.rdf#> | ||
+ | PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | ||
+ | PREFIX owl: <http://www.w3.org/2002/07/owl#> | ||
+ | PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
+ | PREFIX fn: <http://www.w3.org/2005/xpath-functions#> | ||
+ | PREFIX eu_man: <http://wifo5-04.informatik.uni-mannheim.de/eurostat/resource/eurostat/> | ||
+ | |||
+ | SELECT ?country | ||
+ | WHERE | ||
+ | { SERVICE <http://wifo5-04.informatik.uni-mannheim.de/eurostat/sparql> | ||
+ | { ?country rdf:type eu_man:countries } | ||
+ | } | ||
+ | LIMIT 5 | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ====== Vider un graphe sous Fuseki ====== | ||
+ | |||
+ | |||
+ | |||
+ | ATTENTION : la base est ainsi vidée | ||
+ | |||
+ | <code>DELETE | ||
+ | WHERE {?s ?p ?o} | ||
+ | |||
+ | Vérifier qu'elle est vide : | ||
+ | SELECT * | ||
+ | WHERE {?s ?p ?o} | ||
+ | </code> | ||
+ | |||
+ | |||
+ | |||
+ | Avec graphe | ||
+ | |||
+ | <code>DELETE WHERE | ||
+ | { | ||
+ | GRAPH ?g { | ||
+ | ?s ?p ?o . | ||
+ | } | ||
+ | }</code> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Vérifier que le graphe est vide : | ||
+ | |||
+ | <code>SELECT * | ||
+ | WHERE | ||
+ | { GRAPH ?g | ||
+ | { ?s ?p ?o } | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ |