forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
count_synonyms.rq
63 lines (63 loc) · 1.91 KB
/
count_synonyms.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
63
# Number of different (lowercased) synonymous terms from STW
# with optional complementation from exact matching concepts
# of other vocabularies
#
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX zbwext: <http://zbw.eu/namespaces/zbw-extensions/>
#
select ?count ?label
where {
{
select (str(count(distinct ?term)) as ?count) ("Terms from STW" as ?label)
where {
?stw a zbwext:Descriptor ;
skos:prefLabel|skos:altLabel ?someLabel .
bind(lcase(str(?someLabel)) as ?term)
}
} union {
select (str(count(distinct ?term)) as ?count) ("Terms from exact matching concepts in other vocabularies" as ?label)
where {
?stw a zbwext:Descriptor ;
skos:exactMatch/skos:prefLabel|skos:altLabel ?someLabel .
bind(lcase(str(?someLabel)) as ?term)
}
} union {
bind("Synonyms from STW alone" as ?label)
{
select (count(distinct ?term) as ?termCount)
where {
?stw a zbwext:Descriptor ;
skos:prefLabel|skos:altLabel ?someLabel .
bind(lcase(str(?someLabel)) as ?term)
}
}
{
select (count(distinct ?term) as ?prefLabelCount)
where {
?stw a zbwext:Descriptor ;
skos:prefLabel ?someLabel .
bind(lcase(str(?someLabel)) as ?term)
}
}
bind(str(?termCount - ?prefLabelCount) as ?count)
} union {
bind("Synonyms from STW enhanced by matching concepts" as ?label)
{
select (count(distinct ?term) as ?termCount)
where {
?stw a zbwext:Descriptor ;
skos:exactMatch?/skos:prefLabel|skos:altLabel ?someLabel .
bind(lcase(str(?someLabel)) as ?term)
}
}
{
select (count(distinct ?term) as ?prefLabelCount)
where {
?stw a zbwext:Descriptor ;
skos:prefLabel ?someLabel .
bind(lcase(str(?someLabel)) as ?term)
}
}
bind(str(?termCount - ?prefLabelCount) as ?count)
}
}