forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstruct_wd_life.rq
33 lines (33 loc) · 918 Bytes
/
construct_wd_life.rq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# create birth and death for items with PM20 id
#
PREFIX schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX zbwext: <http://zbw.eu/namespaces/zbw-extensions/>
PREFIX gndo: <https://d-nb.info/standards/elementset/gnd#>
#
construct {
?wd gndo:dateOfBirthAndDeath ?life .
}
where {
{
select ?wd (min(?birth1) as ?birth) (max(?death1) as ?death)
where {
# restrict to one item for testing
##bind(wd:Q33391 as ?wd)
#
?wd wdt:P4293 ?pm20Id ;
wdt:P31 wd:Q5 .
optional {
?wd wdt:P569 ?birthDate .
}
optional {
?wd wdt:P570 ?deathDate .
}
bind(if(bound(?birthDate), str(year(?birthDate)), '') as ?birth1)
bind(if(bound(?deathDate), str(year(?deathDate)), '') as ?death1)
}
group by ?wd
}
bind(concat(?birth, ' - ', ?death) as ?life)
}