Returns the profile picture(s) declared for the given space(s) or maintained resource(s) as 'schema:image', restricted to declarations that are SIGNED BY AN ADMIN of the governing space (nanodash issue #632). Pass one or more resource IRIs; results are ordered newest first, so the caller takes the first row per resource. The authority gate is a single federated hop to the spaces repo, mirroring get-view-displays-unresolved: the resource's npa:hasGoverningSpaceRef edge in the current space state (reflexive for a space itself, the maintainer space for a maintained resource) is joined to the admin RoleInstantiations of that ref and on to npa:AccountState, so only the trust-state-validated public keys of current admins are accepted; the maintainer tier is deliberately NOT accepted here. Everything else is local on the repo/full endpoint: candidate declarations are found subject-first (bound resource IRI in an unbound assertion graph), then their signing key is checked, so the federated hop sees only the handful of candidates. Retracted or superseded declarations drop out via the usual npx:invalidates filter. The gate is not pinned to a single space ref: for an identifier claimed by rival refs, an admin of any claiming ref can declare a picture (see nanodash docs/space-ref-identity.md). Users' own profile pictures are NOT covered by this query -- they are self-declared and read through the subject-agnostic get-all-user-profile-pics.
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/> prefix gen: <https://w3id.org/kpxl/gen/terms/> prefix schema: <https://schema.org/> select distinct (?_resource_multi_iri as ?resource) ?imageUrl ?np ?date ?pubkey where { values ?_resource_multi_iri {} # Candidate declarations, local on repo/full: subject-first lookup of the image # triple, then the signing key of the nanopub that asserts it. graph npa:graph { ?np np:hasAssertion ?a ; npa:hasValidSignatureForPublicKeyHash ?pubkey ; dct:created ?date . filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . } } graph ?a { ?_resource_multi_iri schema:image ?imageUrl . } # Authority gate (single federated hop): the signing key must be a current admin # key of a space ref governing the resource -- reflexive for a space itself, the # maintainer space for a maintained resource. service <https://w3id.org/np/l/nanopub-query-1.1/repo/spaces> { graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . } graph ?stateG { ?_resource_multi_iri npa:hasGoverningSpaceRef ?ref . ?ri a gen:RoleInstantiation ; npa:forSpaceRef ?ref ; npa:hasRoleType gen:AdminRole ; npa:forAgent ?admin . ?acct a npa:AccountState ; npa:agent ?admin ; npa:pubkey ?pubkey . } } } order by desc(?date)