User:GAllegre/Memento/Sparql: Difference between revisions
< User:GAllegre | Memento
Content deleted Content added
Line 2: | Line 2: | ||
== Pas de tir à Kourou == |
== Pas de tir à Kourou == |
||
[https://frama.link/9XMujDqH query-frama] |
|||
<nowiki> |
<nowiki> |
Revision as of 22:46, 1 August 2017
SPARQL
Pas de tir à Kourou
SELECT ?aire ?aireLabel ?acro ?service ?engin ?enginLabel ?coords ?image WHERE { ?aire wdt:P361 wd:Q308987 ; wdt:P1813 ?acro ; wdt:P729 ?service . OPTIONAL { ?aire wdt:P18 ?image .} OPTIONAL { ?aire wdt:P625 ?coords . } OPTIONAL { ?engin wdt:P276 ?aire . } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY ?service
Personnes enterrées au Père-Lachaise
version basique (sans qualificateurs)
SELECT ?personne ?personneLabel WHERE { ?personne wdt:P119 wd:Q311 . SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" } }
version évoluée (avec qualificateurs et coordonnées)
SELECT ?personne ?personneLabel ?coord WHERE { ?personne p:P119 ?burialStatement . ?burialStatement ps:P119 wd:Q311 . ?burialStatement pq:P965 '62' . OPTIONAL { ?burialStatement pq:P625 ?coord . } SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" } }
Forts autour de Grenoble
# Forts autour de Grenoble # D'après https://www.mediawiki.org/wiki/Help:Extension:Kartographer#GeoShapes_via_Wikidata_Query SELECT ?itemLabel ?image ?locLabel ?link (concat('[[wikipedia:', substr(str(?link),31,500), '{{!}}', ?itemLabel, ']]') as ?title) (concat(?locLabel, '\\n', '[[File:', substr(str(?image), 52, 500), '{{!}}200px]]') as ?description) WHERE { ?item wdt:P361 wd:Q2943846 . OPTIONAL {?item wdt:P18 ?image . } OPTIONAL {?item wdt:P729 ?an . } OPTIONAL {?item wdt:P131 ?loc . } SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" } ?link schema:about ?item . ?link schema:isPartOf <https://fr.wikipedia.org/> . }
Tours de babel
#Tours de Babel #defaultView:ImageGrid SELECT ?item ?itemLabel ?natureLabel ?creator ?creatorLabel ?image ?date WHERE { ?item wdt:P180 wd:Q41213 . ?item wdt:P31 ?nature . OPTIONAL {?item wdt:P18 ?image . } OPTIONAL {?item wdt:P170 ?creator . } OPTIONAL {?item wdt:P571 ?date . } SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" } }
Liste des libellés en langues des signes renseignés
Liste complète
PREFIX p: <http://www.wikidata.org/prop/> #optional PREFIX pq: <http://www.wikidata.org/prop/qualifier/> #optional PREFIX v: <http://www.wikidata.org/prop/statement/> #mandatory SELECT ?item ?itemLabel ?file ?lang ?langLabel WHERE { ?item p:P2919 ?file_statement . ?file_statement v:P2919 ?file . OPTIONAL { ?file_statement pq:P407 ?lang } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } }
Total par langue
PREFIX v: <http://www.wikidata.org/prop/statement/> #mandatory SELECT ?lang ?langLabel (COUNT(DISTINCT ?item) as ?itemCount) WHERE { ?item p:P2919 ?file_statement . ?file_statement v:P2919 ?file . OPTIONAL { ?file_statement pq:P407 ?lang } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } } GROUP BY ?lang ?langLabel ORDER BY DESC(?itemCount)
Liste des pays avec cartes
Tous les noms de tous les pays
SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q160016 #état de l'ONU OPTIONAL { ?item rdfs:label ?itemLabel . } }
puis uniquement les noms en français :
SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q160016 #état de l'ONU OPTIONAL { ?item rdfs:label ?itemLabel filter (lang(?itemLabel) = "fr") . } } ORDER BY ?itemLabel
puis en ajoutant les codes alpha-3
SELECT ?item ?alpha3 ?itemLabel WHERE { ?item wdt:P31 wd:Q160016 #état de l'ONU OPTIONAL {?item wdt:P298 ?alpha3. } OPTIONAL { ?item rdfs:label ?itemLabel filter (lang(?itemLabel) = "fr") . } } ORDER BY ASC(?alpha3)
puis les cartes (images) !
SELECT ?item ?alpha3 ?itemLabel (COUNT(DISTINCT ?carte) as ?cartes) (MIN(?carte) as ?carto) #(GROUP_CONCAT(?carte;separator=':') as ?carto) WHERE { ?item wdt:P31 wd:Q160016 #état de l'ONU #?item wdt:P31 wd:Q6256 #pays #?item wdt:P31 wd:Q3624078 #état souverain OPTIONAL {?item wdt:P298 ?alpha3. } OPTIONAL {?item wdt:P242 ?carte. } #locator map image OPTIONAL { ?item rdfs:label ?itemLabel filter (lang(?itemLabel) = "fr") . } } GROUP BY ?item ?itemLabel ?alpha3 ORDER BY ASC(?alpha3)
Requêtes GeoSparql
# Distance entre les pôles (à compléter...) SELECT ?item ?itemLabel ?coord ?coordn ?dist WHERE { wd:Q933 wdt:P625 ?coordn. ?item wdt:P31 wd:Q183273 ; wdt:P376 wd:Q2 ; wdt:P625 ?coord . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } BIND(geof:distance(?coord, ?coordn) as ?dist) }
#Places within 1km of the Empire State Building #added before 2016-10 SELECT ?place ?placeLabel ?location ?instanceLabel WHERE { wd:Q9188 wdt:P625 ?loc . SERVICE wikibase:around { ?place wdt:P625 ?location . bd:serviceParam wikibase:center ?loc . bd:serviceParam wikibase:radius "1" . } OPTIONAL { ?place wdt:P31 ?instance } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } BIND(geof:distance(?loc, ?location) as ?dist) } ORDER BY ?dist