query-3bb52f950806187d17a745dd0eaf275e

rq turtle/ttl

Third query, correct optionality SELECT ?book ?title ?illustratorLabel ?publisherLabel ?published WHERE { ?book wdt:P50 wd:Q35610. # required wdt:P50 OPTIONAL { ?book wdt:P1476 ?title } # optional wdt:P1476 OPTIONAL { ?book wdt:P110 ?illustrator } # optional wdt:P110 OPTIONAL { ?book wdt:P123 ?publisher } # optional wdt:P123 OPTIONAL { ?book wdt:P577 ?published } # optional wdt:P577 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } LIMIT 42

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#>
#Third query, correct optionality
SELECT ?book ?title ?illustratorLabel ?publisherLabel ?published
WHERE
{
            ?book wdt:P50   wd:Q35610.        # required wdt:P50
 OPTIONAL { ?book wdt:P1476   ?title        } # optional wdt:P1476
 OPTIONAL { ?book wdt:P110    ?illustrator  } # optional wdt:P110
 OPTIONAL { ?book wdt:P123    ?publisher    } # optional wdt:P123
 OPTIONAL { ?book wdt:P577    ?published    } # optional wdt:P577
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 42

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?book"):::projected v3("?illustrator") v5("?published"):::projected v4("?publisher") v2("?title"):::projected c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::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