query-8dd75d2e8a9b49a2c6a40485b681c833
KDM+dates
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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item (YEAR(?date) as ?year) (MONTH(?date) as ?month) (DAY(?date) as ?day) ?dateprecision ?KDM WHERE {
?item wdt:P170 wd:Q381238 .
MINUS{ ?item wdt:P31 wd:Q3658341 .}
optional{
?item p:P571/psv:P571 ?timenode .
?timenode wikibase:timeValue ?date.
?timenode wikibase:timePrecision ?dateprecision.
}
optional{ ?item p:P528 [ pq:P972 wd:Q106425660; ps:P528 ?KDM] . }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?KDM"):::projected
v3("?date"):::projected
v4("?dateprecision"):::projected
v8("?day")
v1("?item"):::projected
v7("?month")
v2("?timenode")
v6("?year")
a1((" "))
a2((" "))
c4(["wd:Q3658341"]):::iri
c2(["wd:Q381238"]):::iri
c10(["wd:Q106425660"]):::iri
v1 --"p:direct/P170"--> c2
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v1 --"p:direct/P31"--> c4
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P571".-> a1
a1 --"p:statement/value/P571"--> v2
v2 --"wikibase:timeValue"--> v3
v2 --"wikibase:timePrecision"--> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
a2 -."p:qualifier/P972".-> c10
a2 --"p:statement/P528"--> v5
v1 --"p:P528"--> a2
end
bind1[/"year-from-dateTime(?date)"/]
v3 --o bind1
bind1 --as--o v6
bind2[/"month-from-dateTime(?date)"/]
v3 --o bind2
bind2 --as--o v7
bind3[/"day-from-dateTime(?date)"/]
v3 --o bind3
bind3 --as--o v8