-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_matrix_nochoice.rq
78 lines (75 loc) · 2.63 KB
/
make_matrix_nochoice.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#+ summary: Show the no-choice entries of the matrix (this is deprecated; the new method is via the make_tables script)
#+ method: GET
#+ pagination: 10000
prefix fip: <https://w3id.org/fair/fip/terms/>
prefix dct: <http://purl.org/dc/terms/>
prefix dce: <http://purl.org/dc/elements/1.1/>
prefix npa: <http://purl.org/nanopub/admin/>
prefix npx: <http://purl.org/nanopub/x/>
prefix np: <http://www.nanopub.org/nschema#>
prefix dcat: <https://www.w3.org/ns/dcat#>
select distinct ?fip_index ?fip_title ?community ?c ?supercommunity ?sc ?question ?q ?sort ?nochoice ?resource ?res ?reslabel ?rel ?resourcetype ?startdate ?enddate ?date where {
?np np:hasAssertion ?assertion .
graph npa:graph { ?np dct:created ?date . }
graph ?assertion {
?decl a ?nochoice .
# grlc gives an error for some reason if these two optional statements are at the end of the graph block:
optional { ?decl dcat:startDate ?startdate . }
optional { ?decl dcat:endDate ?enddate . }
?decl fip:refers-to-question ?question ;
fip:declared-by ?community .
}
optional {
?community dct:isPartOf ?supercommunity .
}
graph npa:graph { ?index_np npa:hasValidSignatureForPublicKey ?pubkey . }
?index_np np:hasAssertion ?index_a .
?index_np np:hasPublicationInfo ?index_i .
graph ?index_a {
?fip_index npx:includesElement ?np .
}
graph ?index_i {
?fip_index dce:title ?fip_title_l .
}
filter not exists {
?fip_newer_index npx:includesElement ?newer_np ;
dce:title ?fip_title_l .
graph npa:graph { ?newer_np dct:created ?newer_date . }
filter (?newer_date > ?date)
}
filter not exists {
graph npa:graph {
?index_np_new npa:hasHeadGraph ?nh .
?index_np_new npa:hasValidSignatureForPublicKey ?pubkey .
}
graph ?nh {
?index_np_new np:hasPublicationInfo ?ni .
}
graph ?ni {
?index_np_new npx:supersedes ?index_np .
}
}
filter not exists {
graph npa:graph {
?index_np_r npa:hasHeadGraph ?rh .
?index_np_r npa:hasValidSignatureForPublicKey ?pubkey .
}
graph ?rh {
?index_np_r np:hasAssertion ?ra .
}
graph ?ra {
?somebody npx:retracts ?index_np .
}
}
values ?nochoice { fip:FIP-No-Choice-Declaration fip:No-Choice-Declaration }
bind (replace(str(?community), ".*#", "") as ?c)
bind (replace(str(?supercommunity), ".*#", "") as ?sc)
bind (replace(str(?question), "^.*-([^-MD]+(-[MD]+)?)$", "$1") as ?q)
bind (concat(replace(?q, "F|M", "0"), "x") as ?sort)
bind (str(?fip_title_l) as ?fip_title)
bind ("" as ?resource)
bind ("" as ?res)
bind ("" as ?reslabel)
bind ("" as ?rel)
bind ("" as ?resourcetype)
} order by ?sort ?c