sub:assertion {
sub:get-most-used-templates-last30d dct:description "This query returns the most used assertion templates of the last 30 days, considering the latest versions of these templates." ;
dct:license <
http://www.apache.org/licenses/LICENSE-2.0> ;
a <
https://w3id.org/kpxl/grlc/grlc-query> ;
rdfs:label "Get the most used templates of the last 30 days" ;
<
https://w3id.org/kpxl/grlc/endpoint> <
https://w3id.org/np/l/nanopub-query-1.1/repo/last30d> ;
<
https://w3id.org/kpxl/grlc/sparql> """prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix np: <http://www.nanopub.org/nschema#>
prefix npa: <http://purl.org/nanopub/admin/>
prefix npx: <http://purl.org/nanopub/x/>
prefix nt: <https://w3id.org/np/o/ntemplate/>
prefix dct: <http://purl.org/dc/terms/>
select ?template_np ?label (sum(?npcount) as ?overallcount) {
{ select ?used_template_np (count(distinct ?np) as ?npcount) where {
graph npa:graph {
?np npa:hasValidSignatureForPublicKey ?pubkey .
filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKey ?pubkey . }
?np np:hasPublicationInfo ?i .
}
graph ?i {
?np nt:wasCreatedFromTemplate ?used_template_np .
}
} group by ?used_template_np }
bind(uri(concat(\"https://w3id.org/np/l/nanopub-query-1.1/repo/type/\", sha256(str(nt:AssertionTemplate)))) as ?atservice)
{ service ?atservice {
graph npa:networkGraph {
?template_np npx:supersedes* ?used_template_np .
}
graph npa:graph {
?used_template_np npa:hasValidSignatureForPublicKey ?pubkey .
?template_np npa:hasValidSignatureForPublicKey ?pubkey .
filter not exists { ?template_npx npx:invalidates ?template_np ; npa:hasValidSignatureForPublicKey ?pubkey . }
?used_template_np np:hasAssertion ?a .
}
graph ?a {
?a rdfs:label ?label .
}
} }
} group by ?template_np ?label order by desc(?overallcount) limit 10""" .
}