📌 Nanopublication
Get cumulative user count by week
grlc-query
This is a local identifier minted within the nanopublication.
https://w3id.org/np/RA6MMHn6iU.../get-cumulative-user-count
https://w3id.org/kpxl/grlc/sparql
has the query
(this is a literal)
"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 ?week (substr(str(min(?fd1)), 0, 11) as ?firstday) (count(distinct ?u2) as ?totalusers) where {
{
select ?u1 ?fd1 ?w1 where {
{
select ?u1 (min(?d1) as ?fd1) where {
graph npa:graph {
?np1 npa:hasValidSignatureForPublicKey ?pk1 .
?np1 dct:creator ?u1 .
?np1 dct:created ?d1 .
?np1 np:hasAssertion ?a1 .
}
graph ?a1 {
?decl1 npx:declaredBy ?agent1 .
}
filter(strstarts(str(?u1), "https://orcid.org/"))
filter(?u1 != <https://orcid.org/0000-0000-0000-0000>)
filter(?u1 != <https://orcid.org/1234-1234-1234-1234>)
}
group by ?u1
}
bind(if(month(?fd1) <= 2, year(?fd1) - 1, year(?fd1)) as ?y1)
bind(if(month(?fd1) <= 2, month(?fd1) + 9, month(?fd1) - 3) as ?m1)
bind(365*?y1 + xsd:integer(?y1/4) - xsd:integer(?y1/100) + xsd:integer(?y1/400) + xsd:integer((153*?m1 + 2)/5) + day(?fd1) as ?dn1)
bind(?dn1 + 1 - xsd:integer((?dn1 + 1) / 7) * 7 as ?dw1)
bind(xsd:integer((?dn1 - ?dw1) / 7) as ?w1)
}
}
{
select ?u2 ?w2 where {
{
select ?u2 (min(?d2) as ?fd2) where {
graph npa:graph {
?np2 npa:hasValidSignatureForPublicKey ?pk2 .
?np2 dct:creator ?u2 .
?np2 dct:created ?d2 .
?np2 np:hasAssertion ?a2 .
}
graph ?a2 {
?decl2 npx:declaredBy ?agent2 .
}
filter(strstarts(str(?u2), "https://orcid.org/"))
filter(?u2 != <https://orcid.org/0000-0000-0000-0000>)
filter(?u2 != <https://orcid.org/1234-1234-1234-1234>)
}
group by ?u2
}
bind(if(month(?fd2) <= 2, year(?fd2) - 1, year(?fd2)) as ?y2)
bind(if(month(?fd2) <= 2, month(?fd2) + 9, month(?fd2) - 3) as ?m2)
bind(365*?y2 + xsd:integer(?y2/4) - xsd:integer(?y2/100) + xsd:integer(?y2/400) + xsd:integer((153*?m2 + 2)/5) + day(?fd2) as ?dn2)
bind(?dn2 + 1 - xsd:integer((?dn2 + 1) / 7) * 7 as ?dw2)
bind(xsd:integer((?dn2 - ?dw2) / 7) as ?w2)
}
}
bind(?w1 as ?week)
filter(?w2 <= ?week)
}
group by ?week
order by desc(?week)"
.
Tobias Kuhn,
19 Mar 2026, 10:27:00 UTC
run this query
Raw formats
TriG(txt),
JSON-LD(txt),
N-Quads(txt),
XML(txt)