query-b21e907e3b081a798b9dfc6985d57c48

rq turtle/ttl

musicals and rock operas first performed in Hungary with the list of authors SELECT DISTINCT ?musical ?musicalLabel ?premieredate ?premiereplaceLabel (GROUP_CONCAT(DISTINCT(?author); separator=" – ") as ?authors) WHERE { { ?musical wdt:P31/wdt:P279 wd:Q2743 . } UNION { ?musical wdt:P31/wdt:P279 wd:Q253137 . } ?musical p:P1191 [ ps:P1191 ?premieredate; pq:P276 ?premiereplace ] . ?premiereplace wdt:P131+ wd:Q28 OPTIONAL { ?musical (wdt:P86|wdt:P676|wdt:P87)/rdfs:label ?author FILTER (lang(?author) = "hu") . } SERVICE wikibase:label { bd:serviceParam wikibase:language "hu" . } } GROUP BY ?musical ?musicalLabel ?premieredate ?premiereplaceLabel ORDER BY ASC(?premieredate)

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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# musicals and rock operas first performed in Hungary with the list of authors
SELECT DISTINCT ?musical ?musicalLabel ?premieredate ?premiereplaceLabel
(GROUP_CONCAT(DISTINCT(?author); separator=" – ") as ?authors)
WHERE {
  { ?musical wdt:P31/wdt:P279* wd:Q2743 . }
  UNION
  { ?musical wdt:P31/wdt:P279* wd:Q253137 . }
  ?musical p:P1191 [
    ps:P1191 ?premieredate;
    pq:P276 ?premiereplace
  ] .
  ?premiereplace wdt:P131+ wd:Q28
  OPTIONAL { ?musical (wdt:P86|wdt:P676|wdt:P87)/rdfs:label ?author FILTER (lang(?author) = "hu") . }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "hu" .
  }
} GROUP BY ?musical ?musicalLabel ?premieredate ?premiereplaceLabel ORDER BY ASC(?premieredate)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?author"):::projected v5("?authors") v3("?musical"):::projected v1("?premieredate"):::projected v4("?premiereplace") a1((" ")) a2((" ")) a3((" ")) a4((" ")) c1(["hu"]):::literal c10(["wd:Q28"]):::iri c16(["bd:serviceParam"]):::iri c5(["wd:Q253137"]):::iri c4(["wd:Q2743"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P31"--> a2 a2 --"p:direct/P279"--> c5 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c4 end union0r <== or ==> union0l end a3 --"p:statement/P1191"--> v1 a3 --"p:qualifier/P276"--> v4 v3 --"p:P1191"--> a3 v4 --"p:direct/P131"--> c10 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v3 -."p:direct/P87".-> a4 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P676"--> a4 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P86"--> a4 end union1r <== or ==> union1l end a4 --"rdfs:label"--> v2 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c16 --"wikibase:language"--> c1 end bind1[/"?author"/] v2 --o bind1 bind1 --as--o v5