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 | ||
thatcamp_2014:requete_dbpedia [2014/08/31 11:27] Francesco Beretta [Nombre d'universités dans dbpedia live] |
thatcamp_2014:requete_dbpedia [2014/09/01 09:20] Francesco Beretta [Jointure avec GEONAMES] |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | |||
+ | ====== Données exploitables ====== | ||
+ | |||
+ | |||
+ | ===== Production de données ===== | ||
+ | |||
+ | [31.08.2014] 3837 lignes si on enlève le limit | ||
+ | |||
+ | |||
+ | <code> | ||
+ | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
+ | PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> | ||
+ | PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> | ||
+ | PREFIX dbpedia: <http://dbpedia.org/resource/> | ||
+ | PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | ||
+ | PREFIX dbpprop: <http://dbpedia.org/property/> | ||
+ | |||
+ | SELECT * | ||
+ | WHERE | ||
+ | { SELECT DISTINCT ?s (strafter(str(?s), "http://dbpedia.org/resource/") AS ?id_name) ?name (xsd:float(strbefore(?point, " ")) AS ?lat) (xsd:float(strafter(?point, " ")) AS ?long) (max(?nombre_etudiants) AS ?nombre) | ||
+ | WHERE | ||
+ | { SERVICE <http://dbpedia-live.openlinksw.com/sparql> | ||
+ | { ?s dbpprop:type dbpedia:Public_university . | ||
+ | ?s <http://www.georss.org/georss/point> ?point | ||
+ | OPTIONAL | ||
+ | { ?s dbpprop:name ?name } | ||
+ | OPTIONAL | ||
+ | { { SELECT * | ||
+ | WHERE | ||
+ | { ?s dbpprop:students ?nombre_etudiants } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | GROUP BY ?s ?point ?name | ||
+ | LIMIT 10 | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | {{:thatcamp_2014:resultat_corrige.csv.zip|Fichier nettoyé}}, utilisable dans QGIS (séparateur |) | ||
+ | |||
+ | |||
+ | |||
+ | ====== Exploration ====== | ||
+ | |||
+ | |||
+ | Point d'accès SPARQL : http://dbpedia-live.openlinksw.com/sparql | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Nombre d'universités dans dbpedia live ===== | ||
+ | |||
+ | |||
+ | |||
Chercher toutes les univesités | Chercher toutes les univesités | ||
Ligne 12: | Ligne 67: | ||
</code> | </code> | ||
- | ===== Nombre d'universités dans dbpedia live ===== | + | |
+ | |||
[31.08.2014} Résultat: 4303 | [31.08.2014} Résultat: 4303 | ||
Ligne 56: | Ligne 113: | ||
- | ===== Production de données ===== | ||
- | [31.08.2014] 3837 lignes si on enlève le limit | ||
- | |||
- | |||
- | <code> | ||
- | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
- | PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> | ||
- | PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> | ||
- | PREFIX dbpedia: <http://dbpedia.org/resource/> | ||
- | PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | ||
- | PREFIX dbpprop: <http://dbpedia.org/property/> | ||
- | |||
- | SELECT * | ||
- | WHERE | ||
- | { SELECT DISTINCT ?s (strafter(str(?s), "http://dbpedia.org/resource/") AS ?id_name) ?name (xsd:float(strbefore(?point, " ")) AS ?lat) (xsd:float(strafter(?point, " ")) AS ?long) (max(?nombre_etudiants) AS ?nombre) | ||
- | WHERE | ||
- | { SERVICE <http://dbpedia-live.openlinksw.com/sparql> | ||
- | { ?s dbpprop:type dbpedia:Public_university . | ||
- | ?s <http://www.georss.org/georss/point> ?point | ||
- | OPTIONAL | ||
- | { ?s dbpprop:name ?name } | ||
- | OPTIONAL | ||
- | { { SELECT * | ||
- | WHERE | ||
- | { ?s dbpprop:students ?nombre_etudiants } | ||
- | } | ||
- | } | ||
- | } | ||
- | } | ||
- | GROUP BY ?s ?point ?name | ||
- | LIMIT 10 | ||
- | } | ||
- | </code> | ||
===== Jointure avec GEONAMES ===== | ===== Jointure avec GEONAMES ===== | ||
En cours de test | En cours de test | ||
Ligne 117: | Ligne 141: | ||
} | } | ||
}</code> | }</code> | ||
+ | | ||
+ | | ||
+ | | ||
+ | La fonction de filtre ne semble pas être activée : | ||
+ | | ||
+ | |||
+ | | ||
+ | <code> | ||
+ | PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> | ||
+ | PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> | ||
+ | PREFIX dbpedia: <http://dbpedia.org/resource/> | ||
+ | PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | ||
+ | PREFIX dbpprop: <http://dbpedia.org/property/> | ||
+ | |||
+ | |||
+ | SELECT DISTINCT * | ||
+ | WHERE | ||
+ | { ?s dbpprop:type dbpedia:Public_university . | ||
+ | ?s dbpprop:city ?city . | ||
+ | ?city dbpedia-owl:type dbpedia:City . | ||
+ | OPTIONAL {?city <http://www.w3.org/2002/07/owl#sameAs> ?geonames . | ||
+ | # FILTER (substr(xsd:str(?geonames), 1, 15) = "http://sws.geon") | ||
+ | } | ||
+ | } | ||
+ | |||
+ | LIMIT 10 | ||
+ | </code> |