User:Fralambert/Sparql

Vous trouverez un peu d'explication sur les cartes dans RAW 2016-07-15.

Carte des 1024 lieux historiques nationaux du Canada edit

 
Partie d'une carte interactive des lieux historiques nationaux du Canada, telle que générée par le script.
#defaultView:Map
SELECT ?item ?itemLabel ?coord
WHERE {
	?item	wdt:P1435/wdt:P279* wd:Q1568567;
				rdfs:label ?itemLabel;
				wdt:P625 ?coord;
	FILTER (lang(?itemLabel) = "fr"). 
}
Try it!

Carte des 12,200 lieux patrimoniaux au Canada (tous les types) edit

#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coord ?image
WHERE { {
    SELECT DISTINCT ?item WHERE {
      ?item wdt:P1435/wdt:P279* wd:Q14469659 .
      ?item p:P1435 ?heritage_statement .
      FILTER NOT EXISTS { ?heritage_statement pq:P582 ?end . }
    } }
        OPTIONAL { ?item wdt:P625 ?coord . }
        OPTIONAL { ?item wdt:P18 ?image . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr, en" . } . 
}
Try it!

Carte du patrimoine culturel du Québec edit

#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coord ?image
WHERE { {
    SELECT DISTINCT ?item WHERE {
      ?item wdt:P1435/wdt:P279* wd:Q3370013 .
      ?item p:P1435 ?heritage_statement .
      FILTER NOT EXISTS { ?heritage_statement pq:P582 ?end . }
    } }
        OPTIONAL { ?item wdt:P625 ?coord . }
        OPTIONAL { ?item wdt:P18 ?image . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr, en" . } . 
}
Try it!

Carte des ressources historiques de l'Alberta edit

#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coord ?image
WHERE { {
    SELECT DISTINCT ?item WHERE {
      ?item wdt:P1435/wdt:P279* wd:Q14465882 .
      ?item p:P1435 ?heritage_statement .
      FILTER NOT EXISTS { ?heritage_statement pq:P582 ?end . }
    } }
        OPTIONAL { ?item wdt:P625 ?coord . }
        OPTIONAL { ?item wdt:P18 ?image . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr, en" . } . 
}
Try it!

Carte des bien patrimoniaux de l'Ontario edit

Tous les biens, avec et sans photos
#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coord ?image
WHERE { {
    SELECT DISTINCT ?item WHERE {
      ?item wdt:P1435/wdt:P279* wd:Q18341711 .
      ?item p:P1435 ?heritage_statement .
      FILTER NOT EXISTS { ?heritage_statement pq:P582 ?end . }
    } }
        OPTIONAL { ?item wdt:P625 ?coord . }
        OPTIONAL { ?item wdt:P18 ?image . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en, fr" . } . 
}
Try it!

Sans photos
#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coord ?image
WHERE { {
    SELECT DISTINCT ?item WHERE {
      ?item wdt:P1435/wdt:P279* wd:Q18341711 .
      ?item p:P1435 ?heritage_statement .
      FILTER NOT EXISTS { ?heritage_statement pq:P582 ?end . }
    } }
        OPTIONAL { ?item wdt:P625 ?coord . }
        FILTER NOT EXISTS { ?item wdt:P18 ?image . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en, fr" . } . 
}
Try it!

Carte des phares patrimoniaux du Canada edit

#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coord ?image
WHERE { {
    SELECT DISTINCT ?item WHERE {
      ?item wdt:P1435/wdt:P279* wd:Q15641550 .
      ?item p:P1435 ?heritage_statement .
      FILTER NOT EXISTS { ?heritage_statement pq:P582 ?end . }
    } }
        OPTIONAL { ?item wdt:P625 ?coord . }
        OPTIONAL { ?item wdt:P18 ?image . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr, en" . } . 
}
Try it!

Carte des lieux patrimoniaux pour une région donnée edit

#defaultView:Map
SELECT DISTINCT
  ?item
  ?itemLabel
  ?communeLabel
  ?coords
  ?image
WHERE { {
    SELECT DISTINCT ?item WHERE {
      ?item wdt:P1435/wdt:P279* wd:Q14469659 .
      ?item p:P1435 ?heritage_statement .
      FILTER NOT EXISTS { ?heritage_statement pq:P582 ?end . }
    } }
  ?item wdt:P131/wdt:P131* wd:Q680780 . # Pour une autre région, changer "Q680780" pour une autre entité administrative.
  ?item wdt:P131 ?commune .
  OPTIONAL { ?item wdt:P625 ?coords . }
  OPTIONAL { ?item wdt:P18 ?image . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" . }
}
GROUP BY ?item ?itemLabel ?communeLabel ?coords ?image
ORDER BY ?communeLabel ?itemLabel
Try it!

L'identifiant Q680780 dans le script correspond à la région administrative de la ville de Québec. Toutes les régions administratives du Québec sont listées dans Q176 en vis-à-vis de la déclaration « contient les subdivisions territoriales administratives ». Dans le script là-bas, remplacez Q680780 par l'identifiant Wikidata de la région administrative (exemple, Estrie : Q1122368).

Carte des lieux patrimoniaux du Canada sans photos edit

#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coord ?image
WHERE {
	?item	wdt:P1435/wdt:P279* wd:Q14469659;
				wdt:P17 wd:Q16;
				wdt:P625 ?coord;
      MINUS { ?item wdt:P18 [] } . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" . } 
}
Try it!

Lieux patrimoniaux dans une aire protégée edit

#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coord ?image ?park ?parkLabel
WHERE { {
    SELECT DISTINCT ?item WHERE {
      ?item wdt:P1435/wdt:P279* wd:Q14469659 .
      ?item p:P1435 ?heritage_statement .
      FILTER NOT EXISTS { ?heritage_statement pq:P582 ?end . }
    } }
        OPTIONAL { ?item wdt:P625 ?coord . }
        OPTIONAL { ?item wdt:P18 ?image . }
        ?item wdt:P3018 ?park .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr, en" . } . 
}
Try it!

Quelques autres requêtes edit