-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsynonyms_by_stw_id.rq
47 lines (46 loc) · 1.29 KB
/
synonyms_by_stw_id.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
# List of synonyms by id
#
# Uses STW descriptors as well as exact matching concepts from other thesauri
#
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX zbwext: <http://zbw.eu/namespaces/zbw-extensions/>
#
select distinct ?id (sample(?stw) as ?concept) (str(sample(?prefLabel)) as ?conceptLabel)
(group_concat(?synonym; separator = ' | ') as ?synonyms)
where {
# nested select necessary for excluding duplicates _before_ concatenating
# (for highlighting in EconBiz, labels should not be lowercased)
select distinct ?id ?stw ?prefLabel (str(?label) as ?synonym)
where {
values ( ?language ) {
( "en" )
}
?stw a zbwext:Descriptor ;
skos:prefLabel ?prefLabel .
filter (lang(?prefLabel) = ?language)
{
# include all labels from STW
{
?stw skos:prefLabel ?label
}
UNION
{
?stw skos:altLabel ?label
}
# include labels from matching concepts in other thesauri
UNION
{
?stw skos:exactMatch/skos:prefLabel ?label
}
UNION
{
?stw skos:exactMatch/skos:altLabel ?label
}
}
# activate next line for synonyms in a single language
##FILTER (lang(?label) = ?language)
#
bind(strafter(str(?stw), 'stw/descriptor/') as ?id)
}
}
group by ?id