query-6849257611c4407d9f9a5be5d7cd1512
TODO
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT ?employer ?employerLabel ?item ?itemLabel ?coord ?layer ?startyear ?length {
?item p:P106 ?wir .
?wir ps:P106 wd:Q3809586 .
OPTIONAL { ?wir pq:P582 ?end }
OPTIONAL { ?wir pq:P580 ?start }
BIND(CONCAT('duration:', STR(MONTH(?end-?start)), 'months') AS ?length) # <- how would one calculate the duration of ?end-?start`
BIND(IF(!BOUND(?end), 'no end date', CONCAT('end: ', STR(YEAR(?end)))) AS ?layer)
BIND(IF(!BOUND(?start), 'no start date', CONCAT('start: ', STR(YEAR(?start)))) AS ?startyear)
OPTIONAL { ?wir pq:P937 ?location. ?location wdt:P625 ?coord. }
OPTIONAL { ?wir pq:P108 ?employer }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?end)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?coord"):::projected
v10("?employer"):::projected
v1("?end")
v2("?item"):::projected
v6("?layer"):::projected
v5("?length"):::projected
v8("?location")
v4("?start")
v7("?startyear"):::projected
v3("?wir")
c10(["bd:serviceParam"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q3809586"]):::iri
v2 --"p:P106"--> v3
v3 --"p:statement/P106"--> c3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P582".-> v1
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P580".-> v4
end
bind0[/"concat('duration:',str(month-from-dateTime(?end - ?start)),'months')"/]
v1 --o bind0
v4 --o bind0
bind0 --as--o v5
bind1[/"if(not bound(?end),'no end date',concat('end: ',str(year-from-dateTime(?end))))"/]
v1 --o bind1
bind1 --as--o v6
bind2[/"if(not bound(?start),'no start date',concat('start: ',str(year-from-dateTime(?start))))"/]
v4 --o bind2
bind2 --as--o v7
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P937".-> v8
v8 --"p:direct/P625"--> v9
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P108".-> v10
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end