-
Notifications
You must be signed in to change notification settings - Fork 7
/
search_n_link_person.rq
62 lines (62 loc) · 2.24 KB
/
search_n_link_person.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Text search for persons, with additional data for identification
# and link to add a GND ID to an Wikidata item via QuickStatements2 link
#
# Uses diverse literal properties, brings the best match on top
# of the list
#
PREFIX gndo: <https://d-nb.info/standards/elementset/gnd#>
PREFIX text: <http://jena.apache.org/text#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
#
select distinct
(uri(concat('http://wikidata.org/entity/', max(?wdId))) as ?wd) (max(?wdId) as ?wdLabel)
?gndPerson ?gndPersonLabel
(uri(concat('http://econbiz.de/Search/Results?lookfor=gnd%3A', $gndId)) as ?eb)
('EB' as ?ebLabel)
(concat(?life, coalesce(concat("; ", group_concat(distinct str(?occupation) ;
separator = "; ")), "")) as ?shortInfo)
(group_concat(distinct ?affiliation ;
separator = "; ") as ?affiliations)
(group_concat(distinct ?info ;
separator = "; ") as ?biographicalInformation)
(uri(concat('https://tools.wmflabs.org/quickstatements/#v1=', max(?wdId), '|P227|"', ?gndId, '"')) as ?addGnd)
(concat('add GND ', ?gndId) as ?addGndLabel)
where {
# searched name, Wikidata ID to link
values ( ?name ?wdId ) {
( "William K. Black" "Q3568755" )
}
# limit number of results to 20
(?gndPerson ?score) text:query (?name 20) .
?gndPerson a gndo:DifferentiatedPerson ;
gndo:preferredNameForThePerson ?gndPersonLabel ;
gndo:gndIdentifier ?gndId .
#
# get additional information
optional {
?gndPerson gndo:professionOrOccupation/gndo:preferredNameForTheSubjectHeading ?occupation .
}
optional {
?gndPerson gndo:affiliation/gndo:preferredNameForTheCorporateBody ?affiliation .
}
optional {
?gndPerson gndo:biographicalOrHistoricalInformation ?info .
}
optional {
?gndPerson gndo:dateOfBirth ?birthDate .
}
optional {
?gndPerson gndo:dateOfDeath ?deathDate .
}
optional {
?gndPerson gndo:periodOfActivity ?activity .
}
bind(if(bound(?birthDate), str(?birthDate), '') as ?birth)
bind(if(bound(?deathDate), str(?deathDate), '') as ?death)
bind(if((bound(?birthDate) || bound(?deathDate)),
concat(?birth, ' - ', ?death),
if(bound(?activity), concat("Aktiv: ", ?activity), ' - '))
as ?life)
}
group by ?gndPerson ?score ?gndPersonLabel ?gndId ?life
order by desc(?score)