sub:assertion {
sub:get-quarterly-active-organic-user-count dct:description "Returns the number of active users per quarter since 2022. Two sequences of non-organic acquisition (as part of university course) are filtered out." ;
dct:license <
http://www.apache.org/licenses/LICENSE-2.0> ;
a <
https://w3id.org/kpxl/grlc/grlc-query> ;
rdfs:label "Get monthly active organic user count" ;
<
https://w3id.org/kpxl/grlc/endpoint> <
https://w3id.org/np/l/nanopub-query-1.1/repo/full> ;
<
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 xsd: <http://www.w3.org/2001/XMLSchema#>
prefix dct: <http://purl.org/dc/terms/>
prefix prov: <http://www.w3.org/ns/prov#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
select ?quarter (count(distinct ?userid) as ?usercount) where {
{ graph npa:graph {
?np npa:hasValidSignatureForPublicKey ?pubkey .
?np dct:creator ?userid .
?np dct:created ?date .
} }
union
{
graph npa:graph {
?np npa:hasValidSignatureForPublicKey ?pubkey .
?np np:hasAssertion ?assertion .
?np np:hasProvenance ?prov .
?np dct:created ?date .
}
graph ?prov {
?assertion prov:wasAttributedTo ?userid .
}
}
filter not exists {
graph npa:graph { ?np npa:hasSubIri ?userid . }
}
filter(str(?date) > \"2022\")
filter(str(?date) < \"2023-10-03\" || str(?date) > \"2023-10-12\")
filter(str(?date) < \"2024-09-27\" || str(?date) > \"2024-10-07\")
bind(substr(str(?date), 0, 8) as ?month)
bind(replace(?month, \"-0[1-3]$\", \"-Q1\") as ?quarter_temp1)
bind(replace(?quarter_temp1, \"-0[4-6]$\", \"-Q2\") as ?quarter_temp2)
bind(replace(?quarter_temp2, \"-0[7-9]$\", \"-Q3\") as ?quarter_temp3)
bind(replace(?quarter_temp3, \"-1[0-9]$\", \"-Q4\") as ?quarter)
}
group by ?quarter
order by desc(?quarter)""" .
}