Wikidata:Events/LkPast-WD/Exemples

Exemples SPARQL

P485

edit
#élément disposant de plus d'une valeur en P485
SELECT ?item ?itemLabel (COUNT(?value) AS ?count )
WHERE 
{
  ?item p:P485 ?property.
  ?property ps:P485 ?value.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel
HAVING (?count > 1)
ORDER BY DESC (?count)
Try it!
#Les types d'éléments (avec leur nombre) archivés par une institution
SELECT ?type ?typeLabel (COUNT(?type) AS ?count)
WHERE 
{
  ?item wdt:P485 wd:Q182542;#l'institution en question
        wdt:P31 ?type.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?type ?typeLabel
ORDER BY DESC (?count)
Try it!
#Les types d'éléments "archivé par"
SELECT ?type ?typeLabel (COUNT(?type) AS ?count)
WHERE 
{
  ?item wdt:P485 ?institution;#l'institution en question
        wdt:P31 ?type.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?type ?typeLabel
ORDER BY DESC (?count)
Try it!

P518

edit
#list of item using P485 with as qualifier P518 (s'applique à)
SELECT DISTINCT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT(?typeLabel); separator=", ") as ?typesLabel)
WHERE {
?item p:P485 ?statement. 
?statement ps:P485 ?archives. #option avoir déposé ses archives dans une institution
?statement pq:P518 ?type.
SERVICE wikibase:label {
  bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,it,de,nl,en".
  ?item rdfs:label ?itemLabel;
        schema:description ?itemDescription.
  ?type rdfs:label ?typeLabel.
}
}
GROUP BY ?item ?itemLabel ?itemDescription ?typesLabel
ORDER BY ?itemDescription ?itemLabel
LIMIT 100
Try it!

P217

edit
#list of item with a femal gender using P485 with as qualifier P217 (inventory number)
SELECT DISTINCT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT(?noLabel); separator=", ") as ?nosLabel)
WHERE {
  ?item wdt:P21 wd:Q6581072.
?item p:P485 ?statement. 
?statement ps:P485 ?archives. #option avoir déposé ses archives dans une institution
?statement pq:P217 ?no.
SERVICE wikibase:label {
  bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,it,de,nl,en".
  ?item rdfs:label ?itemLabel;
        schema:description ?itemDescription.
  ?no rdfs:label ?noLabel.
}
}
GROUP BY ?item ?itemLabel ?itemDescription ?nosLabel
ORDER BY ?itemDescription ?itemLabel
LIMIT 100
Try it!
#list of item with a femal gender using P485 with as qualifier P217 (inventory number) and with a Wikipedia-ca page.
SELECT DISTINCT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT(?noLabel); separator=", ") as ?nosLabel)
WHERE {
  ?item wdt:P21 wd:Q6581072.
?item p:P485 ?statement. 
?statement ps:P485 ?archives. #option avoir déposé ses archives dans une institution
?statement pq:P217 ?no.
   ?article schema:about ?item.
   ?article schema:isPartOf <https://ca.wikipedia.org/>.
SERVICE wikibase:label {
  bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,it,de,nl,en".
  ?item rdfs:label ?itemLabel;
        schema:description ?itemDescription.
  ?no rdfs:label ?noLabel.
}
}
GROUP BY ?item ?itemLabel ?itemDescription ?nosLabel
ORDER BY ?itemDescription ?itemLabel
LIMIT 100
Try it!
#list of item with a femal gender using P485 with as qualifier P217 (inventory number) and with a Wikipedia-ca page and in the same time a Wikipedia-fr page.
SELECT DISTINCT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT(?noLabel); separator=", ") as ?nosLabel)
WHERE {
  ?item wdt:P21 wd:Q6581072.
?item p:P485 ?statement. 
?statement ps:P485 ?archives. #option avoir déposé ses archives dans une institution
?statement pq:P217 ?no.
   ?article1 schema:about ?item;
   schema:isPartOf <https://ca.wikipedia.org/>.
   ?article2 schema:about ?item;
            schema:isPartOf <https://fr.wikipedia.org/>.
  SERVICE wikibase:label 
          {
  bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr,it,de,nl,en".
  ?item rdfs:label ?itemLabel;
        schema:description ?itemDescription.
  ?no rdfs:label ?noLabel.
          }
      }
GROUP BY ?item ?itemLabel ?itemDescription ?nosLabel
ORDER BY ?itemDescription ?itemLabel
LIMIT 100
Try it!