Lists the members of a given space together with their highest role tier (admin, maintainer, or member, in that order) and links to the role-assignment nanopubs (labelled by the specific role name, preferring schema:name). Observer-tier roles are excluded. When the same role is assigned to the same person by multiple nanopubs, only the latest one is linked.
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix dct: <http://purl.org/dc/terms/> prefix np: <http://www.nanopub.org/nschema#> prefix npa: <http://purl.org/nanopub/admin/> prefix gen: <https://w3id.org/kpxl/gen/terms/> prefix schema: <http://schema.org/> select ?member ?tier ?role_assignments_multi_iri ?role_assignments_label_multi where { { select ?member (if(min(?rank)=1,"Admin",if(min(?rank)=2,"Maintainer","Member")) as ?tier) (min(?rank) as ?rankMin) (group_concat(?latestNp; separator=" ") as ?role_assignments_multi_iri) (group_concat(?roleLabel; separator="\n") as ?role_assignments_label_multi) where { { select ?member ?roleProp (min(?rank0) as ?rank) (sample(?roleLabel0) as ?roleLabel) (strafter(max(concat(coalesce(str(?dateNp),""), " ", str(?grantNp))), " ") as ?latestNp) where { values ?_space_multi_iri {} graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?g . } graph ?g { ?ri a gen:RoleInstantiation ; npa:forSpace ?_space_multi_iri ; npa:forAgent ?member ; npa:viaNanopub ?grantNp . } bind(exists { graph ?g { ?ri npa:inverseProperty gen:hasAdmin } } as ?isAdmin) optional { graph npa:spacesGraph { ?ri (npa:regularProperty|npa:inverseProperty) ?ropExt } } optional { graph ?g { ?ri (npa:regularProperty|npa:inverseProperty) ?ropState } } bind(coalesce(?ropExt,?ropState) as ?roleProp) bind(exists { graph npa:spacesGraph { ?rd a npa:RoleDeclaration ; npa:hasRoleType gen:MaintainerRole ; (gen:hasRegularProperty|gen:hasInverseProperty) ?roleProp } } as ?isMaintainer) bind(exists { graph npa:spacesGraph { ?rd a npa:RoleDeclaration ; npa:hasRoleType gen:MemberRole ; (gen:hasRegularProperty|gen:hasInverseProperty) ?roleProp } } as ?isMember) bind(if(?isAdmin,1,if(?isMaintainer,2,if(?isMember,3,0))) as ?rank0) optional { graph npa:graph { ?grantNp dct:created ?dateNp } } optional { graph npa:spacesGraph { ?rd2 a npa:RoleDeclaration ; (gen:hasRegularProperty|gen:hasInverseProperty) ?roleProp ; npa:viaNanopub ?roleNp ; npa:role ?role . } graph npa:graph { ?roleNp np:hasAssertion ?role_a . } optional { graph ?role_a { ?role schema:name ?rlS } } optional { graph ?role_a { ?role rdfs:label ?rlA } } optional { graph ?role_a { ?role dct:title ?rlB } } bind(coalesce(?rlS,?rlA,?rlB) as ?rl) } bind(if(?isAdmin,coalesce(?rl,"admin"),coalesce(?rl,"role")) as ?roleLabel0) } group by ?member ?roleProp } filter(?rank > 0) } group by ?member } } order by ?rankMin ?member