query-f46f6a30ae55e5a8e3388d70fe3febf3
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
SELECT ?pageview ?date ?death WHERE {
wd:Q86886544 p:P1603 [ps:P1603 ?pageview;
pq:P585 ?pointintime;
].
OPTIONAL {
wd:Q86886544 p:P1120 [ps:P1120 ?death;
pq:P585 ?pointintime;
].
}
BIND(YEAR(?pointintime) AS ?da_nac) #a
BIND(MONTH(?pointintime) AS ?m_nac) #m
BIND(DAY(?pointintime) AS ?a_nac) #da
BIND(CONCAT(IF((STRLEN(STR(?da_nac))) = 1, CONCAT("0", STR(?da_nac)), STR(?da_nac)), "-",
IF((STRLEN(STR(?m_nac))) = 1, CONCAT("0", STR(?m_nac)), STR(?m_nac)), "-",
STR(?a_nac)) AS ?date)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?a_nac")
v4("?da_nac")
v7("?date"):::projected
v3("?death"):::projected
v5("?m_nac")
v1("?pageview"):::projected
v2("?pointintime")
a1((" "))
a2((" "))
c3(["wd:Q86886544"]):::iri
a1 --"p:statement/P1603"--> v1
a1 --"p:qualifier/P585"--> v2
c3 --"p:P1603"--> a1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
a2 -."p:statement/P1120".-> v3
a2 --"p:qualifier/P585"--> v2
c3 --"p:P1120"--> a2
end
bind0[/"year-from-dateTime(?pointintime)"/]
v2 --o bind0
bind0 --as--o v4
bind1[/"month-from-dateTime(?pointintime)"/]
v2 --o bind1
bind1 --as--o v5
bind2[/"day-from-dateTime(?pointintime)"/]
v2 --o bind2
bind2 --as--o v6
bind3[/"concat(if(string-length(str(?da_nac)) = '1^^xsd:integer',concat('0',str(?da_nac)),str(?da_nac)),'-',if(string-length(str(?m_nac)) = '1^^xsd:integer',concat('0',str(?m_nac)),str(?m_nac)),'-',str(?a_nac))"/]
v4 --o bind3
v5 --o bind3
v6 --o bind3
bind3 --as--o v7