Repository navigation
GET /links: serve the corpus's link table - #16
Merged
Merged
Conversation
Reads links/ next to the corpus (STANDARD.md §7) into a links table and serves it shaped like OpenAlex's /links, with all link types, relations and columns the source wrote. Filters origin, target, link_type, relation and the *_in_corpus flags are parsed locally; group_by, sort, select and paging. /corpus reports the number of links. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
openalexPro 0.20.0 writes links/ into the project folder too; reading the whole folder picked up the link table, which has no id column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
prepare_corpus()readslinks/next to the corpus (STANDARD.md §7) into alinkstable. Rows repeated across partitions are kept once, missing standard columns are added as NULL, and a corpus without a link table gets an empty one. The link files are part of the cache key, and.api_build_versionis bumped to 8.GET /links, shaped like OpenAlex's/links. Records come back as stored, so every relation the source wrote is served. For an openalexImportZenodo corpus that includes relations with no OpenAlex type (link_typenull, DataCite name inrelation)./querydoes not translate/links):originandtarget: any ID form, DOIs in any form, other identifiers as stored (link_key()macro with an R twin);link_type: short name or full URL;relation: any case;origin_in_corpusandtarget_in_corpus: true or false;|,!andnullwork as for works.group_byonlink_type,relationand the two flags;sort,selectand paging also work. No work has to be named./corpusreportslinks, the number of links.A corpus from openalexPro has an empty link table, so
/linksreturns no records there. Filling it is openalexPro/openalexPro#100.Tests
test-links.R: a project withcorpus_jqplus a link table holding OpenAlex-typed and Zenodo-style rows, repeated in two partitions. It covers filters, ID and DOI forms, null, OR, NULL-safe negation, group_by, paging, select, sort, errors, the empty table,link_key()agreeing in SQL and R, and HTTP.NOT_CRAN=true;devtools::check(vignettes = FALSE): 0 errors, 0 warnings, 0 notes.🤖 Generated with Claude Code