linkml-reference-validator 0.6.0__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/PKG-INFO +1 -1
  2. linkml_reference_validator-0.7.0/docs/how-to/use-signed-excerpts.md +122 -0
  3. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/reference/cli.md +36 -0
  4. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/mkdocs.yml +1 -0
  5. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/cli/__init__.py +7 -0
  6. linkml_reference_validator-0.7.0/src/linkml_reference_validator/cli/excerpts.py +129 -0
  7. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/models.py +52 -0
  8. linkml_reference_validator-0.7.0/src/linkml_reference_validator/signed_excerpts.py +226 -0
  9. linkml_reference_validator-0.7.0/tests/test_signed_excerpts_sync.py +349 -0
  10. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.claude/.mcp.json +0 -0
  11. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.claude/settings.json +0 -0
  12. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.copier-answers.yml +0 -0
  13. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.devcontainer/devcontainer.json +0 -0
  14. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.devcontainer/post_create.sh +0 -0
  15. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.editorconfig +0 -0
  16. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/actions/claude-code-action/action.yml +0 -0
  17. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/actions/claude-issue-summarize-action/action.yml +0 -0
  18. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/actions/claude-issue-triage-action/action.yml +0 -0
  19. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/ai-controllers.json +0 -0
  20. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/copilot-instructions.md +0 -0
  21. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/copilot-setup-steps.yml +0 -0
  22. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/dependabot.yml +0 -0
  23. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/workflows/claude-code-review.yml +0 -0
  24. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/workflows/claude-issue-summarize.yml +0 -0
  25. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/workflows/claude-issue-triage.yml +0 -0
  26. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/workflows/claude-ontology-review.yml +0 -0
  27. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/workflows/claude.yml +0 -0
  28. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/workflows/deploy-docs.yaml +0 -0
  29. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/workflows/dragon-ai.yml +0 -0
  30. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/workflows/main.yaml +0 -0
  31. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.github/workflows/pypi-publish.yaml +0 -0
  32. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.gitignore +0 -0
  33. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.goosehints +0 -0
  34. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.pre-commit-config.yaml +0 -0
  35. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/.yamllint.yaml +0 -0
  36. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/AGENTS.md +0 -0
  37. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/BUG_GEO_ACCESSION_TO_UID.md +0 -0
  38. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/BUG_ZENODO_DOI_AND_URL_HANDLING.md +0 -0
  39. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/CLAUDE.md +0 -0
  40. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/CLI-ISSUES.md +0 -0
  41. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/CODE_OF_CONDUCT.md +0 -0
  42. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/CONTRIBUTING.md +0 -0
  43. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/FEATURE_REQUEST_REPAIR.md +0 -0
  44. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/LICENSE +0 -0
  45. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/README.md +0 -0
  46. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/REVIEW2.md +0 -0
  47. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/REVIEW3.md +0 -0
  48. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/ai.just +0 -0
  49. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/benchmarks/repeated_quotes.py +0 -0
  50. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/copilot-instructions.md +0 -0
  51. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/about.md +0 -0
  52. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/assets/zotero-find-full-text.png +0 -0
  53. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/concepts/content-types.md +0 -0
  54. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/concepts/editorial-conventions.md +0 -0
  55. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/concepts/how-it-works.md +0 -0
  56. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/elements/.gitkeep +0 -0
  57. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/add-reference-source.md +0 -0
  58. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/export-cache-to-zotero.md +0 -0
  59. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/fetch-full-text-and-pdfs.md +0 -0
  60. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/repair-validation-errors.md +0 -0
  61. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/skip-unsupported-references.md +0 -0
  62. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/use-local-files-and-urls.md +0 -0
  63. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/validate-clinical-trials.md +0 -0
  64. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/validate-dois.md +0 -0
  65. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/validate-entrez.md +0 -0
  66. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/validate-obo-files.md +0 -0
  67. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/validate-titles.md +0 -0
  68. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/validate-urls.md +0 -0
  69. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/how-to/validate-wikipedia.md +0 -0
  70. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/index.md +0 -0
  71. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/notebooks/01_getting_started.ipynb +0 -0
  72. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/notebooks/02_advanced_usage.ipynb +0 -0
  73. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/notebooks/03_python_api.ipynb +0 -0
  74. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/notebooks/04_obo_validation.ipynb +0 -0
  75. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/notebooks/05_geo_validation.ipynb +0 -0
  76. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/quickstart.md +0 -0
  77. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/reference/cache-format.md +0 -0
  78. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/reference/splitting.md +0 -0
  79. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/setup-guide.md +0 -0
  80. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/superpowers/plans/2026-06-12-modular-pdf-fulltext-fetching.md +0 -0
  81. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/superpowers/plans/2026-08-05-private-library-full-text.md +0 -0
  82. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/superpowers/specs/2026-06-12-modular-pdf-fulltext-fetching-design.md +0 -0
  83. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/superpowers/specs/2026-08-05-private-library-full-text-design.md +0 -0
  84. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/templates-linkml/README.md +0 -0
  85. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/todo.md +0 -0
  86. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/troubleshooting.md +0 -0
  87. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/docs/tutorials/complete-workflow.md +0 -0
  88. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/examples/README.md +0 -0
  89. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/justfile +0 -0
  90. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/mypy.ini +0 -0
  91. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/notebooks/01_getting_started.ipynb +0 -0
  92. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/notebooks/02_advanced_usage.ipynb +0 -0
  93. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/notebooks/03_python_api.ipynb +0 -0
  94. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/notebooks/README.md +0 -0
  95. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/project/README.md +0 -0
  96. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/project.justfile +0 -0
  97. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/pyproject.toml +0 -0
  98. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/pytest.ini +0 -0
  99. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/skills/linkml-reference-validator/SKILL.md +0 -0
  100. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/skills/linkml-reference-validator/references/configuration.md +0 -0
  101. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/skills/linkml-reference-validator/references/guardrails.md +0 -0
  102. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/__init__.py +0 -0
  103. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/_version.py +0 -0
  104. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/cache.py +0 -0
  105. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/cli/cache.py +0 -0
  106. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/cli/lookup.py +0 -0
  107. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/cli/repair.py +0 -0
  108. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/cli/shared.py +0 -0
  109. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/cli/validate.py +0 -0
  110. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/__init__.py +0 -0
  111. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/acquire.py +0 -0
  112. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/csl_export.py +0 -0
  113. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/extract/__init__.py +0 -0
  114. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/extract/base.py +0 -0
  115. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/extract/drawio.py +0 -0
  116. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/extract/html.py +0 -0
  117. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/extract/pdf.py +0 -0
  118. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/extract/svg.py +0 -0
  119. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/extract/svg_geometry.py +0 -0
  120. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/extract/untrusted_xml.py +0 -0
  121. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/extract/xml.py +0 -0
  122. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/__init__.py +0 -0
  123. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/base.py +0 -0
  124. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/bioc.py +0 -0
  125. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/bookshelf.py +0 -0
  126. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/epmc.py +0 -0
  127. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/epmc_preprint.py +0 -0
  128. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/json_api.py +0 -0
  129. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/loader.py +0 -0
  130. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/openalex.py +0 -0
  131. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/pmc.py +0 -0
  132. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/unpaywall.py +0 -0
  133. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/fulltext/zotero.py +0 -0
  134. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/identifiers.py +0 -0
  135. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/reference_fetcher.py +0 -0
  136. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/rules.py +0 -0
  137. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/__init__.py +0 -0
  138. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/base.py +0 -0
  139. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/clinicaltrials.py +0 -0
  140. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/doi.py +0 -0
  141. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/entrez.py +0 -0
  142. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/file.py +0 -0
  143. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/json_api.py +0 -0
  144. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/loader.py +0 -0
  145. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/pmid.py +0 -0
  146. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/ppr.py +0 -0
  147. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/url.py +0 -0
  148. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/utils.py +0 -0
  149. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/sources/wikipedia.py +0 -0
  150. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/etl/text_extractor.py +0 -0
  151. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/field_detection.py +0 -0
  152. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/matching.py +0 -0
  153. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/plugins/REVIEW.md +0 -0
  154. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/plugins/__init__.py +0 -0
  155. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/plugins/reference_validation_plugin.py +0 -0
  156. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/validation/__init__.py +0 -0
  157. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/validation/fuzzy_text_utils.py +0 -0
  158. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/validation/repairer.py +0 -0
  159. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/src/linkml_reference_validator/validation/supporting_text_validator.py +0 -0
  160. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/__init__.py +0 -0
  161. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/conftest.py +0 -0
  162. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/data/test_data_deep_nesting_invalid.yaml +0 -0
  163. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/data/test_data_deep_nesting_valid.yaml +0 -0
  164. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/data/test_data_invalid.yaml +0 -0
  165. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/data/test_data_valid.yaml +0 -0
  166. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/data/test_schema.yaml +0 -0
  167. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/data/test_schema_deep_nesting.yaml +0 -0
  168. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/GEO_GSE12345.md +0 -0
  169. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/PMC_TEST001.md +0 -0
  170. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/PMC_TEST001.txt +0 -0
  171. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/PMC_TEST002.md +0 -0
  172. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/PMC_TEST002.txt +0 -0
  173. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/PMID_TEST001.md +0 -0
  174. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/PMID_TEST001.txt +0 -0
  175. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/PMID_TEST002.md +0 -0
  176. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/PMID_TEST002.txt +0 -0
  177. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/PMID_TEST003.md +0 -0
  178. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/PMID_TEST003.txt +0 -0
  179. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/bookshelf/esummary_20301710.xml +0 -0
  180. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/bookshelf/gene_NBK1116/men1.nxml +0 -0
  181. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/bookshelf/pubmed_20301710.xml +0 -0
  182. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/clinicaltrials_NCT00000001.md +0 -0
  183. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/fulltext_html/README.md +0 -0
  184. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/fulltext_html/dspace-32894695.html +0 -0
  185. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/fulltext_html/iris-19049553.html +0 -0
  186. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/fulltext_html/plos-0000308.html +0 -0
  187. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/jats/PMC5593426.xml +0 -0
  188. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/jats/README.md +0 -0
  189. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/fixtures/sample.obo +0 -0
  190. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_absent_abstract_recovery.py +0 -0
  191. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_acquire.py +0 -0
  192. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_bookshelf_provider.py +0 -0
  193. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_bot_challenge.py +0 -0
  194. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_cache_author_recovery.py +0 -0
  195. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_cache_filename_collisions.py +0 -0
  196. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_cache_read_robustness.py +0 -0
  197. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_cache_validation.py +0 -0
  198. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_cli.py +0 -0
  199. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_cli_cache_enrich.py +0 -0
  200. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_cli_cache_export.py +0 -0
  201. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_cli_cache_reference.py +0 -0
  202. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_cli_lookup.py +0 -0
  203. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_cli_repair.py +0 -0
  204. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_clinicaltrials_cache.py +0 -0
  205. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_clinicaltrials_integration.py +0 -0
  206. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_deep_nesting.py +0 -0
  207. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_doi_preprint.py +0 -0
  208. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_doi_title_cleaning.py +0 -0
  209. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_doi_url_encoding.py +0 -0
  210. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_drawio.py +0 -0
  211. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_e2e_integration.py +0 -0
  212. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_empty_snippets.py +0 -0
  213. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_epmc_preprint_provider.py +0 -0
  214. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_extractor_fidelity.py +0 -0
  215. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_extractors.py +0 -0
  216. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_field_detection.py +0 -0
  217. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_field_detection_qualifiers.py +0 -0
  218. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_file_reference_cache.py +0 -0
  219. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_frontmatter_and_doi_case.py +0 -0
  220. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_fulltext_loader.py +0 -0
  221. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_fulltext_providers.py +0 -0
  222. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_fuzzy_suggestions.py +0 -0
  223. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_geo_integration.py +0 -0
  224. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_greek_variants.py +0 -0
  225. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_html_fulltext_acceptance.py +0 -0
  226. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_html_scope_text.py +0 -0
  227. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_identifiers.py +0 -0
  228. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_inline_abstract_headings.py +0 -0
  229. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_jats_tables.py +0 -0
  230. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_json_api_source.py +0 -0
  231. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_ligature_normalization.py +0 -0
  232. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_long_cache_filenames.py +0 -0
  233. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_meaning_changes.py +0 -0
  234. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_meaning_symbols.py +0 -0
  235. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_models.py +0 -0
  236. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_multivalued_reference.py +0 -0
  237. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_no_cache_downgrade.py +0 -0
  238. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_normalized_content_cache.py +0 -0
  239. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_open_access_policy.py +0 -0
  240. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_optional_linkml_dependency.py +0 -0
  241. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_pdf_url_title.py +0 -0
  242. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_plugin_integration.py +0 -0
  243. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_plugin_value_shapes.py +0 -0
  244. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_pmc_fulltext.py +0 -0
  245. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_pmid_network.py +0 -0
  246. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_ppr_source.py +0 -0
  247. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_publisher_typography.py +0 -0
  248. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_real_validation.py +0 -0
  249. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_reference_fetcher.py +0 -0
  250. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_repair.py +0 -0
  251. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_repair_data_output.py +0 -0
  252. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_repair_thresholds.py +0 -0
  253. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_rules.py +0 -0
  254. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_serve_stale_html_optin.py +0 -0
  255. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_signed_excerpts_and_fair_use.py +0 -0
  256. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_source_network_errors.py +0 -0
  257. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_source_utils.py +0 -0
  258. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_sources.py +0 -0
  259. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_split_supporting_text.py +0 -0
  260. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_supporting_text_validator.py +0 -0
  261. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_svg_edges.py +0 -0
  262. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_svg_extractor.py +0 -0
  263. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_text_extractor.py +0 -0
  264. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_title_only_shapes.py +0 -0
  265. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_title_validation.py +0 -0
  266. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_trust_cached_entries.py +0 -0
  267. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_unknown_slot_traversal.py +0 -0
  268. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_url_fragment_cache.py +0 -0
  269. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_url_html_sanitize.py +0 -0
  270. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_url_html_to_text.py +0 -0
  271. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_url_source_cache_version.py +0 -0
  272. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_validation_config.py +0 -0
  273. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_validation_counts.py +0 -0
  274. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_welded_markers.py +0 -0
  275. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_wikipedia_source.py +0 -0
  276. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_word_boundaries.py +0 -0
  277. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_xml_extractor_text.py +0 -0
  278. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/tests/test_zotero_provider.py +0 -0
  279. {linkml_reference_validator-0.6.0 → linkml_reference_validator-0.7.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: linkml_reference_validator
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Validation of supporting text from references and publications
5
5
  Author-email: Chris Mungall <cjmungall@lbl.gov>
6
6
  License-Expression: Apache-2.0
@@ -0,0 +1,122 @@
1
+ # Using Signed Excerpts from a Private Full-Text Store
2
+
3
+ A public repository cannot commit closed-access full texts to its
4
+ `references_cache/`, so a quote taken from the body of a paywalled paper fails
5
+ ordinary validation. Signed excerpts close that gap. A **private store** holds
6
+ the full texts and verifies short, fair-use excerpts against them. The
7
+ verified excerpts are then copied into the public repository, where the
8
+ validator accepts an exact match against them.
9
+
10
+ The store is any directory of YAML bundles. The reference setup is
11
+ [claimstore](https://github.com/monarch-initiative/claimstore), a private
12
+ repository that runs this validator over its own full texts and writes its
13
+ bundles to `signed_excerpts/`.
14
+
15
+ ## How validation uses signed excerpts
16
+
17
+ Set `signed_excerpts_dir` in `.linkml-reference-validator.yaml`:
18
+
19
+ ```yaml
20
+ validation:
21
+ cache_dir: references_cache
22
+ signed_excerpts_dir: signed_excerpts
23
+ ```
24
+
25
+ An excerpt then passes if EITHER:
26
+
27
+ 1. it matches the reference in `references_cache/` as usual, OR
28
+ 2. it exactly matches (after collapsing whitespace) an excerpt recorded for
29
+ that reference in `signed_excerpts/<REF_ID>.yaml`.
30
+
31
+ Any edit to a signed excerpt in the public repository makes it fail, so the
32
+ public copy cannot drift from what the private store verified.
33
+
34
+ A bundle is named like a cache file (`PMID_12345.yaml`,
35
+ `DOI_10.1038_s41418-020-0601-5.yaml`) and looks like this:
36
+
37
+ ```yaml
38
+ reference_id: PMID:12345
39
+ title: Example title
40
+ excerpts:
41
+ - text: The verbatim quote ... with omitted words marked by an ellipsis.
42
+ claim_text: Optional paraphrase of the claim the quote supports.
43
+ target_repo:
44
+ - dismech:kb/disorders/Example.yaml
45
+ ```
46
+
47
+ Only `reference_id` and each excerpt's `text` are used by validation. Other
48
+ fields (claims, NER annotations, checksums) are carried along unchanged.
49
+
50
+ ## Syncing bundles with `excerpts sync`
51
+
52
+ `excerpts sync` copies bundles from a local checkout of the private store
53
+ into `signed_excerpts_dir`. Files are copied byte for byte, so the public copy
54
+ is exactly what the store verified.
55
+
56
+ ```bash
57
+ linkml-reference-validator excerpts sync --source ../claimstore/signed_excerpts
58
+ ```
59
+
60
+ With no filters every bundle is copied. A store usually serves several
61
+ repositories, so two filters narrow the selection. A bundle is copied if it
62
+ passes EITHER filter:
63
+
64
+ - `--target-repo NAME` selects bundles with an excerpt whose `target_repo`
65
+ is `NAME` or starts with `NAME:`.
66
+ - `--referenced-in GLOB` (repeatable) selects bundles whose `reference_id` is
67
+ cited in a file matching the glob. This catches excerpts that were never
68
+ tagged with a `target_repo`. Globs are relative to the working directory,
69
+ and a glob that matches no files is an error. The `reference_id` is matched
70
+ as written in the bundle (ignoring case), without the prefix normalization
71
+ that validation applies, so bundles should use the same CURIE form as the
72
+ citing data.
73
+
74
+ List every directory whose files are validated against `signed_excerpts_dir`.
75
+ With `--prune`, a bundle cited only from a directory left out of the list is
76
+ deleted.
77
+
78
+ Other options:
79
+
80
+ - `--prune` deletes bundles in the destination that are no longer selected.
81
+ Files that are not YAML, such as a README, are left alone. Pruning is refused
82
+ if nothing is selected, so a wrong source cannot empty the destination.
83
+ - `--check` writes nothing and exits 1 if the destination is out of date. Other
84
+ errors (missing source, malformed bundle, bad glob) exit 2.
85
+ - `--signed-excerpts-dir DIR` overrides the destination from the config.
86
+
87
+ ### Configuring a repository
88
+
89
+ Put the selection in the config file so that everyone syncs the same way. The
90
+ source path depends on where each person cloned the private store, so supply it
91
+ with `--source` or the `LRV_SIGNED_EXCERPTS_SOURCE` environment variable. It can
92
+ also go in `signed_excerpts_sync.source_dir`, but then it is the same for everyone.
93
+
94
+ ```yaml
95
+ validation:
96
+ signed_excerpts_dir: signed_excerpts
97
+ signed_excerpts_sync:
98
+ target_repo: dismech
99
+ referenced_in:
100
+ - kb/disorders/*.yaml
101
+ - kb/modules/*.yaml
102
+ prune: true
103
+ ```
104
+
105
+ Options given on the command line override the config.
106
+
107
+ ### Example: dismech
108
+
109
+ [dismech](https://github.com/monarch-initiative/dismech) cites claimstore
110
+ excerpts in `kb/disorders/`. Its config holds the settings above, and its
111
+ justfile wraps the command:
112
+
113
+ ```bash
114
+ # needs read access to the private monarch-initiative/claimstore repo
115
+ git clone git@github.com:monarch-initiative/claimstore.git ../claimstore
116
+ just sync-signed-excerpts # uses ../claimstore by default
117
+ CLAIMSTORE_DIR=~/repos/claimstore just sync-signed-excerpts
118
+ ```
119
+
120
+ Then commit the changed `signed_excerpts/*.yaml` files with the disorder files
121
+ that quote them. Validation in dismech CI reads only the committed
122
+ `signed_excerpts/` and never needs access to the private store.
@@ -18,6 +18,7 @@ linkml-reference-validator [OPTIONS] COMMAND [ARGS]...
18
18
  - `validate` - Validate supporting text against references
19
19
  - `repair` - Repair supporting text validation errors
20
20
  - `cache` - Manage reference cache
21
+ - `excerpts` - Manage signed excerpts synced from a private full-text store
21
22
 
22
23
  ---
23
24
 
@@ -677,6 +678,41 @@ repair:
677
678
 
678
679
  ---
679
680
 
681
+ ## excerpts sync
682
+
683
+ Copy signed excerpt bundles from a local checkout of a private full-text store
684
+ into `signed_excerpts_dir`. See
685
+ [Using Signed Excerpts](../how-to/use-signed-excerpts.md).
686
+
687
+ ### Usage
688
+
689
+ ```bash
690
+ linkml-reference-validator excerpts sync [OPTIONS]
691
+ ```
692
+
693
+ ### Options
694
+
695
+ - `--source, -s PATH` - Bundle directory in the private store (env: `LRV_SIGNED_EXCERPTS_SOURCE`)
696
+ - `--signed-excerpts-dir PATH` - Destination (default: `signed_excerpts_dir` from config)
697
+ - `--target-repo NAME` - Select bundles tagged for this repo in `target_repo`
698
+ - `--referenced-in GLOB` - Select bundles whose reference is cited in matching files (repeatable)
699
+ - `--prune / --no-prune` - Remove destination bundles that are no longer selected
700
+ - `--check` - Write nothing; exit 1 if the destination is out of date
701
+ - `--config PATH` - Configuration file
702
+
703
+ Defaults for `--target-repo`, `--referenced-in`, `--prune` and `--source` come from
704
+ the `signed_excerpts_sync` section of the config.
705
+
706
+ ### Exit Codes
707
+
708
+ - `0` - Synced (or, with `--check`, already up to date)
709
+ - `1` - With `--check`, out of date
710
+ - `2` - Configuration or input error: no source or destination, source directory
711
+ missing, a malformed bundle, a `--referenced-in` glob that is absolute or matches
712
+ no files, or `--prune` with nothing selected
713
+
714
+ ---
715
+
680
716
  ## cache
681
717
 
682
718
  Manage reference cache.
@@ -43,6 +43,7 @@ nav:
43
43
  - Validating Reference Titles: how-to/validate-titles.md
44
44
  - Using Local Files and URLs: how-to/use-local-files-and-urls.md
45
45
  - Fetching Full Text and PDFs: how-to/fetch-full-text-and-pdfs.md
46
+ - Using Signed Excerpts: how-to/use-signed-excerpts.md
46
47
  - Exporting a Cache to Zotero: how-to/export-cache-to-zotero.md
47
48
  - Adding a New Reference Source: how-to/add-reference-source.md
48
49
  - Skipping Unsupported References: how-to/skip-unsupported-references.md
@@ -4,6 +4,7 @@ import typer
4
4
 
5
5
  # Import subcommand modules
6
6
  from .cache import cache_app, reference_command
7
+ from .excerpts import excerpts_app
7
8
  from .lookup import lookup_command
8
9
  from .repair import repair_app
9
10
  from .validate import data_command, text_command, validate_app
@@ -34,6 +35,12 @@ app.add_typer(
34
35
  help="Manage reference cache",
35
36
  )
36
37
 
38
+ app.add_typer(
39
+ excerpts_app,
40
+ name="excerpts",
41
+ help="Manage signed excerpts synced from a private full-text store",
42
+ )
43
+
37
44
  # Register top-level lookup command
38
45
  app.command(name="lookup")(lookup_command)
39
46
 
@@ -0,0 +1,129 @@
1
+ """Commands for managing signed excerpts synced from a private full-text store."""
2
+
3
+ from pathlib import Path
4
+ from typing import Optional
5
+
6
+ import typer
7
+ from ruamel.yaml import YAMLError # type: ignore
8
+ from typing_extensions import Annotated
9
+
10
+ from linkml_reference_validator.signed_excerpts import sync_signed_excerpts
11
+ from .shared import ConfigFileOption, SignedExcerptsDirOption, load_validation_config
12
+
13
+ excerpts_app = typer.Typer(
14
+ help="Manage signed excerpts synced from a private full-text store",
15
+ no_args_is_help=True,
16
+ )
17
+
18
+
19
+ @excerpts_app.command(name="sync")
20
+ def sync_command(
21
+ source: Annotated[
22
+ Optional[Path],
23
+ typer.Option(
24
+ "--source",
25
+ "-s",
26
+ envvar="LRV_SIGNED_EXCERPTS_SOURCE",
27
+ help=(
28
+ "Signed excerpts directory in a local checkout of the private store "
29
+ "(e.g. ../claimstore/signed_excerpts). Overrides signed_excerpts_sync.source_dir."
30
+ ),
31
+ ),
32
+ ] = None,
33
+ signed_excerpts_dir: SignedExcerptsDirOption = None,
34
+ target_repo: Annotated[
35
+ Optional[str],
36
+ typer.Option(
37
+ "--target-repo",
38
+ help="Select bundles tagged for this repo in excerpt target_repo (e.g. dismech)",
39
+ ),
40
+ ] = None,
41
+ referenced_in: Annotated[
42
+ Optional[list[str]],
43
+ typer.Option(
44
+ "--referenced-in",
45
+ help="Glob of data files; select bundles whose reference is cited there (repeatable)",
46
+ ),
47
+ ] = None,
48
+ prune: Annotated[
49
+ Optional[bool],
50
+ typer.Option(
51
+ "--prune/--no-prune",
52
+ help="Remove destination bundles that are no longer selected",
53
+ ),
54
+ ] = None,
55
+ check: Annotated[
56
+ bool,
57
+ typer.Option(
58
+ "--check",
59
+ help="Write nothing; exit 1 if the destination is out of date",
60
+ ),
61
+ ] = False,
62
+ config_file: ConfigFileOption = None,
63
+ ):
64
+ """Copy signed excerpt bundles from a private store into signed_excerpts_dir.
65
+
66
+ Options given on the command line override the `signed_excerpts_sync`
67
+ section of the config file.
68
+
69
+ Examples:
70
+
71
+ linkml-reference-validator excerpts sync --source ../claimstore/signed_excerpts
72
+
73
+ linkml-reference-validator excerpts sync -s ../claimstore/signed_excerpts \\
74
+ --signed-excerpts-dir signed_excerpts --target-repo dismech \\
75
+ --referenced-in 'kb/disorders/*.yaml' --prune
76
+ """
77
+ config = load_validation_config(config_file, load_custom_sources=False)
78
+ settings = config.signed_excerpts_sync
79
+
80
+ source_dir = source or settings.source_dir
81
+ if source_dir is None:
82
+ typer.echo(
83
+ "No source given: pass --source, set LRV_SIGNED_EXCERPTS_SOURCE, "
84
+ "or set signed_excerpts_sync.source_dir in the config.",
85
+ err=True,
86
+ )
87
+ raise typer.Exit(2)
88
+ dest_dir = signed_excerpts_dir or config.signed_excerpts_dir
89
+ if dest_dir is None:
90
+ typer.echo(
91
+ "No destination: pass --signed-excerpts-dir or set signed_excerpts_dir in the config.",
92
+ err=True,
93
+ )
94
+ raise typer.Exit(2)
95
+ # Problems with the private store or the selection are user errors, so
96
+ # report them as such (exit 2) rather than as a traceback; exit 1 is
97
+ # reserved for --check finding drift.
98
+ try:
99
+ report = sync_signed_excerpts(
100
+ source_dir,
101
+ dest_dir,
102
+ target_repo=(target_repo if target_repo is not None else settings.target_repo)
103
+ or None,
104
+ referenced_in=referenced_in or settings.referenced_in,
105
+ prune=prune if prune is not None else settings.prune,
106
+ dry_run=check,
107
+ )
108
+ except FileNotFoundError as e:
109
+ typer.echo(f"{e} (is the private store cloned there?)", err=True)
110
+ raise typer.Exit(2)
111
+ except (ValueError, YAMLError) as e:
112
+ typer.echo(str(e), err=True)
113
+ raise typer.Exit(2)
114
+
115
+ verb = "would be " if check else ""
116
+ for label, names in [
117
+ ("added", report.added),
118
+ ("updated", report.updated),
119
+ ("removed", report.removed),
120
+ ]:
121
+ for name in names:
122
+ typer.echo(f" {label}: {name}")
123
+ typer.echo(
124
+ f"{source_dir} -> {dest_dir}: {len(report.added)} {verb}added, "
125
+ f"{len(report.updated)} {verb}updated, {len(report.removed)} {verb}removed, "
126
+ f"{len(report.unchanged)} unchanged"
127
+ )
128
+ if check and report.changed:
129
+ raise typer.Exit(1)
@@ -419,6 +419,51 @@ class RepairConfig(BaseModel):
419
419
  )
420
420
 
421
421
 
422
+ class SignedExcerptsSyncConfig(BaseModel):
423
+ """Settings for ``excerpts sync``, which copies signed excerpt bundles from a
424
+ private full-text store (e.g. claimstore) into a public repo's
425
+ ``signed_excerpts_dir``.
426
+
427
+ With no ``target_repo`` and no ``referenced_in`` every bundle is copied.
428
+ Otherwise a bundle is copied if it is tagged for ``target_repo`` OR its
429
+ ``reference_id`` is cited in a file matching ``referenced_in``.
430
+
431
+ Examples:
432
+ >>> SignedExcerptsSyncConfig().prune
433
+ False
434
+ >>> c = SignedExcerptsSyncConfig(target_repo="dismech", referenced_in=["kb/disorders/*.yaml"])
435
+ >>> c.target_repo, c.referenced_in
436
+ ('dismech', ['kb/disorders/*.yaml'])
437
+ """
438
+
439
+ source_dir: Optional[Path] = Field(
440
+ default=None,
441
+ description=(
442
+ "Directory of signed excerpt bundles in a local checkout of the private "
443
+ "store (e.g. ../claimstore/signed_excerpts). Usually supplied per user "
444
+ "with --source or LRV_SIGNED_EXCERPTS_SOURCE instead."
445
+ ),
446
+ )
447
+ target_repo: Optional[str] = Field(
448
+ default=None,
449
+ description=(
450
+ "Select bundles with an excerpt whose target_repo entry is this name or "
451
+ "starts with '<name>:' (e.g. 'dismech' matches 'dismech:kb/disorders/X.yaml')."
452
+ ),
453
+ )
454
+ referenced_in: list[str] = Field(
455
+ default_factory=list,
456
+ description=(
457
+ "Glob patterns (relative to the working directory) of data files; select "
458
+ "bundles whose reference_id is cited in any of them."
459
+ ),
460
+ )
461
+ prune: bool = Field(
462
+ default=False,
463
+ description="Remove bundles from the destination that are no longer selected.",
464
+ )
465
+
466
+
422
467
  class ReferenceValidationConfig(BaseModel):
423
468
  r"""Configuration for reference validation.
424
469
 
@@ -476,6 +521,13 @@ class ReferenceValidationConfig(BaseModel):
476
521
  "excerpt recorded for that reference in signed_excerpts_dir."
477
522
  ),
478
523
  )
524
+ signed_excerpts_sync: SignedExcerptsSyncConfig = Field(
525
+ default_factory=SignedExcerptsSyncConfig,
526
+ description=(
527
+ "How `excerpts sync` selects bundles from the private store to copy "
528
+ "into signed_excerpts_dir."
529
+ ),
530
+ )
479
531
  private_cache_dir: Path = Field(
480
532
  default_factory=lambda: Path.home()
481
533
  / ".cache"
@@ -0,0 +1,226 @@
1
+ """Sync signed excerpt bundles from a private full-text store into a public repo.
2
+
3
+ A private store such as claimstore keeps full texts and verifies short fair-use
4
+ excerpts against them. Each verified bundle (``<REF_ID>.yaml`` with a
5
+ ``reference_id`` and a list of ``excerpts``) is copied verbatim into a public
6
+ repo's ``signed_excerpts_dir``, where validation accepts an exact match against
7
+ it. This module selects which bundles a public repo needs and copies them.
8
+ """
9
+
10
+ import re
11
+ from dataclasses import dataclass, field
12
+ from pathlib import Path
13
+ from typing import Any, Iterable, Optional
14
+
15
+ from ruamel.yaml import YAML # type: ignore
16
+
17
+ BUNDLE_SUFFIXES = (".yaml", ".yml")
18
+
19
+ # An identifier must not be preceded by an identifier character, nor followed
20
+ # by one, nor by a "." that continues it (``x.5``); a sentence-final "." is fine.
21
+ _ID_BOUNDARY = r"(?<![\w./-]){}(?![\w/-]|\.\w)"
22
+
23
+
24
+ @dataclass
25
+ class SyncReport:
26
+ """Bundle filenames grouped by what a sync did (or would do) to each.
27
+
28
+ Examples:
29
+ >>> SyncReport().changed
30
+ False
31
+ >>> SyncReport(added=["PMID_1.yaml"]).changed
32
+ True
33
+ """
34
+
35
+ added: list[str] = field(default_factory=list)
36
+ updated: list[str] = field(default_factory=list)
37
+ unchanged: list[str] = field(default_factory=list)
38
+ removed: list[str] = field(default_factory=list)
39
+
40
+ @property
41
+ def changed(self) -> bool:
42
+ """True if the destination differs (or differed) from the selection."""
43
+ return bool(self.added or self.updated or self.removed)
44
+
45
+
46
+ def is_tagged_for(bundle: dict[str, Any], target_repo: str) -> bool:
47
+ """Return True if any excerpt in ``bundle`` lists ``target_repo`` in its target_repo.
48
+
49
+ Examples:
50
+ >>> b = {"excerpts": [{"text": "x", "target_repo": ["dismech:kb/disorders/A.yaml"]}]}
51
+ >>> is_tagged_for(b, "dismech")
52
+ True
53
+ >>> is_tagged_for(b, "dis")
54
+ False
55
+ >>> is_tagged_for({"excerpts": [{"text": "x", "target_repo": "dismech"}]}, "dismech")
56
+ True
57
+ >>> is_tagged_for({"excerpts": ["plain string excerpt"]}, "dismech")
58
+ False
59
+ """
60
+ for excerpt in bundle.get("excerpts") or []:
61
+ if not isinstance(excerpt, dict):
62
+ continue
63
+ targets = excerpt.get("target_repo") or []
64
+ if isinstance(targets, str):
65
+ targets = [targets]
66
+ for target in targets:
67
+ if target == target_repo or str(target).startswith(f"{target_repo}:"):
68
+ return True
69
+ return False
70
+
71
+
72
+ def find_cited_reference_ids(
73
+ reference_ids: Iterable[str], paths: Iterable[Path]
74
+ ) -> set[str]:
75
+ """Return the subset of ``reference_ids`` that appear in any file in ``paths``.
76
+
77
+ Matching ignores case (DOIs are case-insensitive) and respects identifier
78
+ boundaries, so ``PMID:1`` is not found inside ``PMID:12``.
79
+
80
+ Examples:
81
+ >>> import tempfile
82
+ >>> d = Path(tempfile.mkdtemp())
83
+ >>> _ = (d / "a.yaml").write_text("reference: PMID:12\\nsee doi:10.1/X.")
84
+ >>> sorted(find_cited_reference_ids(["PMID:1", "PMID:12", "DOI:10.1/x"], [d / "a.yaml"]))
85
+ ['DOI:10.1/x', 'PMID:12']
86
+ """
87
+ # A plain substring test is much faster than a regex over large corpora,
88
+ # so it screens each file and the boundary regex only confirms the hits.
89
+ remaining = {i.lower(): i for i in reference_ids}
90
+ found: set[str] = set()
91
+ for path in paths:
92
+ if not remaining:
93
+ break
94
+ # Undecodable bytes cannot be part of an identifier, so drop them.
95
+ text = path.read_bytes().decode("utf-8", errors="ignore").lower()
96
+ for key in [k for k in remaining if k in text]:
97
+ if re.search(_ID_BOUNDARY.format(re.escape(key)), text):
98
+ found.add(remaining.pop(key))
99
+ return found
100
+
101
+
102
+ def _expand_globs(patterns: Iterable[str], base_dir: Path) -> list[Path]:
103
+ """Expand glob patterns relative to ``base_dir`` into existing files.
104
+
105
+ Raises:
106
+ ValueError: if a pattern is absolute or matches no files. A pattern that
107
+ silently matches nothing would shrink the selection, and with
108
+ pruning delete bundles that are still needed.
109
+ """
110
+ paths: list[Path] = []
111
+ for pattern in patterns:
112
+ if Path(pattern).is_absolute():
113
+ raise ValueError(f"referenced_in pattern must be relative: {pattern}")
114
+ matches = [p for p in sorted(base_dir.glob(pattern)) if p.is_file()]
115
+ if not matches:
116
+ raise ValueError(
117
+ f"referenced_in pattern matches no files under {base_dir}: {pattern}"
118
+ )
119
+ paths.extend(matches)
120
+ return paths
121
+
122
+
123
+ def _load_bundle(path: Path) -> dict[str, Any]:
124
+ """Parse a bundle file, failing with the file named if it is not a mapping."""
125
+ data = YAML(typ="safe").load(path)
126
+ if not isinstance(data, dict):
127
+ raise ValueError(f"Signed excerpt bundle is not a YAML mapping: {path}")
128
+ return data
129
+
130
+
131
+ def _bundle_files(directory: Path) -> list[Path]:
132
+ """List bundle files (YAML) directly inside ``directory``."""
133
+ return sorted(
134
+ p for p in directory.iterdir() if p.is_file() and p.suffix in BUNDLE_SUFFIXES
135
+ )
136
+
137
+
138
+ def select_bundles(
139
+ source_dir: Path,
140
+ target_repo: Optional[str] = None,
141
+ referenced_in: Iterable[str] = (),
142
+ base_dir: Path = Path("."),
143
+ ) -> list[Path]:
144
+ """Select the bundle files in ``source_dir`` that a downstream repo needs.
145
+
146
+ With neither ``target_repo`` nor ``referenced_in`` every bundle is selected.
147
+ Otherwise a bundle is selected if it is tagged for ``target_repo`` OR its
148
+ ``reference_id`` is cited in a file matching one of the ``referenced_in``
149
+ globs (relative to ``base_dir``).
150
+ """
151
+ files = _bundle_files(source_dir)
152
+ patterns = list(referenced_in)
153
+ if target_repo is None and not patterns:
154
+ return files
155
+
156
+ bundles = {f: _load_bundle(f) for f in files}
157
+ cited = find_cited_reference_ids(
158
+ (str(b["reference_id"]) for b in bundles.values() if b.get("reference_id")),
159
+ _expand_globs(patterns, base_dir),
160
+ )
161
+ return [
162
+ f
163
+ for f, bundle in bundles.items()
164
+ if (target_repo is not None and is_tagged_for(bundle, target_repo))
165
+ or str(bundle.get("reference_id")) in cited
166
+ ]
167
+
168
+
169
+ def sync_signed_excerpts(
170
+ source_dir: Path,
171
+ dest_dir: Path,
172
+ target_repo: Optional[str] = None,
173
+ referenced_in: Iterable[str] = (),
174
+ prune: bool = False,
175
+ dry_run: bool = False,
176
+ base_dir: Path = Path("."),
177
+ ) -> SyncReport:
178
+ """Copy selected bundles verbatim from ``source_dir`` into ``dest_dir``.
179
+
180
+ Files are copied byte-for-byte so the public copy is exactly what the
181
+ private store verified. With ``prune`` bundles in ``dest_dir`` that are no
182
+ longer selected are deleted; other files (e.g. a README) are left alone.
183
+ With ``dry_run`` nothing is written and the report describes what would
184
+ change.
185
+
186
+ Raises:
187
+ FileNotFoundError: if ``source_dir`` is not a directory (for example
188
+ the private store has not been cloned).
189
+ ValueError: if a bundle is malformed, a ``referenced_in`` pattern is
190
+ absolute or matches nothing, or ``prune`` is set and nothing is
191
+ selected (which would delete every bundle).
192
+ """
193
+ if not source_dir.is_dir():
194
+ raise FileNotFoundError(f"Signed excerpts source not found: {source_dir}")
195
+
196
+ report = SyncReport()
197
+ selected = select_bundles(source_dir, target_repo, referenced_in, base_dir)
198
+ if prune and not selected:
199
+ raise ValueError(
200
+ f"Refusing to prune: no bundles in {source_dir} match the selection"
201
+ )
202
+ if not dry_run:
203
+ dest_dir.mkdir(parents=True, exist_ok=True)
204
+
205
+ for src in selected:
206
+ dest = dest_dir / src.name
207
+ content = src.read_bytes()
208
+ if not dest.exists():
209
+ report.added.append(src.name)
210
+ elif dest.read_bytes() != content:
211
+ report.updated.append(src.name)
212
+ else:
213
+ report.unchanged.append(src.name)
214
+ continue
215
+ if not dry_run:
216
+ dest.write_bytes(content)
217
+
218
+ if prune and dest_dir.is_dir():
219
+ selected_names = {src.name for src in selected}
220
+ for stale in _bundle_files(dest_dir):
221
+ if stale.name not in selected_names:
222
+ report.removed.append(stale.name)
223
+ if not dry_run:
224
+ stale.unlink()
225
+
226
+ return report