8000 feat(rdf): import Dublin Core descriptions into a namespace by adeelahmad · Pull Request #82 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(rdf): import Dublin Core descriptions into a namespace - #82

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-s9qndz
Oct 3, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-s9qndz

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Before: Lens could export RDF (#79) but could not read it back. Catalogue records from elsewhere had to be typed in by hand.

After: editors can post Turtle, N-Triples or JSON-LD to POST /api/v1/namespaces/{name}/rdf/import. Each Dublin Core description is matched to a recording, by its Lens URI or by an identifier the recording already has, and fills its metadata. A dry run, which is the default, shows what would change. A real import writes metadata edits, so each one stays in the history and can be reverted, and it is recorded in the audit log. Statements that don't map to a field are kept on the recording and exported again, so exporting and re-importing changes nothing.

How: app/domain/rdf_import.py maps DCMI terms and the DC 1.1 elements onto metadata.save. It only adds terms and statements, while other fields are replaced. Speakers and entities named by URI must belong to the namespace. Nothing is fetched while parsing: JSON-LD with a remote @context is refused, and RDF/XML is not accepted. Input is capped at 5 MB. Recordings get a new statements metadata field. Docs are in docs/rdf.md.

Tests: tests/api/test_rdf.py covers a round trip with no change, matching by URI and by identifier, merging, the dry run, revert, refusing remote contexts, and roles. The full backend suite passes (374), except the known environmental LibreOffice test. tsc is clean, and the client was regenerated with make openapi.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RtRigWmLLWqBHqWmJ8CvA1


Generated by Claude Code

POST /api/v1/namespaces/{name}/rdf/import reads Turtle, N-Triples or
JSON-LD (inline @context only; nothing is fetched) and matches each
description to a recording by its /id/ URI or an identifier. DCMI terms
and DC 1.1 elements fill the metadata fields; any other statement is kept
in a new `statements` field and exported again, so a round trip changes
nothing. Dry run by default; real imports go through the metadata history
(revertable) and the audit log.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RtRigWmLLWqBHqWmJ8CvA1
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.

2 participants

0