@prefix this: . @prefix sub: . @prefix np: . @prefix grlc: . @prefix dct: . @prefix nt: . @prefix npx: . @prefix xsd: . @prefix rdfs: . @prefix orcid: . @prefix prov: . @prefix foaf: . sub:Head { this: a np:Nanopublication; np:hasAssertion sub:assertion; np:hasProvenance sub:provenance; np:hasPublicationInfo sub:pubinfo . } sub:assertion { sub:get-space-knowledge-product-counts a grlc:grlc-query; dct:description "Returns one row per direct sub-space (project) of the given space, with the number of knowledge products the project has delivered per category (articles, datasets, software, presentations, blog posts, media coverage, social posts, podcasts and discussions - formal FAIR outputs as well as informal / public-engagement outputs) and a total count. Sub-spaces without any products are included with zero counts; products of deeper nested sub-spaces are rolled up to the direct sub-space. Restricted to links authored by a member, maintainer, or admin of some space in the subtree. This version drops the Methods, DMPs and Preregistrations columns of the previous version, and leaves those output relations out of the total as well."; dct:license ; rdfs:label "Get knowledge product counts per project for a space"; grlc:endpoint ; grlc:sparql """prefix rdfs: prefix np: prefix npa: prefix npx: prefix gen: prefix ff: select ?Project (coalesce(min(?plabel), replace(str(?project), \"^.*/\", \"\")) as ?Project_label) (count(distinct if(?outputProp = ff:has-article, ?output, ?undefined)) as ?Articles) (count(distinct if(?outputProp = ff:has-dataset, ?output, ?undefined)) as ?Datasets) (count(distinct if(?outputProp = ff:has-software, ?output, ?undefined)) as ?Software) (count(distinct if(?outputProp = ff:has-presentation, ?output, ?undefined)) as ?Presentations) (count(distinct if(?outputProp = ff:has-blog-post, ?output, ?undefined)) as ?Blogs) (count(distinct if(?outputProp = ff:has-media-coverage, ?output, ?undefined)) as ?Media) (count(distinct if(?outputProp = ff:has-social-post, ?output, ?undefined)) as ?Social) (count(distinct if(?outputProp = ff:has-podcast, ?output, ?undefined)) as ?Podcasts) (count(distinct if(?outputProp = ff:has-discussion, ?output, ?undefined)) as ?Discussions) (count(distinct concat(str(?outputProp), \"|\", str(?output))) as ?Total) where { service { select ?project ?memberPubkeys where { { select (group_concat(distinct ?mpk; separator=\" \") as ?memberPubkeys) where { graph npa:graph { npa:hasCurrentSpaceState ?stateG . } values ?_space_multi_iri {} graph ?stateG { ?ri a gen:RoleInstantiation ; npa:forSpace ?proj ; npa:forAgent ?agent ; npa:hasRoleType ?rt . filter(?rt in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole)) filter(?proj = ?_space_multi_iri || strstarts(str(?proj), concat(str(?_space_multi_iri), \"/\"))) ?acct a npa:AccountState ; npa:agent ?agent ; npa:pubkey ?mpk . } } } graph npa:graph { npa:hasCurrentSpaceState ?stateG2 . } values ?_space_multi_iri {} graph ?stateG2 { ?_space_multi_iri npa:hasSubSpace ?project . } } } optional { graph npa:graph { ?np npa:hasValidSignatureForPublicKeyHash ?npPubkey . filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?npPubkey . } filter not exists { ?np npx:hasNanopubType npx:ExampleNanopub . } ?np np:hasAssertion ?a . } filter(contains(?memberPubkeys, ?npPubkey)) graph ?a { ?p ?outputProp ?output . } values ?outputProp { ff:has-article ff:has-dataset ff:has-software ff:has-presentation ff:has-blog-post ff:has-media-coverage ff:has-social-post ff:has-podcast ff:has-discussion } filter(?p = ?project || strstarts(str(?p), concat(str(?project), \"/\"))) } optional { graph npa:graph { ?lnp npa:hasValidSignatureForPublicKeyHash ?lpk . filter not exists { ?lnpx npx:invalidates ?lnp ; npa:hasValidSignatureForPublicKeyHash ?lpk . } ?lnp np:hasAssertion ?la . } filter(contains(?memberPubkeys, ?lpk)) graph ?la { ?project rdfs:label ?plabel . } } bind(?project as ?Project) } group by ?project ?Project order by ?project""" . } sub:provenance { sub:assertion prov:wasAttributedTo orcid:0000-0002-1267-0234 . } sub:pubinfo { orcid:0000-0002-1267-0234 foaf:name "Tobias Kuhn" . this: dct:created "2026-09-13T05:02:11Z"^^xsd:dateTime; dct:creator orcid:0000-0002-1267-0234; dct:license ; npx:embeds sub:get-space-knowledge-product-counts; npx:supersedes ; rdfs:label "Get knowledge product counts per project for a space"; nt:wasCreatedFromProvenanceTemplate ; nt:wasCreatedFromPubinfoTemplate , , ; nt:wasCreatedFromTemplate . sub:sig npx:hasAlgorithm "RSA"; npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB"; npx:hasSignature "X26Wih0GWUW7lTel9UB7KMGMkdIPWl7noCUtnm4TQNka3YYUI52UsglFVjbSVNERZKnMogfZBdw4EqDqwx0zLJZhTnRTyesTjk5HdytkQVNHccYDK5/f4tgeltxpMOeuA3CNvbXlctVYFdEAHMGm5ASXELS6l2Okr+cc2B89NeA="; npx:hasSignatureTarget this:; npx:signedBy orcid:0000-0002-1267-0234 . }