User:Ecritures/SPARQL


Non binary people with an article on Dutch WikipediaEdit

#genderdiversity in articles on Dutch Wikipedia
SELECT ?item ?itemLabel ?sitelink
WHERE 
{
  ?item wdt:P31 wd:Q5 .
  ?item wdt:P21 wd:Q48270 .
  ?sitelink schema:about ?item . 
  ?sitelink schema:inLanguage "nl" .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!

Leidse Hoogleraren IDsEdit

#Two Leidse Hoogleraren IDs in one Wikidata item
SELECT ?item ?itemLabel (COUNT(*) AS ?count)
WHERE { ?item p:P2861 [] 
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
      } 
GROUP BY ?item ?itemLabel HAVING(?count > 1) ORDER BY DESC(?count)

Try it!

#Leidse Hoogleraren ID (allen)
SELECT ?item ?itemLabel ?id 
WHERE 
{
  ?item wdt:P2861 ?id.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!

#Leidse Hoogleraren ID (vrouwelijke)
SELECT ?person ?personLabel ?id 
WHERE 
{
  ?person wdt:P21 wd:Q6581072 .
  ?person wdt:P2861 ?id 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!

People who died before 1815 but still have country of citizenship (P27) with Kingdom of the Netherlands (Q29999)Edit

>> query

Makers in a museum whose work is represented by PictorightsEdit

>> Lists makers with works in collection of a specific museum (in this case Museum Boijmans Van Beuningen (Q679527) whose work is represented by Pictoright AND who have died less than 70 years ago or are still alive

Overview of Dutch GLAMs with their own organisation IDEdit

Dutch cultural heritage institution and their organisation id on wikidata (Wikidata property (P1687))

SELECT DISTINCT ?item ?itemLabel ?identifierLabel
#Dutch GLAMs with their own identifier on Wikidata
WHERE 
{
  { ?item wdt:P31/wdt:P279* wd:Q33506 .} UNION { ?item wdt:P31/wdt:P279* wd:Q166118 .} UNION { ?item wdt:P31/wdt:P279* wd:Q7075 . } UNION { ?item wdt:P31/wdt:P279* wd:Q207694 . } 
  ?item wdt:P17 wd:Q55 .                             #in The Netherlands
  ?item wdt:P1687 ?identifier .                      #with an identifier
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "nl,en". }
}

Try it!

Map of museums in which a specific maker has works in the collectionEdit

Shows a map of the museums in which a specific maker (in this case Paulus Constantijn la Fargue (Q2336473))) has works in the collection (P6379)

SELECT ?museumLabel ?geocoordinates {
#Map with 'works in collection' of a specific maker 
#defaultView:Map
VALUES ?maker { wd:Q2336473 }       #Qid of the maker
  ?maker wdt:P6379 ?museum .        #has works in collection 
  ?museum wdt:P625 ?geocoordinates  #geocoordinates
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!

Female authors in the WomenWiters database of the Huygens Institute for the History of the Netherlands (Q2257204) (part of the Royal Netherlands Academy of Arts and Sciences (Q253439))Edit

I am making a map of streets of female authors (in this database) that have a street named after them. In order for the street names on this map to be shown correctly I needed to (manually) add the named after (P138) property to many Dutch street names. Next goal: to make an overview of paintings of the female authors in this database

#defaultView:Map
select ?item ?itemLabel ?itemDescription ?WWid ?coord where {
  ?item wdt:P31 wd:Q79007 .
  ?item wdt:P138 ?vernoemd .
  ?item wdt:P625 ?coord .
  ?vernoemd wdt:P2533 ?WWid .
  ?vernoemd wdt:P21 wd:Q6581072 .
  # place of birth = Kingdom of the Netherlands (Q29999)
  { ?vernoemd wdt:P19 wd:Q29999 }
# OR place of birth within Kingdom of the Netherlands.
UNION  { ?vernoemd wdt:P19 ?pob . ?pob wdt:P131* wd:Q29999 }
  SERVICE wikibase:label {
        bd:serviceParam wikibase:language "nl" .
      }
}

Try it!

DBNL article on english or dutch wikipediaEdit

select ?item ?itemLabel ?dbnl ?_articleEN ?_articleNL where {
  ?item wdt:P723 ?dbnl. # DBNL id
  OPTIONAL {
    ?_articleEN schema:about ?item.
    ?_articleNL schema:about ?item.
    ?_articleEN schema:isPartOf <https://en.wikipedia.org/>.
    ?_articleNL schema:isPartOf <https://nl.wikipedia.org/>.
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,nl". }
}

Try it!

Query with qualifiersEdit

SELECT DISTINCT ?countryLabel ?population ?gem_ident_code ?date
{
  ?country wdt:P31 wd:Q747074 .
  ?country wdt:P635 ?gem_ident_code .
  ?country p:P1082 ?populationStatement .
        ?populationStatement    ps:P1082 ?population
        ; pq:P585 ?date .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
#GROUP BY ?countryLabel ?date
ORDER BY ?countryLabel DESC(?date)
LIMIT 100

Try it!

Floruit uit qualifiers bij geen dob/dodEdit

SELECT ?item ?itemLabel ?property ?propertyLabel ?qualifier ?qualifierLabel ?time ?precision
WHERE
{
  {
    SELECT ?item ?claim ?qualifiervalue ?time ?precision
    WHERE
    {
      ?item wdt:P31 wd:Q5.
      ?item wdt:P6379 wd:Q17153751.
      
  
      # Get truthy statements for ?item with any of time qualifiers in ?qualifiervalue:
      VALUES ?qualifiervalue { pqv:P580 pqv:P582 pqv:P585 }
      ?item ?claim ?statement.
      ?statement a wikibase:BestRank.
      ?statement ?qualifiervalue ?timenode.
      ?timenode wikibase:timePrecision ?precision.
      ?timenode wikibase:timeValue ?time.
      FILTER (?precision > 8) #only year or better precision
    }
  }
  hint:Prior hint:runFirst "true".
  FILTER NOT EXISTS { ?item wdt:P7763 [] } .#no copyright status
  FILTER NOT EXISTS { ?item wdt:P570 [] }.  #no dod
  FILTER NOT EXISTS { ?item wdt:P1317 [] } .#no floruit

  #Get labels for item, property and qualifier:
  ?qualifier wikibase:qualifierValue ?qualifiervalue.
  ?property wikibase:claim ?claim.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!