sub:assertion {
sub:get-filtered-nanopub-list dct:description "This query returns a filtered list of nanopublicatoins." ;
dct:license <
http://www.apache.org/licenses/LICENSE-2.0> ;
a <
https://w3id.org/kpxl/grlc/grlc-query> ;
rdfs:label "Get filtered nanopub list" ;
<
https://w3id.org/kpxl/grlc/endpoint> <
https://w3id.org/np/l/nanopub-query-1.1/repo/meta> ;
<
https://w3id.org/kpxl/grlc/sparql> """prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix dct: <http://purl.org/dc/terms/>
prefix np: <http://www.nanopub.org/nschema#>
prefix npa: <http://purl.org/nanopub/admin/>
prefix npx: <http://purl.org/nanopub/x/>
select ?np ?label ?date (group_concat(?t; separator=' ') as ?types) ?pubkey where {
graph npa:graph {
#=================== MULTI-VALUE PLACEHOLDER ====================#------ config: ------
{ select ?pubkey { # <- VAR pubkey
#bind(\"1162349fdeaf431e71ab55898cb2a425b971d466150c2aa5b3c1beb498045a37 2a6683923dcbd9810ef4e5debda8c4152c297b12303e286622bbbb0ed1884384\" as ?_pubkeys)
bind(?__pubkeys as ?v) # <- VAR _pubkeys
{select*{optional{?a ?b ?c}}limit 1} # (for some Virtuoso v.) #
values ?x{0 1 2 3 4 5 6 7 8 9} values ?y{0 1 2 3 4 5 6 7 8 9} #
bind((10*?x)+?y as ?n) # (works for a maximum of 100 values) #
bind(\" \" as ?sep) # (separator as regex-compatible character) # <- CONST sep
bind(concat(\"^([^\",?sep,\"]*\",?sep,\"){\",str(?n),\"}\") as ?p) #
bind(concat(?sep,\".*\") as ?p0) #
filter(if(?n=0,true,regex(?v,?p))) # (=0 check for Virtuoso) #
bind(replace(if(?n=0,?v,replace(?v,?p,\"\")),?p0,\"\") as ?pubkey) # <- VAR pubkey
} } #
#================================================================#---------------------
?np npa:hasValidSignatureForPublicKeyHash ?pubkey .
filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . }
#=================== MULTI-VALUE PLACEHOLDER ====================#------ config: ------
{ select ?type { # <- VAR type
#bind(\"https://w3id.org/kpxl/grlc/grlc-query http://purl.org/nanopub/x/ExampleNanopub\" as ?_types)
bind(?__types as ?v) # <- VAR _types
{select*{optional{?a ?b ?c}}limit 1} # (for some Virtuoso v.) #
values ?x{0 1 2 3 4 5 6 7 8 9} values ?y{0 1 2 3 4 5 6 7 8 9} #
bind((10*?x)+?y as ?n) # (works for a maximum of 100 values) #
bind(\" \" as ?sep) # (separator as regex-compatible character) # <- CONST sep
bind(concat(\"^([^\",?sep,\"]*\",?sep,\"){\",str(?n),\"}\") as ?p) #
bind(concat(?sep,\".*\") as ?p0) #
filter(if(?n=0,true,regex(?v,?p))) # (=0 check for Virtuoso) #
bind(replace(if(?n=0,?v,replace(?v,?p,\"\")),?p0,\"\") as ?typel) # <- VAR type
bind(uri(?typel) as ?type)
} } #
#================================================================#---------------------
?np npx:hasNanopubType ?type .
?np npx:hasNanopubType ?t .
?np dct:created ?date .
#bind(\"2024-11-30\" as ?__endtime)
bind(coalesce(?__endtime, \"9999\") as ?endtime)
filter(?endtime > str(?date))
#bind(\"2024-11-29\" as ?__starttime)
bind(coalesce(?__starttime, \"0000\") as ?starttime)
filter(?starttime < str(?date))
optional { ?np rdfs:label ?label }
}
}
group by ?np ?label ?date ?pubkey
order by desc(?date)
limit 100""" .
}