query: SELECT ?item
         ?Label_en
         ?Description_en
         (group_concat(distinct ?Alias_en;separator="; ") as ?Aliases_en)    #Concatenate the values in order not to get several rows per item.
         ?Label_de
         ?Description_de
         (group_concat(distinct ?Alias_de;separator="; ") as ?Aliases_de)
         (replace(group_concat(distinct ?Type;separator="; "), "http://www.wikidata.org/entity/", "") as ?Types)  #Strip the path in order to get only the Q-number.
         (group_concat(distinct ?TypeLabel_en;separator="; ") as ?TypeLabels_en)
         (replace(group_concat(distinct ?Municipality;separator="; "), "http://www.wikidata.org/entity/", "") as ?Municipalities)   
         (group_concat(distinct ?MunicipalityLabel_de;separator="; ") as ?MunicipalityLabels_de)
         (replace(group_concat(distinct ?Canton;separator="; "), "http://www.wikidata.org/entity/", "") as ?Cantons)
         (group_concat(distinct ?CantonLabel_de;separator="; ") as ?CantonLabels_de)
         (group_concat(distinct ?PCPNo;separator="; ") as ?PCPNos)
    WHERE {
    {?item wdt:P31 ?museum . ?museum rdfs:subClassOf* wd:Q33506 } 
      UNION {?item wdt:P31 wd:Q166118} 
      UNION {?item wdt:P31 wd:Q7075} 
      UNION {?item wdt:P31 wd:Q22806} 
      UNION {?item wdt:P31 wd:Q678405}.  
    {?item wdt:P131/wdt:P17 wd:Q39}.  
    OPTIONAL { ?item rdfs:label ?Label_en . FILTER (lang(?Label_en) = "en") }
    OPTIONAL { ?item rdfs:label ?Label_de . FILTER (lang(?Label_de) = "de") } 
    OPTIONAL { ?item rdfs:label ?Label_fr . FILTER (lang(?Label_fr) = "fr") }
    OPTIONAL { ?item rdfs:label ?Label_it . FILTER (lang(?Label_it) = "it") }
    OPTIONAL { ?item skos:altLabel ?Alias_en . FILTER (lang(?Alias_en) = "en") }
    OPTIONAL { ?item skos:altLabel ?Alias_de . FILTER (lang(?Alias_de) = "de") } 
    OPTIONAL { ?item skos:altLabel ?Alias_fr . FILTER (lang(?Alias_fr) = "fr") }
    OPTIONAL { ?item skos:altLabel ?Alias_it . FILTER (lang(?Alias_it) = "it") }
    OPTIONAL { ?item schema:description ?Description_en . FILTER (lang(?Description_en) = "en") }
    OPTIONAL { ?item schema:description ?Description_de . FILTER (lang(?Description_de) = "de") } 
    OPTIONAL { ?item schema:description ?Description_fr . FILTER (lang(?Description_fr) = "fr") }
    OPTIONAL { ?item schema:description ?Description_it . FILTER (lang(?Description_it) = "it") }
    OPTIONAL { ?item wdt:P31 ?Type. }
    OPTIONAL { ?item wdt:P31/rdfs:label ?TypeLabel_en . FILTER (lang(?TypeLabel_en) = "en") }  
    OPTIONAL { ?item wdt:P131 ?Municipality . FILTER EXISTS {?Municipality wdt:P31 wd:Q70208}}  
    OPTIONAL { ?item wdt:P131/rdfs:label ?MunicipalityLabel_de . FILTER EXISTS {?MunicipalityLabel_de ^rdfs:label/wdt:P31 wd:Q70208} . FILTER (lang(?MunicipalityLabel_de) = "de")}
    OPTIONAL { ?item wdt:P131 ?Canton . FILTER EXISTS {?Canton wdt:P31 wd:Q23058}}
    OPTIONAL { ?item wdt:P131/rdfs:label ?CantonLabel_de . FILTER EXISTS {?CantonLabel_de ^rdfs:label/wdt:P31 wd:Q23058} . FILTER (lang(?CantonLabel_de) = "de") }  
    OPTIONAL { ?item wdt:P17 ?Country. }
    OPTIONAL { ?item wdt:P17/rdfs:label ?CountryLabel_de . FILTER (lang(?CountryLabel_de) = "de") }
    OPTIONAL { ?item wdt:P381 ?PCPNo. } 
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de". }    
  }
  group by ?item                          #List all the variables for which the values are not concatenated!
           ?Label_en ?Description_en 
           ?Label_de ?Description_de 
           ?Label_fr ?Description_fr 
           ?Label_it ?Description_it 