query-d822b1e5439ca2176b558a3c7d79be55
What happened to the other books?The Optional function is needed so that all entries are kept.
Use at
- https://query.wikidata.org/sparql
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 ?book ?bookLabel ?publisherLabel ?publicationDate ?awardsLabel
WHERE {
?book wdt:P50 wd:Q34660 .
OPTIONAL {?book wdt:P123 ?publisher .}
OPTIONAL {?book wdt:P577 ?publicationDate .}
OPTIONAL {?book wdt:P166 ?awards .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
Query found at
- https://www.wikidata.org/wiki/User:Beat_Estermann/WD-Intro-2019-09-26
- https://www.wikidata.org/wiki/User:Beat_Estermann/WD-Intro-2020-08-25
- https://www.wikidata.org/wiki/User:Beat_Estermann/WD-Intro-2020-11-16
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?awards")
v1("?book"):::projected
v3("?publicationDate"):::projected
v2("?publisher")
c2(["wd:Q34660"]):::iri
c7(["bd:serviceParam"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"wdt:P50"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P123".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P577".-> v3
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P166".-> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end