query-5d00dac500c3850e475837fa515b09f5

rq turtle/ttl

Executeu aquesta consulta. Mentre escric això, només retorna dos resultats – una mica escàs! Per què passa això? Abans hem trobat més de dos-cents llibres! La raó és que per a coincidir amb la consulta, un resultat potencial (un llibre) ha de coincidir a totes les ternes demanades: ha de tenir un títol, un il·lustrador, un editor i una data de publicació. Només que falti una d'aquestes propietats, ja no coincidirà. I això no és el que volem, en aquest cas: primer volem una llista de tots els llibres i, si hi ha dades addicionals disponibles, les volem incloure, però en cap cas volem limitar la llista de resultats. : opcionalsLa solució és dir-li al WDQS que aquelles ternes son

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?llibre ?titol ?illustradorLabel ?editorLabel ?publicat
WHERE
{
  ?llibre wdt:P50 wd:Q35610.
  OPTIONAL { ?llibre wdt:P1476 ?titol. }
  OPTIONAL { ?llibre wdt:P110  ?ilustrador. }
  OPTIONAL { ?llibre wdt:P123  ?editor. }
  OPTIONAL { ?llibre wdt:P577  ?publicat. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?editor") v3("?ilustrador") v1("?llibre"):::projected v5("?publicat"):::projected v2("?titol"):::projected c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;"]):::literal c2(["wd:Q35610"]):::iri v1 --"wdt:P50"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P1476".-> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P110".-> v3 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P123".-> v4 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P577".-> v5 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end