User:Aude/query-examples

From Wikidata
Jump to navigation Jump to search

Black Lunch Table - Chicago artists[edit]

SELECT ?item ?itemLabel ?birthplaceLabel ?place_of_deathLabel ?residenceLabel WHERE {
  ?item wdt:P31 wd:Q5.
  ?item wdt:P972 wd:Q28781198.
  OPTIONAL { ?item wdt:P19 ?birthplace. }
  OPTIONAL { ?item wdt:P20 ?place_of_death. }
  OPTIONAL { ?item wdt:P551 ?residence. }
  FILTER(?birthplace = wd:Q1297 || ?place_of_death = wd:Q1297 || ?residence = wd:Q1297)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 1000

Materials used (P186), most common[edit]

SELECT DISTINCT ?materialUsed ?materialUsedLabel (COUNT(?painting) AS ?count)
WHERE 
{
  ?painting wdt:P31 wd:Q3305213.
  ?painting wdt:P186 ?materialUsed.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?materialUsedLabel ?materialUsed
LIMIT 500

Artists with links to museum collections and mix & match[edit]

SELECT ?itemLabel ?museumLabel ?artistLabel ?museurl ?mixurl WHERE {
  ?item wdt:P195 ?museum.
  ?museum wdt:P276 ?location.
  ?location wdt:P131* wd:Q60.
  ?item wdt:P170 ?artist.
  ?artist wdt:P21 wd:Q6581072.
  OPTIONAL {
    {
      ?item wdt:P3634 ?METobjID.
      BIND((CONCAT ("[http://www.metmuseum.org/art/collection/search/", ?METobjID, " ", "artwork page]")) as ?museurl) .
    } UNION {
      ?item wdt:P2014 ?MOMAobjID.
      BIND ((CONCAT ("[https://www.moma.org/collection/works/", ?MOMAobjID, " ", "artwork page]")) as ?museurl) .   
    }
    ?artist rdfs:label ?artistname .
    FILTER (lang(?artistname) = "en") .
    BIND(CONCAT("[https://tools.wmflabs.org/mix-n-match/#/search/", REPLACE(STR(?artistname), " ", "%20"), " search in Mix'n'match]") AS ?mixurl)  .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Women in Red cartoonists (missing Wikipedia articles)[edit]

SELECT ?item ?lambiekurl WHERE {
  {?item wdt:P106/wdt:P279* ?prof .
  
  
  VALUES ?prof {
                wd:Q715301  # comics artists
                wd:Q1114448 # cartoonists 
                }
                
  ?item wdt:P31 wd:Q5 .
  ?item wdt:P21 wd:Q6581072 .
  
  } UNION  {  
  ?item wdt:P31 wd:Q5 .
  ?item wdt:P21 wd:Q6581072 .
  ?item wdt:P5035 ?lambiek .
  BIND ((CONCAT ("[https://www.lambiek.net/artists/", ?lambiek, ".htm entry]")) as ?lambiekurl) .
  }
  FILTER NOT EXISTS { ?wen schema:about ?item; schema:isPartOf <https://en.wikipedia.org/> . }
}

State birds[edit]

#State birds
SELECT ?item ?itemLabel ?symbolLabel ?symbolTypeLabel
WHERE 
{
  ?item wdt:P31 wd:Q35657 .
  ?item p:P2238 ?statement .
  ?statement ps:P2238 ?symbol .
  ?statement pq:P3831 ?symbolType .
  ?symbolType wdt:P31*/wdt:P279* wd:Q5113 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?itemLabel

State flowers[edit]

#State birds
SELECT ?item ?itemLabel ?symbolLabel ?symbolTypeLabel
WHERE 
{
  ?item wdt:P31 wd:Q35657 .
  ?item p:P2238 ?statement .
  ?statement ps:P2238 ?symbol .
  ?statement pq:P3831 ?symbolType .
  ?symbolType wdt:P31*/wdt:P279* wd:Q506 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?itemLabel