Bridge asAidaStatement IRI in /np/constellation walk#97
Open
annefou wants to merge 1 commit into
Open
Conversation
A FORRT Claim links to its AIDA only via `sciencelive:asAidaStatement -> http://purl.org/aida/<sentence>` — a content-derived statement IRI, not a nanopub-to-nanopub reference. The constellation walk discovers neighbours only through `npa:refersToNanopub` (both directions) and by mining `np/RA…` URIs from TriG bodies, so neither mechanism can cross the Claim->AIDA boundary. The walk therefore terminated at the Claim and never surfaced the upstream AIDA (step 2) or the Quote (step 1, reachable only through the AIDA). Add a third discovery mechanism: for each AIDA-statement IRI found in a node's TriG, resolve the nanopub that asserts it (the AIDA Sentence nanopub) via a new SPARQL query, and add it as a neighbour. From the AIDA, the existing TriG mining reaches the Quote via skos:related, so the whole upstream chain surfaces again. - queries.ts: AIDA_STATEMENT_NANOPUB query (mirrors the new canonical frontend/src/lib/queries/aida-statement-nanopub.rq); generalise bindUri with an optional placeholder arg. - constellation.ts: extractAidaStatementIris (exported, unit-tested) + discoverAidaStatementNeighbours, merged into each node's neighbour set; best-effort so a SPARQL failure never aborts the BFS. - Tests: unit coverage for the IRI extractor + an integration test proving Claim -> AIDA -> Quote now surfaces across the content IRI. Query validated live against query.knowledgepixels.com: it returns the AIDA nanopub for the coastal-rom chain's claim. Resolves the template-side workaround documented in forrt-replication-template#2 / grid4earth-benchmark-template#1.
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.
Problem
A
/np/constellationwalk terminates at the Claim and never surfaces the upstream AIDA (step 2) or Quote (step 1).Root cause: a FORRT Claim links to its AIDA only via
sciencelive:asAidaStatement → http://purl.org/aida/<sentence>— a content-derived statement IRI, not a nanopub-to-nanopub reference. The walk discovers neighbours only throughnpa:refersToNanopub(both directions) and by miningnp/RA…URIs from TriG bodies; neither can cross the Claim→AIDA boundary. Losing the AIDA also loses the Quote, which is only reachable through it.(Diagnosed against the coastal-rom-replication chain; both upstream nanopubs exist and resolve — the projection just couldn't reach them.)
Fix
A third discovery mechanism in
discoverNeighbours's caller: for each AIDA-statement IRI in a node's TriG, resolve the nanopub that asserts it (the AIDA Sentence nanopub) via a new SPARQL query, and add it as a neighbour. From the AIDA, existing TriG mining reaches the Quote viaskos:related, so the whole upstream chain surfaces again.queries.ts: newAIDA_STATEMENT_NANOPUBquery (inline mirror of the new canonicalfrontend/src/lib/queries/aida-statement-nanopub.rq);bindUrigains an optional placeholder arg.constellation.ts:extractAidaStatementIris(exported, unit-tested) +discoverAidaStatementNeighbours, merged into each node's neighbour set. Best-effort — a SPARQL failure never aborts the BFS.Claim → AIDA → Quotenow surfaces across the content IRI.Validation
npx vitest run api/src/np/→ 219 passing;tsc --noEmitclean; eslint clean.query.knowledgepixels.com: the new query returns the AIDA nanopubRAPii6l2XAP…for the coastal-rom chain's Claim.Related
Resolves the template-side workaround documented in ScienceLiveHub/forrt-replication-template#2 and GRID4EARTH/grid4earth-benchmark-template#1 (those keep the doc notes + the bare-resolver TriG fetch, which remain correct).