Skip to content

Extract gen:isSubSpaceOf declarations and id-prefix triples (#93, PR 1/3)#94

Merged
tkuhn merged 3 commits into
mainfrom
feature/93-subspace-extraction
May 6, 2026
Merged

Extract gen:isSubSpaceOf declarations and id-prefix triples (#93, PR 1/3)#94
tkuhn merged 3 commits into
mainfrom
feature/93-subspace-extraction

Conversation

@tkuhn
Copy link
Copy Markdown
Contributor

@tkuhn tkuhn commented May 6, 2026

Summary

First of three PRs implementing #93 (sub-space handling). Pure raw-layer extraction — no materialiser changes, no behaviour change downstream.

  • Recognises gen:isSubSpaceOf in two paths and emits one npa:SubSpaceDeclaration per (child, parent) pair into npa:spacesGraph:
    • Embedded in a gen:Space nanopub (<thisSpaceIri> gen:isSubSpaceOf <parent> triples in the assertion).
    • Standalone gen:isSubSpaceOf nanopub (single-triple-assertion type dispatch).
  • Rejects self-loops (<X> gen:isSubSpaceOf <X>) at extraction.
  • Enumerates path-prefixes of every Space IRI (down to host-only) as npa:hasIdPrefix triples on the npa:SpaceRef aggregate. Powers the URL-prefix sub-space fallback in PR 3.
  • Design doc updated: new "Sub-space relations" section covering predicate, declaration paths, authority rule (Mode A single dual-admin / Mode B two single-side admins), URL-prefix fallback, invalidation, consumer pattern.

The materialiser doesn't read any of the new triples yet, so downstream behaviour is unchanged.

Follow-up PRs

  • PR 2AuthorityResolver admit pass for explicit declarations (Mode A + Mode B), structural-rebuild flag on npa:SubSpaceLink DELETE.
  • PR 3 — URL-prefix fallback admit pass with per-child suppression.
  • PR 4 (Nanodash repo) — replace SpaceRepository.findSubspaces(...) URL regex with the SPARQL consumer pattern.

Test plan

  • SpacesExtractorTest extended from 17 → 27 tests, all green.
  • Full unit-test suite (190 tests) green; no regressions.
  • Integration verification deferred to PR 2 (where the materialiser starts consuming these triples).

🤖 Generated with Claude Code

tkuhn and others added 3 commits May 6, 2026 10:38
Adds raw-layer extraction for sub-space relations: scans embedded triples
in gen:Space nanopubs and standalone gen:isSubSpaceOf nanopubs, emitting
one npa:SubSpaceDeclaration per (child, parent) pair. Self-loops are
rejected. Also enumerates path-prefixes of every Space IRI as
npa:hasIdPrefix triples on the SpaceRef aggregate, powering the future
URL-prefix fallback.

Pure-additive output in npa:spacesGraph; the materializer doesn't read
these triples yet, so downstream behaviour is unchanged. Materializer
admit pass (Mode A + Mode B) and URL-prefix fallback follow in PR 2 / 3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…s-is (#93)

Following the existing RoleAssignment / RoleInstantiation pattern: validated
SubSpaceDeclaration rows are copied into npass:<…> keeping their npasub:
subject. Mode B produces two rows per logical link; consumers dedupe via
EXISTS / DISTINCT, same shape they use for role tiers. Per-viaNanopub
DELETE works uniformly during invalidation.

URL-prefix fallback still emits direct npa:isSubSpaceOf / npa:hasSubSpace
triples plus a reified npa:DerivedSubSpaceLink tag so consumers can hide
derived links. The tag class is genuinely distinct from declarations
(no nanopub source, heuristic derivation) and isn't redundant.

Code-only PR 1 is unaffected — npasl: only existed in the doc.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… declarations (#93)

The fallback admit pass now checks against validated SubSpaceDeclaration
rows in npass:<…> rather than raw declarations in npa:spacesGraph. Rule
becomes "once a space has *successfully* spoken (admin-of-both gate
passed), its declarations are canonical" instead of "once a space has
tried to speak". Children whose only declarations are unapproved or
mid-flight Mode B no longer get silently dropped — they still pick up
URL-prefix fallback edges.

Run-order requirement: the explicit-declaration admit pass must commit
before the fallback pass runs (already documented). PR 1 unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant