User:Realworldobject/Test1: Difference between revisions

From Wikidata
Jump to navigation Jump to search
Content deleted Content added
Initial setup
(No difference)

Revision as of 15:18, 10 March 2016

Apologies to User:Pyb for borrowing User:Pyb/Test4 as a template for my own tests. (Hopefully the hyperlink acts as fair and sufficient attribution under the Creative Commons license.)

Links :

Père-Lachaise Cemetery

On this day

People buried in Père-Lachaise (cemetery + columbarium) born or dead today


SELECT ?entity ?entityS ?image ?event (year(?date) as ?year) WHERE {  # show label then wikidata id
    
   {
      ?entityS wdt:P119 wd:Q311  .                        # cimetière du Père-Lachaise   
   } UNION {                                              # OR (claim[119:311,119:3006253])
      ?entityS wdt:P119 wd:Q3006253                       # columbarium du Père-Lachaise
   } .         

   {
      ?entityS wdt:P569 ?date .                           # date de naissance
      BIND ('naissance' AS ?event) .
   } UNION {                                              # OR
      ?entityS wdt:P570 ?date .                           # date de décès
      BIND ('décès' AS ?event) .
   } .  

   OPTIONAL { ?entityS wdt:P1442 ?image } .
                       
   SERVICE wikibase:label {
     bd:serviceParam wikibase:language "fr,en" .       # show label in French or in English (if French is missing)
     ?entityS rdfs:label ?entity
   } 
   FILTER (datatype(?date) = xsd:dateTime)      
   FILTER (month(?date) = month(now()))
   FILTER (day(?date) = day(now()))           
 }
ORDER BY ?date                                          # sort by date
LIMIT 100
Try it!

by division number

List of people buried in Père-Lachaise (cemetery + columbarium) by division number

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>SELECT ?personne ?personneLabel ?numéro_de_division WHERE {
   
   {
   ?personne wdt:P31 wd:Q5 .  
   ?personne p:P119 ?déclaration .             # déclaration du lieu d'enterrement
   ?déclaration v:P119 wd:Q311 .               # -> Cimetière du Père-Lachaise
   ?déclaration pq:P965 ?numéro_de_division .
   
   }UNION{

   ?personne wdt:P31 wd:Q5 .  
   ?personne p:P119 ?déclaration .             # déclaration du lieu d'enterrement
   ?déclaration v:P119 wd:Q3006253 .           # -> Columbarium du Père-Lachaise
   ?déclaration pq:P965 ?numéro_de_division .  
   }
  
   SERVICE wikibase:label {
    bd:serviceParam wikibase:language "fr, en" .
   }

 } ORDER BY xsd:integer(?numéro_de_division)
Try it!


Number of people buried in Père-Lachaise (cemetery + columbarium) by division number

PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>SELECT ?division (count(*) as ?count) WHERE {
   {
   ?human wdt:P31 wd:Q5 .
   ?human p:P119 ?burial_place_statement .
   ?burial_place_statement v:P119 wd:Q311 .
   ?burial_place_statement pq:P965 ?division .
   }UNION{
   ?human wdt:P31 wd:Q5 .
   ?human p:P119 ?burial_place_statement .
   ?burial_place_statement v:P119 wd:Q3006253 .
   ?burial_place_statement pq:P965 ?division .  
   }
 } 

GROUP BY ?division
ORDER BY DESC(?count) ASC(xsd:integer(?division))
Try it!

by year of death

Number of people buried in Père-Lachaise (cimcemetery + columbarium) by year of death

SELECT ?year (COUNT (DISTINCT ?a) AS ?count) WHERE {
   ?a wdt:P119 wd:Q311 .    # buried at Père-lachaise cemetery 
   ?a wdt:P570 ?date . 
   BIND(year(?date) AS ?year)
} GROUP BY ?year ORDER BY ?year
Try it!

by gender

SELECT ?cid ?cause (count(*) as ?count)
WHERE {
    ?pid wdt:P119 wd:Q311 .
    ?pid wdt:P21 ?cid .
    OPTIONAL {
        ?cid rdfs:label ?cause filter (lang(?cause) = "en") .
    }
}
GROUP BY ?cid ?cause
ORDER BY DESC(?count) ASC(?cause)
Try it!

by age (find centenarians)

SELECT ?human ?humanLabel ?naissance ?deces (?deces - ?naissance AS ?result) WHERE {
  ?human wdt:P119 wd:Q311 . 
  ?human wdt:P569 ?birth .
  ?human wdt:P570 ?death .
BIND(year(?birth) AS ?naissance)
BIND(year(?death) AS ?deces)
SERVICE wikibase:label {bd:serviceParam wikibase:language "fr" .}
}
ORDER BY DESC(?result)
Try it!


by death location

SELECT ?human ?humanLabel ?cityLabel ?countryLabel WHERE {
  ?human wdt:P119 wd:Q311 . 
  ?human wdt:P20 ?city .
  ?city wdt:P17 ?country .
SERVICE wikibase:label {bd:serviceParam wikibase:language "fr" .}
}
ORDER BY ?countryLabel ?cityLabel
Try it!


by occupation

SELECT ?human ?humanLabel ?occupationLabel WHERE {
  ?human wdt:P119 wd:Q311 . 
  ?human wdt:P106 ?occupation .
SERVICE wikibase:label {bd:serviceParam wikibase:language "fr" .}
}
ORDER BY ?occupationLabel
Try it!

by cemetery

SELECT ?id ?lieu (count(*) as ?nombre)
WHERE {
    ?pid wdt:P31 wd:Q5 .
    ?pid wdt:P119 ?id .
    OPTIONAL {
        ?id rdfs:label ?lieu filter (lang(?lieu) = "fr") .
    }

}

GROUP BY ?id ?lieu
ORDER BY DESC(?nombre) ASC(?lieu)
LIMIT 50
Try it!

WikiCheese

Cheeses AOC by area

SELECT ?fromage ?fromageLabel ?aire WHERE {
   ?fromage wdt:P31 wd:Q10943 .
   ?fromage wdt:P1389 wd:Q1565828 .
   ?fromage wdt:P2046 ?aire .

   SERVICE wikibase:label {
    bd:serviceParam wikibase:language "fr" .
   }

 } ORDER BY ?aire
Try it!