-
Notifications
You must be signed in to change notification settings - Fork 1
/
find_valid_signed_nanopubs_with_uri.rq
55 lines (53 loc) · 1.65 KB
/
find_valid_signed_nanopubs_with_uri.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
#+ summary: Find signed nanopublications that are not retracted or superseded containing the given URI
#+ method: GET
#+ pagination: 1000
#+ endpoint_in_url: False
prefix np: <http://www.nanopub.org/nschema#>
prefix npa: <http://purl.org/nanopub/admin/>
prefix npx: <http://purl.org/nanopub/x/>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix dct: <http://purl.org/dc/terms/>
select ?np ?graphpred ?subj ?pred ?obj ?date ?pubkey where {
graph npa:graph {
?np npa:hasHeadGraph ?h .
?np npa:creationDay ?__day_iri .
?np npa:creationMonth ?__month_iri .
?np npa:creationYear ?__year_iri .
?np dct:created ?date .
?np npa:hasValidSignatureForPublicKey ?__pubkey_xsd_string .
bind(?__pubkey_xsd_string as ?pubkey)
}
graph ?h {
?np ?__graphpred_iri ?g .
bind(?__graphpred_iri as ?graphpred)
}
graph ?g {
{ ?_ref_iri ?p ?o . bind(?_ref_iri as ?subj) bind(?p as ?pred) bind(?o as ?obj) } union
{ ?s ?_ref_iri ?o . bind(?s as ?subj) bind(?_ref_iri as ?pred) bind(?o as ?obj) } union
{ ?s ?p ?_ref_iri . bind(?s as ?subj) bind(?p as ?pred) bind(?_ref_iri as ?obj) }
}
filter not exists {
graph npa:graph {
?newversion npa:hasHeadGraph ?nh .
?newversion npa:hasValidSignatureForPublicKey ?pubkey .
}
graph ?nh {
?newversion np:hasPublicationInfo ?ni .
}
graph ?ni {
?newversion npx:supersedes ?np .
}
}
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 ?np .
}
}
}