forked from zbw/sparql-queries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcount_filmsections.rq
50 lines (48 loc) · 1.41 KB
/
count_filmsections.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
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX zbwext: <http://zbw.eu/namespaces/zbw-extensions/>
# count filmsections, aggregated by collection and filming
select (str(?cnt) as ?sectionCount) ?collection ?filming
where {
graph <http://zbw.eu/beta/film/ng> {
{
select (count(?section) as ?cnt) ?collection ?filming
where {
?section a zbwext:Pm20FilmItem .
# film subsets currently lack filming and collection properties
# so we use uri substrings
##?section dct:isPartOf $film.
##?film a zbwext:Pm20Film .
##?film dct:isPartOf ?subset .
bind(substr(str(?section), 27, 1) as ?filming)
bind(substr(str(?section), 29, 2) as ?collection)
}
group by ?collection ?filming
}
union
{
select (count(?section) as ?cnt) ?collection ('all' as ?filming)
where {
?section a zbwext:Pm20FilmItem .
bind(substr(str(?section), 29, 2) as ?collection)
}
group by ?collection
}
union
{
select (count(?section) as ?cnt) ('all' as ?collection) ?filming
where {
?section a zbwext:Pm20FilmItem .
bind(substr(str(?section), 27, 1) as ?filming)
}
group by ?filming
}
union
{
select (count(?section) as ?cnt) ('all' as ?collection) ('all' as ?filming)
where {
?section a zbwext:Pm20FilmItem .
}
}
}
}
order by ?collection ?filming