query-6b17353a87886589be94a8923ef58b6c

rq turtle/ttl

Actors and Actresses born in Switzerland and/or having Swiss Citizenship Actors and Actresses born in Switzerland and/or having Swiss Citizenship Acteurs en actrices geboren in Zwitserland en/of met de Zwitserse nationaliteit

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#>
SELECT ?item 
       ?itemLabel 
       ?birthplaceLabel 
       (group_concat(distinct ?citizenshipLabel_en;separator="; ") as ?citizenshipLabels_en)    #Concatenate the values in order not to get several rows per item.
WHERE 
{
  ?item wdt:P106 wd:Q33999.
  { ?item (wdt:P19/wdt:P131*/wdt:P17) wd:Q39 } UNION { ?item wdt:P27 wd:Q39 }.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language
  OPTIONAL {?item wdt:P19 ?birthplace} .
  OPTIONAL {?item wdt:P27/rdfs:label ?citizenshipLabel_en . FILTER (lang(?citizenshipLabel_en) = "en") }
}
group by ?item                          #List all the variables for which the values are not concatenated!
         ?itemLabel
         ?birthplaceLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?birthplace") v1("?citizenshipLabel_en"):::projected v4("?citizenshipLabels_en") v2("?item"):::projected a1((" ")) a2((" ")) a3((" ")) c7(["wd:Q39"]):::iri c10(["bd:serviceParam"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal c3(["wd:Q33999"]):::iri v2 --"wdt:P106"--> c3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P27"--> c7 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P19"--> a1 a1 --"wdt:P131"--> a2 a2 --"wdt:P17"--> c7 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P19".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P27".-> a3 a3 --"rdfs:label"--> v1 end bind1[/"?citizenshipLabel_en"/] v1 --o bind1 bind1 --as--o v4