query-5a7ee8298b2da8474033804c5136b0db

rq turtle/ttl

title:Impressionist painters by number of exhibitions SELECT DISTINCT ?painter ?painterLabel (count (DISTINCT ?exhibition) as ?exhibition_count) (group_concat(DISTINCT ?exhibitionLabel; separator=", ") as ?exhibitions) WHERE { ?painter wdt:P106 wd:Q1028181 . #give me all people with occupation (P106) painter (Q1028181) ?painter wdt:P135 wd:Q40415 . #who belonged to the impressionist (Q40415) movement (P135) ?painting wdt:P170 ?painter . #the paintings created by (P170) the painter ?painting wdt:P608 ?exhibition . #have an exhibition history (P608) at an exhibition ?exhibition rdfs:label ?exhibitionLabel . #give me the english Labels of these exhibitions, if possible FILTER (lang(?exhibitionLabel) = "en")

SERVICE wikibase:label {bd:serviceParam wikibase:language "en".} } GROUP BY ?painter ?painterLabel

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Impressionist painters by number of exhibitions
SELECT DISTINCT ?painter ?painterLabel (count (DISTINCT ?exhibition) as ?exhibition_count)
(group_concat(DISTINCT ?exhibitionLabel; separator=", ") as ?exhibitions)
WHERE {
  ?painter wdt:P106 wd:Q1028181 . #give me all people with occupation (P106) painter (Q1028181)
  ?painter wdt:P135 wd:Q40415 . #who belonged to the impressionist (Q40415) movement (P135)
  ?painting wdt:P170 ?painter . #the paintings created by (P170) the painter
  ?painting wdt:P608 ?exhibition . #have an exhibition history (P608) at an exhibition
  ?exhibition rdfs:label ?exhibitionLabel . #give me the english Labels of these exhibitions, if possible
  FILTER (lang(?exhibitionLabel) = "en")

  SERVICE wikibase:label {bd:serviceParam wikibase:language "en".}
} GROUP BY ?painter ?painterLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?exhibition"):::projected v1("?exhibitionLabel"):::projected v5("?exhibition_count") v6("?exhibitions") v2("?painter"):::projected v3("?painting") c3(["wd:Q1028181"]):::iri c5(["wd:Q40415"]):::iri c10(["bd:serviceParam"]):::iri c1(["en"]):::literal f0[["?exhibitionLabel = 'en'"]] f0 --> v1 v2 --"wdt:P106"--> c3 v2 --"wdt:P135"--> c5 v3 --"wdt:P170"--> v2 v3 --"wdt:P608"--> v4 v4 --"rdfs:label"--> v1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c1 end bind3[/"count(?exhibition)"/] v4 --o bind3 bind3 --as--o v5 bind4[/"?exhibitionLabel"/] v1 --o bind4 bind4 --as--o v6