-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-agents.rq
59 lines (57 loc) · 1.45 KB
/
get-agents.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
#+ summary: Get all agents with some aggregate info
#+ method: GET
#+ endpoint_in_url: False
prefix np: <http://www.nanopub.org/nschema#>
prefix npx: <http://purl.org/nanopub/x/>
prefix npa: <http://purl.org/nanopub/admin/>
prefix dct: <http://purl.org/dc/terms/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
select ?user ?name ?pubkey (count(distinct ?np) as ?np_count) where {
graph npa:graph {
?intronp npa:hasHeadGraph ?introh .
?intronp npa:hasValidSignatureForPublicKey ?pubkey .
?np npa:hasHeadGraph ?h .
?np npa:hasValidSignatureForPublicKey ?pubkey .
}
graph ?introh {
?intronp np:hasAssertion ?introa .
}
graph ?introa {
?keydeclaration npx:declaredBy ?user .
optional {
?user foaf:name ?name .
}
}
filter not exists {
graph npa:graph {
?retraction npa:hasHeadGraph ?rh .
?retraction npa:hasValidSignatureForPublicKey ?pubkey .
}
graph ?rh {
?retraction np:hasAssertion ?ra .
}
graph ?ra {
?somebody npx:retracts ?intronp .
}
}
filter not exists {
graph npa:graph {
?superseding npa:hasHeadGraph ?sh .
?superseding npa:hasValidSignatureForPublicKey ?pubkey .
}
graph ?sh {
?superseding np:hasPublicationInfo ?si .
}
graph ?si {
?superseding npx:supersedes ?intronp .
}
}
graph ?h {
?np np:hasPublicationInfo ?i .
}
graph ?i {
?np dct:creator ?user .
}
}
group by ?user ?name ?pubkey
order by desc(?np_count)