-
Notifications
You must be signed in to change notification settings - Fork 2
/
person-institution-better.txt
26 lines (25 loc) · 1.84 KB
/
person-institution-better.txt
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
# This properly handles multivalue fields (otherNames, profesion, nationality) that the original query doesn't
# CAREFUL: this is an expensive query that causes Stack Overflow on BM's endpoint, or doesn't return all data
# so you can use the split-queries here (see person-institution.sh), or just download from
# https://github.com/findsorguk/bmThesauri/blob/master/bmPerson-institution-better.tsv.gz
prefix ecrm: <http://erlangen-crm.org/current/>
select ?x ?name ?otherNames?type ?gender ?profession ?nationality ?birth ?death ?note {
?x skos:inScheme id:person-institution.
{select ?x ?name (group_concat(?other; separator="; ") as ?otherNames)
{?x skos:inScheme id:person-institution; skos:prefLabel ?name.
optional {?x ecrm:P131_is_identified_by/rdfs:label ?other filter(?other != ?name)}}
group by ?x ?name}
bind(if(exists{?x a ecrm:E21_Person},"Person","") as ?type)
optional {?x bmo:PX_gender ?gender1.
bind(strafter(str(?gender1),"gender/") as ?gender2)
bind(if(?gender2="m","male",?gender2) as ?gender)}
{select ?x (group_concat(?prof1; separator="; ") as ?profession)
{?x skos:inScheme id:person-institution; bmo:PX_profession [rdfs:label ?prof1]} group by ?x}
{select ?x (group_concat(?nation1; separator="; ") as ?nationality)
{?x skos:inScheme id:person-institution; bmo:PX_nationality [skos:prefLabel ?nation1]} group by ?x}
{select ?x (group_concat(?birth1; separator="; ") as ?birth)
{?x skos:inScheme id:person-institution; ecrm:P92i_was_brought_into_existence_by [ecrm:P4_has_time-span [rdfs:label ?birth1]]} group by ?x}
{select ?x (group_concat(?death1; separator="; ") as ?death)
{?x skos:inScheme id:person-institution; ecrm:P93i_was_taken_out_of_existence_by [ecrm:P4_has_time-span [rdfs:label ?death1]]} group by ?x}
optional {?x ecrm:P3_has_note ?note}
}