query-91540871ddd198bbd4a4ca2c329ddc76
TODO
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#>
#Balzac timeline
#defaultView:Timeline
SELECT DISTINCT ?t ?ppLabel ?valueLabel ?rrLabel ?image
WHERE
{
{wd:Q9711 ?prop ?t FILTER (datatype(?t)=xsd:dateTime) .
?value wikibase:directClaim ?prop. }
UNION
{
wd:Q9711 ?q ?statement FILTER regex (STR(?q),"prop/P") .
?statement ?p ?t FILTER regex (STR(?p), "prop/qualifier/P") FILTER (datatype(?t)=xsd:dateTime) .
?statement ?r ?value FILTER regex (STR(?r),"prop/statement/") .
BIND(IRI(CONCAT(CONCAT(SUBSTR(STR(?r),1,29),"direct/"),SUBSTR(STR(?r),40))) as ?rprop)
?rr wikibase:directClaim ?rprop .
BIND(IRI(CONCAT(CONCAT(SUBSTR(STR(?p),1,29),"direct/"),SUBSTR(STR(?p),40))) as ?pprop)
?pp wikibase:directClaim ?pprop .
OPTIONAL {?value wdt:P18 ?image}
}
UNION
{
wd:Q9711 wdt:P800 ?value .
?value ?prop ?t FILTER (datatype(?t)=xsd:dateTime) .
?rr wikibase:directClaim wdt:P800 .
?pp wikibase:directClaim ?prop.
OPTIONAL {?value wdt:P18 ?image}
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?t
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v12("?image"):::projected
v5("?p")
v11("?pp")
v10("?pprop")
v2("?prop")
v6("?q")
v4("?r")
v8("?rprop")
v9("?rr")
v7("?statement")
v1("?t"):::projected
v3("?value")
c10(["bd:serviceParam"]):::iri
c8(["wdt:P800"]):::iri
c12(["en"]):::literal
c2(["wd:Q9711"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
f0[["?t = 'xsd:dateTime'"]]
f0 --> v1
c2 -->c8--> v3
v3 -->v2--> v1
v9 --"wikibase:directClaim"--> c8
v11 --"wikibase:directClaim"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P18".-> v12
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
f1[["regex(str(?r),'prop/statement/')"]]
f1 --> v4
f2[["?t = 'xsd:dateTime'"]]
f2 --> v1
f3[["regex(str(?p),'prop/qualifier/P')"]]
f3 --> v5
f4[["regex(str(?q),'prop/P')"]]
f4 --> v6
c2 -->v6--> v7
v7 -->v5--> v1
v7 -->v4--> v3
bind5[/"concat(concat(substring(str(?r),'1^^xsd:integer','29^^xsd:integer'),'direct/'),substring(str(?r),'40^^xsd:integer'))"/]
v4 --o bind5
bind5 --as--o v8
v9 --"wikibase:directClaim"--> v8
bind6[/"concat(concat(substring(str(?p),'1^^xsd:integer','29^^xsd:integer'),'direct/'),substring(str(?p),'40^^xsd:integer'))"/]
v5 --o bind6
bind6 --as--o v10
v11 --"wikibase:directClaim"--> v10
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P18".-> v12
end
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f7[["?t = 'xsd:dateTime'"]]
f7 --> v1
c2 -->v2--> v1
v3 --"wikibase:directClaim"--> v2
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end