query-050009c65b8f099e444e1dd20ae282ef
obituaries without main subject
filtered by year
SELECT ?q ?qLabel ?publicationDate ?mainSubject ?mainSubjectLabel WHERE { ?q wdt:P31 wd:Q309481 ; wdt:P1433 wd:Q9684 . ?q wdt:P577 ?publicationDate . OPTIONAL { ?q wdt:P921 ?mainSubject . } # OPTIONAL { ?mainSubject wdt:P570 ?mainSubjectDeathDate . }
# FILTER(?publicationDate >= "2018-01-01"^^xsd:dateTime && ?publicationDate < "2019-01-01"^^xsd:dateTime) . FILTER(YEAR(?publicationDate) = 2018). FILTER(!BOUND(?mainSubject)).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr,nl". } } ORDER BY DESC(?mainSubject)
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
# obituaries without main subject
# filtered by year
SELECT ?q ?qLabel ?publicationDate ?mainSubject ?mainSubjectLabel WHERE {
?q wdt:P31 wd:Q309481 ; wdt:P1433 wd:Q9684 .
?q wdt:P577 ?publicationDate .
OPTIONAL { ?q wdt:P921 ?mainSubject . }
# OPTIONAL { ?mainSubject wdt:P570 ?mainSubjectDeathDate . }
# FILTER(?publicationDate >= "2018-01-01"^^xsd:date && ?publicationDate < "2019-01-01"^^xsd:dat) .
FILTER(YEAR(?publicationDate) = 2018).
FILTER(!BOUND(?mainSubject)).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr,nl". }
}
ORDER BY DESC(?mainSubject)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?mainSubject"):::projected
v2("?publicationDate"):::projected
v3("?q"):::projected
c5(["wd:Q9684"]):::iri
c9(["bd:serviceParam"]):::iri
c3(["wd:Q309481"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en,fr,nl"]):::literal
f0[["not bound(?mainSubject)"]]
f0 --> v1
f1[["year-from-dateTime(?publicationDate) = '2018^^xsd:integer'"]]
f1 --> v2
v3 --"wdt:P31"--> c3
v3 --"wdt:P1433"--> c5
v3 --"wdt:P577"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P921".-> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end