query-155d93f5f671ff3ce0dc770781c8526d
Requesting the value of a qualifier that may or may not exist
Use at
- https://query.wikidata.org/sparql
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?entity ?desc (year(?date) as ?year) ?work {
wd:Q238702 p:P166 [ps:P166 ?entity ; pq:P585 ?date ; pq:P1686 ?work1]
OPTIONAL { ?entity rdfs:label ?desc FILTER((LANG(?desc)) = "en") }
OPTIONAL { ?work1 rdfs:label ?work FILTER((LANG(?work)) = "en") }
} ORDER BY ?year
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?date"):::projected
v3("?desc"):::projected
v4("?entity"):::projected
v2("?work"):::projected
v6("?work1")
v7("?year")
a1((" "))
c5(["wd:Q238702"]):::iri
a1 --"p:statement/P166"--> v4
a1 --"p:qualifier/P585"--> v5
a1 --"p:qualifier/P1686"--> v6
c5 --"p:P166"--> a1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."rdfs:label".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v6 -."rdfs:label".-> v2
end
bind0[/"year-from-dateTime(?date)"/]
v5 --o bind0
bind0 --as--o v7