query-1e37fee1dce617d9d5260dc255f75697

rq turtle/ttl

Arquitecte i estil. Mostra de com tractar variables com a text. SELECT DISTINCT ?item ?itemLabel ?detall WHERE { ?item wdt:P17 wd:Q29. ?item wdt:P131 wd:Q3389521. OPTIONAL { ?item wdt:P84 ?arq. ?arq rdfs:label ?arqEtiq. FILTER(LANG(?arqEtiq)="ca") } OPTIONAL { ?item wdt:P149 ?estil. ?estil rdfs:label ?estilEtiq. FILTER(LANG(?estilEtiq)="ca") } BIND(CONCAT(IF(BOUND(?arqEtiq),CONCAT("Arquitecte:",?arqEtiq,""),""), IF(BOUND(?estilEtiq),CONCAT("Estil: ",?estilEtiq),"")) as ?detall) SERVICE wikibase:label {bd:serviceParam wikibase:language "ca,en" .} } ORDER BY ?itemLabel

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#>
# Arquitecte i estil. Mostra de com tractar variables com a text.
SELECT DISTINCT ?item ?itemLabel ?detall WHERE {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P131 wd:Q3389521.
  OPTIONAL {
  ?item wdt:P84 ?arq.
  ?arq rdfs:label ?arqEtiq.
  FILTER(LANG(?arqEtiq)="ca")
  }
  OPTIONAL {
  ?item wdt:P149 ?estil.
  ?estil rdfs:label ?estilEtiq.
  FILTER(LANG(?estilEtiq)="ca")
  }
  BIND(CONCAT(IF(BOUND(?arqEtiq),CONCAT("Arquitecte:",?arqEtiq,"</br>"),""), 
              IF(BOUND(?estilEtiq),CONCAT("Estil: ",?estilEtiq),"")) as ?detall)
  SERVICE wikibase:label {bd:serviceParam wikibase:language "ca,en" .}
}
ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?arq") v3("?arqEtiq") v7("?detall"):::projected v6("?estil") v2("?estilEtiq") v4("?item"):::projected v1("?itemLabel"):::projected c5(["wd:Q3389521"]):::iri c3(["wd:Q29"]):::iri c10(["bd:serviceParam"]):::iri c12(["ca,en"]):::literal v4 --"wdt:P17"--> c3 v4 --"wdt:P131"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P84".-> v5 v5 --"rdfs:label"--> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P149".-> v6 v6 --"rdfs:label"--> v2 end bind0[/"concat(if(bound(?arqEtiq),concat('Arquitecte:',?arqEtiq,'</br>'),''),if(bound(?estilEtiq),concat('Estil: ',?estilEtiq),''))"/] v3 --o bind0 v2 --o bind0 bind0 --as--o v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end