Skip to content

Commit f356d3f

Browse files
committed
Add find_valid_signed_* convenience operations
1 parent 0d80fd1 commit f356d3f

7 files changed

+282
-2
lines changed

find_signed_things.rq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#+ summary: Find things introduced in signed nanopublications (experimental)
1+
#+ summary: Find things introduced in signed nanopublications
22
#+ method: GET
33
#+ pagination: 1000
44
#+ endpoint_in_url: False

find_things.rq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#+ summary: Find things introduced in nanopublications (experimental)
1+
#+ summary: Find things introduced in nanopublications
22
#+ method: GET
33
#+ pagination: 1000
44
#+ endpoint_in_url: False

find_valid_signed_nanopubs.rq

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#+ summary: Find signed nanopublications that are not retracted or superseded
2+
#+ method: GET
3+
#+ pagination: 1000
4+
#+ endpoint_in_url: False
5+
6+
prefix np: <http://www.nanopub.org/nschema#>
7+
prefix npa: <http://purl.org/nanopub/admin/>
8+
prefix npx: <http://purl.org/nanopub/x/>
9+
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
10+
prefix dct: <http://purl.org/dc/terms/>
11+
12+
select ?np ?date ?pubkey where {
13+
graph npa:graph {
14+
?np npa:hasHeadGraph ?h .
15+
?np npa:creationDay ?__day_iri .
16+
?np npa:creationMonth ?__month_iri .
17+
?np npa:creationYear ?__year_iri .
18+
?np dct:created ?date .
19+
?np npa:hasValidSignatureForPublicKey ?__pubkey_xsd_string .
20+
bind(?__pubkey_xsd_string as ?pubkey)
21+
}
22+
filter not exists {
23+
graph npa:graph {
24+
?newversion npa:hasHeadGraph ?nh .
25+
?newversion npa:hasValidSignatureForPublicKey ?pubkey .
26+
}
27+
graph ?nh {
28+
?newversion np:hasPublicationInfo ?ni .
29+
}
30+
graph ?ni {
31+
?newversion npx:supersedes ?np .
32+
}
33+
}
34+
filter not exists {
35+
graph npa:graph {
36+
?retraction npa:hasHeadGraph ?rh .
37+
?retraction npa:hasValidSignatureForPublicKey ?pubkey .
38+
}
39+
graph ?rh {
40+
?retraction np:hasAssertion ?ra .
41+
}
42+
graph ?ra {
43+
?somebody npx:retracts ?np .
44+
}
45+
}
46+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#+ summary: Find signed nanopublications that are not retracted or superseded for the given triple pattern
2+
#+ method: GET
3+
#+ pagination: 1000
4+
#+ endpoint_in_url: False
5+
6+
prefix np: <http://www.nanopub.org/nschema#>
7+
prefix npa: <http://purl.org/nanopub/admin/>
8+
prefix npx: <http://purl.org/nanopub/x/>
9+
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
10+
prefix dct: <http://purl.org/dc/terms/>
11+
12+
select ?np ?graphpred ?subj ?pred ?obj ?date ?pubkey where {
13+
graph npa:graph {
14+
?np npa:hasHeadGraph ?h .
15+
?np npa:creationDay ?__day_iri .
16+
?np npa:creationMonth ?__month_iri .
17+
?np npa:creationYear ?__year_iri .
18+
?np dct:created ?date .
19+
?np npa:hasValidSignatureForPublicKey ?__pubkey_xsd_string .
20+
bind(?__pubkey_xsd_string as ?pubkey)
21+
}
22+
graph ?h {
23+
?np ?__graphpred_iri ?g .
24+
bind(?__graphpred_iri as ?graphpred)
25+
}
26+
graph ?g {
27+
?__subj_iri ?__pred_iri ?__obj_iri .
28+
bind(?__subj_iri as ?subj)
29+
bind(?__pred_iri as ?pred)
30+
bind(?__obj_iri as ?obj)
31+
}
32+
filter not exists {
33+
graph npa:graph {
34+
?newversion npa:hasHeadGraph ?nh .
35+
?newversion npa:hasValidSignatureForPublicKey ?pubkey .
36+
}
37+
graph ?nh {
38+
?newversion np:hasPublicationInfo ?ni .
39+
}
40+
graph ?ni {
41+
?newversion npx:supersedes ?np .
42+
}
43+
}
44+
filter not exists {
45+
graph npa:graph {
46+
?retraction npa:hasHeadGraph ?rh .
47+
?retraction npa:hasValidSignatureForPublicKey ?pubkey .
48+
}
49+
graph ?rh {
50+
?retraction np:hasAssertion ?ra .
51+
}
52+
graph ?ra {
53+
?somebody npx:retracts ?np .
54+
}
55+
}
56+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#+ summary: Find signed nanopublications that are not retracted or superseded containing the given text
2+
#+ method: GET
3+
#+ pagination: 1000
4+
#+ endpoint_in_url: False
5+
6+
prefix np: <http://www.nanopub.org/nschema#>
7+
prefix npa: <http://purl.org/nanopub/admin/>
8+
prefix npx: <http://purl.org/nanopub/x/>
9+
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
10+
prefix dct: <http://purl.org/dc/terms/>
11+
prefix luc: <http://www.ontotext.com/owlim/lucene#> # for GraphDB
12+
#prefix bif: <http://www.openlinksw.com/schemas/bif#> # for Virtuoso
13+
14+
select ?np ?graphpred ?subj ?pred ?v ?date ?pubkey ?superseded ?retracted where {
15+
graph npa:graph {
16+
?np npa:hasHeadGraph ?h .
17+
?np npa:creationDay ?__day_iri .
18+
?np npa:creationMonth ?__month_iri .
19+
?np npa:creationYear ?__year_iri .
20+
?np dct:created ?date .
21+
?np npa:hasValidSignatureForPublicKey ?__pubkey_xsd_string .
22+
bind(?__pubkey_xsd_string as ?pubkey)
23+
}
24+
graph ?h {
25+
?np ?__graphpred_iri ?g .
26+
bind(?__graphpred_iri as ?graphpred)
27+
}
28+
graph ?g {
29+
{ ?subj ?pred ?v . ?v luc:npIdx ?_text . }
30+
union
31+
{ ?subj ?pred ?v . ?v <bif:contains> ?_text . }
32+
}
33+
filter not exists {
34+
graph npa:graph {
35+
?newversion npa:hasHeadGraph ?nh .
36+
?newversion npa:hasValidSignatureForPublicKey ?pubkey .
37+
}
38+
graph ?nh {
39+
?newversion np:hasPublicationInfo ?ni .
40+
}
41+
graph ?ni {
42+
?newversion npx:supersedes ?np .
43+
}
44+
}
45+
filter not exists {
46+
graph npa:graph {
47+
?retraction npa:hasHeadGraph ?rh .
48+
?retraction npa:hasValidSignatureForPublicKey ?pubkey .
49+
}
50+
graph ?rh {
51+
?retraction np:hasAssertion ?ra .
52+
}
53+
graph ?ra {
54+
?somebody npx:retracts ?np .
55+
}
56+
}
57+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#+ summary: Find signed nanopublications that are not retracted or superseded containing the given URI
2+
#+ method: GET
3+
#+ pagination: 1000
4+
#+ endpoint_in_url: False
5+
6+
prefix np: <http://www.nanopub.org/nschema#>
7+
prefix npa: <http://purl.org/nanopub/admin/>
8+
prefix npx: <http://purl.org/nanopub/x/>
9+
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
10+
prefix dct: <http://purl.org/dc/terms/>
11+
12+
select ?np ?graphpred ?subj ?pred ?obj ?date ?pubkey where {
13+
graph npa:graph {
14+
?np npa:hasHeadGraph ?h .
15+
?np npa:creationDay ?__day_iri .
16+
?np npa:creationMonth ?__month_iri .
17+
?np npa:creationYear ?__year_iri .
18+
?np dct:created ?date .
19+
?np npa:hasValidSignatureForPublicKey ?__pubkey_xsd_string .
20+
bind(?__pubkey_xsd_string as ?pubkey)
21+
}
22+
graph ?h {
23+
?np ?__graphpred_iri ?g .
24+
bind(?__graphpred_iri as ?graphpred)
25+
}
26+
graph ?g {
27+
{ ?_ref_iri ?p ?o . bind(?_ref_iri as ?subj) bind(?p as ?pred) bind(?o as ?obj) } union
28+
{ ?s ?_ref_iri ?o . bind(?s as ?subj) bind(?_ref_iri as ?pred) bind(?o as ?obj) } union
29+
{ ?s ?p ?_ref_iri . bind(?s as ?subj) bind(?p as ?pred) bind(?_ref_iri as ?obj) }
30+
}
31+
filter not exists {
32+
graph npa:graph {
33+
?newversion npa:hasHeadGraph ?nh .
34+
?newversion npa:hasValidSignatureForPublicKey ?pubkey .
35+
}
36+
graph ?nh {
37+
?newversion np:hasPublicationInfo ?ni .
38+
}
39+
graph ?ni {
40+
?newversion npx:supersedes ?np .
41+
}
42+
}
43+
filter not exists {
44+
graph npa:graph {
45+
?retraction npa:hasHeadGraph ?rh .
46+
?retraction npa:hasValidSignatureForPublicKey ?pubkey .
47+
}
48+
graph ?rh {
49+
?retraction np:hasAssertion ?ra .
50+
}
51+
graph ?ra {
52+
?somebody npx:retracts ?np .
53+
}
54+
}
55+
}

find_valid_signed_things.rq

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#+ summary: Find things introduced in signed nanopublications that are not retracted or superseded
2+
#+ method: GET
3+
#+ pagination: 1000
4+
#+ endpoint_in_url: False
5+
6+
prefix np: <http://www.nanopub.org/nschema#>
7+
prefix npa: <http://purl.org/nanopub/admin/>
8+
prefix npx: <http://purl.org/nanopub/x/>
9+
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
10+
prefix dct: <http://purl.org/dc/terms/>
11+
12+
select ?thing ?label ?description ?np ?date ?pubkey where {
13+
graph npa:graph {
14+
?np npa:hasHeadGraph ?h .
15+
?np npa:creationDay ?__day_iri .
16+
?np npa:creationMonth ?__month_iri .
17+
?np npa:creationYear ?__year_iri .
18+
?np dct:created ?date .
19+
?np npa:hasValidSignatureForPublicKey ?__pubkey_xsd_string .
20+
bind(?__pubkey_xsd_string as ?pubkey)
21+
}
22+
graph ?h {
23+
?np np:hasAssertion ?a .
24+
?np np:hasPublicationInfo ?i.
25+
}
26+
graph ?a {
27+
?thing a ?_type_iri .
28+
?thing rdfs:label ?label .
29+
optional {
30+
?thing rdfs:comment ?comment .
31+
}
32+
optional {
33+
?thing dct:description ?dctdesc .
34+
}
35+
}
36+
graph ?i {
37+
?np (npx:introduces|npx:describes) ?thing .
38+
}
39+
filter not exists {
40+
graph npa:graph {
41+
?newversion npa:hasHeadGraph ?nh .
42+
?newversion npa:hasValidSignatureForPublicKey ?pubkey .
43+
}
44+
graph ?nh {
45+
?newversion np:hasPublicationInfo ?ni .
46+
}
47+
graph ?ni {
48+
?newversion npx:supersedes ?np .
49+
}
50+
}
51+
filter not exists {
52+
graph npa:graph {
53+
?retraction npa:hasHeadGraph ?rh .
54+
?retraction npa:hasValidSignatureForPublicKey ?pubkey .
55+
}
56+
graph ?rh {
57+
?retraction np:hasAssertion ?ra .
58+
}
59+
graph ?ra {
60+
?somebody npx:retracts ?np .
61+
}
62+
}
63+
bind(coalesce(?comment, ?dctdesc, "") as ?description)
64+
bind(concat(" ",lcase(str(?label))," ",lcase(str(?description))," ") as ?text)
65+
filter( contains(?text, lcase(str(?_searchterm))) )
66+
}

0 commit comments

Comments
 (0)