fix(SpacesExtractor): emit inline non-hasAdmin role RIs from gen:Space#108
Merged
Conversation
A gen:Space nanopub may declare other roles alongside hasAdmin in the same assertion — has-event-facilitator, has-event-organizer, participatedAs* etc. The extractor was only emitting a RoleInstantiation for the hasAdmin triples; everything else was silently dropped because gen:Space nanopubs aren't auto-typed with back-compat role predicates (only single-triple-assertion nanopubs are). Spaces relying on inline role declarations (the 3pff FIP/M4M templates publish all roles in one gen:Space nanopub) ended up with admins-only members in consumers. Each distinct back-compat role predicate found inline gets its own RoleInstantiation, subject disambiguated by a hash of the predicate IRI (npari:<artifactCode>_<predicateHash>) so multiple predicates in one nanopub don't collide with each other or with the unhashed admin RI (npari:<artifactCode>). Direction comes from BackcompatRolePredicates; the inline orientation (<space> <pred> <agent> vs <agent> <pred> <space>) is verified against that. Also adds has-event-organizer to BackcompatRolePredicates (INVERSE) — it is actively used by the 3pff FIP templates but was missing from the direction map. Closes a gap surfaced while migrating nanodash to query the spaces repo (knowledgepixels/nanodash#468): FIP.38.T.8 has 3 facilitators, 1 assistant, and 1 organizer declared inline in the root np; with this fix they round-trip through extraction. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🎉 This PR is included in version 1.14.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A
gen:Spacenanopub may declare multiple role-predicate assignments inline in its assertion —gen:hasAdmin,has-event-facilitator,has-event-organizer,participatedAs*, etc. The extractor was only emitting agen:RoleInstantiationfor thegen:hasAdmintriples; everything else was silently dropped becausegen:Spacenanopubs aren't auto-typed with back-compat role predicates (only single-triple-assertion nanopubs are).Symptom: spaces relying on inline role declarations (the 3pff FIP/M4M templates publish all roles in one
gen:Spacenanopub) end up with admins-only members in consumers. Found while migrating nanodash to query the spaces repo directly (knowledgepixels/nanodash#468) —FIP.38.T.8has 3 facilitators, 1 assistant, and 1 organizer declared inline; before this fix none of them reachnpa:spacesGraph.Changes
SpacesExtractor.emitSpaceEntrynow calls a newemitInlineRoleInstantiations(np, ctx, spaceIri, out)helper after the admin-RI emission. It scans the assertion for any back-compat role predicate (excludinggen:hasAdmin, which is the trust seed and handled separately), groups by predicate, and emits onegen:RoleInstantiationper (predicate, direction) pair with multi-valuednpa:forAgent— same shape as the admin path.SpacesVocab.forRoleInstantiation(artifactCode, discriminatorHash)overload mintsnpari:<artifactCode>_<predicateHash>. The admin RI keeps the unhashednpari:<artifactCode>subject (no behavioural change there).BackcompatRolePredicates: addshas-event-organizer(INVERSE). It's actively used by the 3pff FIP templates but was missing from the direction map.extract_spaceWithInlineRoleTriples_emitsAdditionalRoleInstantiationscovers admin + INVERSE-inline + REGULAR-inline emission in one gen:Space nanopub.Test plan
mvn test— 214 pass, 0 fail (including the new test)🤖 Generated with Claude Code