A set of SPARQL examples that are used in different TGX resources
License: https://www.gnu.org/licenses/gpl-3.0
Uses method in: https://github.com/WDscholia/scholia/tree/master/scholia/app/templates/event_timeline.sparql
Event aspect: timeline
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://wikidata.org/entity/>
PREFIX wikibase: <http://wikiba.se/ontology#>
#defaultView:Timeline
PREFIX target: <http://www.wikidata.org/entity/Q133457282>
SELECT ?time ?item ?itemLabel ?image
WHERE {
{
target: wdt:P580 | wdt:P585 ?time .
OPTIONAL { target: wdt:P18 ?image . }
BIND(wd:Q24575110 AS ?item)
}
UNION
{
target: wdt:P582 ?time .
OPTIONAL { target: wdt:P18 ?image . }
BIND(wd:Q24575125 AS ?item)
}
UNION
{ target: p:P793 [ ps:P793 ?item ; pq:P585 ?time ] . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?image"):::projected
v4("?item"):::projected
v1("?time"):::projected
a1((" "))
c10([http://www.bigdata.com/rdf#serviceParam]):::iri
c1(["wd:Q133457282"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal
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;
a1 --"p:statement/P793"--> v4
a1 --"p:qualifier/P585"--> v1
c1 --"p:P793"--> a1
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
c1 --"p:direct/P582"--> v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
c1 -."p:direct/P18".-> v2
end
bind0[/"http://wikidata.org/entity/Q24575125"/]
bind0 --as--o v4
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
c1 --"p:direct/P585"--> v1
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
c1 --"p:direct/P580"--> v1
end
union2r <== or ==> union2l
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
c1 -."p:direct/P18".-> v2
end
bind1[/"http://wikidata.org/entity/Q24575110"/]
bind1 --as--o v4
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end