Repository navigation
feat(licenses): per-book licenses from Sefaria versions.json - #106
Merged
Merged
Conversation
Add license / edition / book_edition tables and the book_license_v view. Licenses are get-or-create (Licenses.canonicalCode folds PD/Public Domain and blank/unknown); permission flags are known for the CC/PD family only. The Sefaria importer reads each book's merged versions from merged.json and resolves their license from versions.json (SefariaExport >= 2026-10-08). An unknown version inherits the license of its edition when all the edition's known versions agree, flagged as inferred; otherwise unknown. Every version is resolved before any insert, failing on a missing one. License and edition ids go through the IdAllocator, and the new tables are tracked by the patch producer and the logical content hash. Signed-off-by: Elie Gambache <elyahou.hadass@gmail.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
license(get-or-create oncode, nullable permission flags),edition(versionTitle + source URL),book_edition(per-book license +licenseInferred), and thebook_license_vview, the single place to read a book's licenses.generator/common:Licenses(canonical codes + permissions),upsertLicense/upsertEditionbindings,LICENSE/EDITIONid tables; new tables added to the patch tables and the logical content hash.versionsjoined withversions.jsonfrom the SefariaExport release (feat: export versions.json with Hebrew version licenses SefariaExport#6). Anunknownversion inherits its edition's license when all known versions of that edition agree (licenseInferred = 1); otherwise it staysunknown. All versions are resolved before inserting; a missing one fails the build.Non-Sefaria books get no row yet (= unknown).
Verification
./gradlew :generator-common:jvmTest :sefariasqlite:jvmTest :delta-updater:jvmTest :dao:jvmTestNotes
versions.json(release 2026-10-08 or later); the localbuild/sefaria/exportcache must be refreshed.🤖 Generated with Claude Code