This query returns FAQ answers or edits contributed by users who are NOT members of the space maintaining the entity: the inverse of the member-gated FAQ views. For each entry only the single latest non-member nanopub is returned, and only when it is newer (by timestamp) than the latest member version of that entry — i.e. the contribution that would win most-recent-wins if its author were a member (a pending suggestion). The member public-key hashes are resolved server-side from the spaces repo (/repo/spaces). override_target holds the suggestion nanopub itself, so a member can override it to accept the suggestion. Placeholder stubs (gen:UnansweredQuestion) are excluded.
Get non-member FAQ suggestions for an entity
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 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 npx: <http://purl.org/nanopub/x/> prefix schema: <http://schema.org/> prefix gen: <https://w3id.org/kpxl/gen/terms/> prefix foaf: <http://xmlns.com/foaf/0.1/> select ?question ?content ?suggester (sample(?sname) as ?suggester_label) (?np as ?override_target) ?np ("^" as ?np_label) where { service <https://w3id.org/np/l/nanopub-query-1.1/repo/spaces> { select (group_concat(?mpk; separator=" ") as ?memberPubkeys) where { graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . } values ?_resource_multi_iri {} graph ?stateG { ?_resource_multi_iri npa:isMaintainedBy? ?space . ?ri a gen:RoleInstantiation ; npa:forSpace ?space ; npa:forAgent ?agent ; npa:hasRoleType ?rt . filter(?rt in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole)) ?acct a npa:AccountState ; npa:agent ?agent ; npa:pubkey ?mpk . } } } graph npa:graph { ?np npa:hasValidSignatureForPublicKeyHash ?pubkey . filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . } filter not exists { ?np npx:hasNanopubType npx:ExampleNanopub . } ?np dct:created ?date . ?np np:hasAssertion ?a . optional { ?np npx:signedBy ?suggester . } } filter(!contains(?memberPubkeys, ?pubkey)) graph ?a { ?faq rdf:type schema:Question . ?faq rdfs:label ?question . ?faq gen:hasContent ?content . values ?_resource_multi_iri {} ?faq dct:isPartOf ?_resource_multi_iri . filter not exists { ?faq rdf:type gen:UnansweredQuestion } } filter not exists { graph npa:graph { ?mnp npa:hasValidSignatureForPublicKeyHash ?mpk2 . filter not exists { ?mx npx:invalidates ?mnp ; npa:hasValidSignatureForPublicKeyHash ?mpk2 . } ?mnp dct:created ?mdate . ?mnp np:hasAssertion ?ma . } filter(contains(?memberPubkeys, ?mpk2)) graph ?ma { ?faq rdf:type schema:Question . } filter(?mdate >= ?date) } filter not exists { graph npa:graph { ?np2 npa:hasValidSignatureForPublicKeyHash ?pubkey2 . filter not exists { ?npx2 npx:invalidates ?np2 ; npa:hasValidSignatureForPublicKeyHash ?pubkey2 . } ?np2 dct:created ?date2 . ?np2 np:hasAssertion ?a2 . } filter(!contains(?memberPubkeys, ?pubkey2)) graph ?a2 { ?faq rdf:type schema:Question . filter not exists { ?faq rdf:type gen:UnansweredQuestion } } filter(?date2 > ?date || (?date2 = ?date && str(?np2) > str(?np))) } optional { service <https://w3id.org/np/l/nanopub-query-1.1/repo/trust> { select ?suggester ?sname where { graph npa:graph { npa:thisRepo npa:hasCurrentTrustState ?tg . } graph ?tg { ?suggester foaf:name ?sname . } } } } } group by ?question ?content ?suggester ?np order by ?question