Skip to content

Fix upstream-node handling in nanopub chain skills#2

Merged
annefou merged 1 commit into
mainfrom
fix/constellation-upstream-resolver-checks
May 31, 2026
Merged

Fix upstream-node handling in nanopub chain skills#2
annefou merged 1 commit into
mainfrom
fix/constellation-upstream-resolver-checks

Conversation

@annefou
Copy link
Copy Markdown
Contributor

@annefou annefou commented May 31, 2026

What

Two related fixes to the import-from-nanopub and verify-chain skills, found while diagnosing why a /np/constellation walk terminated at the Claim without surfacing the upstream AIDA (step 2) or Quote (step 1).

Root cause

The Claim→AIDA link is a shared AIDA-statement IRI (asAidaStatement → http://purl.org/aida/<sentence>), not a nanopub-to-nanopub reference. The constellation walk follows only nanopub references, so for some chain shapes it stops at the Claim: steps[] has no AIDA, and the upstream Quote/PICO/PCC is absent too. Both skills now document this as upstream-not-enumerated, not a chain-integrity failure.

Reachability bug (correctness)

verify-chain checked upstream URIs against the …/sciencelive/np/… form, which redirects to the HTML viewer and returns HTTP 200 on the SPA shell — so a status-only check passed even for non-existent nanopubs. Fixed by swapping to the bare w3id.org/np/ resolver form (serves TriG) and asserting the body is TriG, not HTML. Verified: the old check returns HTTP/2 200 for a bogus URI; the new check correctly FAILs it and PASSes real Quote/AIDA URIs.

import-from-nanopub's optional archival loop had the same prefix bug — it was silently saving HTML viewer pages as .trig files. Swapped the prefix there too.

Follow-up (not in this PR)

API-side fix to bridge the asAidaStatement IRI to its asserting nanopub in discoverNeighbours is tracked separately in science-live-platform.

The /np/constellation walk terminates at the Claim when the Claim->AIDA
link is a shared AIDA-statement IRI (asAidaStatement -> purl.org/aida/...)
rather than a nanopub-to-nanopub reference, so AIDA (step 2) and the
upstream Quote/PICO/PCC (step 1) can both be absent from steps[]. Document
this in both skills and stop treating it as a chain-integrity failure.

verify-chain: the old upstream-reachability check used the
.../sciencelive/np/... URI form, which redirects to the HTML viewer and
returns HTTP 200 on the SPA shell -- so a status-only check passed even
for non-existent nanopubs. Switch to the bare w3id.org/np/ resolver form
(which serves TriG) and assert the body is TriG, not HTML.

import-from-nanopub: same prefix bug in the optional archival loop was
silently saving HTML viewer pages as .trig files; swap the prefix there
too. Add an "upstream terminus" note explaining the constellation may not
reach AIDA/Quote and how to recover them via direct TriG fetch.

API-side fix (bridge the asAidaStatement IRI to its asserting nanopub in
discoverNeighbours) is tracked separately in science-live-platform.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant