-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmapping_cardinalities.rq
38 lines (38 loc) · 1.2 KB
/
mapping_cardinalities.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
# Cardinalities of a mapping
#
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX zbwext: <http://zbw.eu/namespaces/zbw-extensions/>
#
select
(str(?cardinality) as ?numberOfRelations)
(str(count(distinct ?stwConcept)) as ?stwConceptCount)
where {
select distinct ?stwConcept (sum(?hasRelations) as ?cardinality)
where
{
values ( ?conceptType ?foreignDatasetName ) {
# ( zbwext:Descriptor "wkdarbr" )
( zbwext:Thsys "sdmx" )
}
bind(uri(concat('http://zbw.eu/stw/mapping/', $foreignDatasetName, '/target')) as ?foreignDataset)
#
# all stw concepts of a certain type
?stwConcept a ?conceptType .
# exclude deprecated concepts
filter(not exists {
?stwConcept owl:deprecated true .
}
)
# any existing relations to a certain dataset
optional {
?stwConcept (skos:exactMatch|skos:closeMatch|skos:broadMatch|skos:narrowMatch|skos:relatedMatch) ?foreignConcept .
?foreignConcept dcterms:isPartOf ?foreignDataset .
}
bind(if(bound(?foreignConcept), 1, 0) as ?hasRelations)
}
group by ?stwConcept
}
group by ?cardinality
order by asc(?cardinality)