Skip to content

Add RdfReader supporting JSON-LD, TriG and RDF/XML - #1838

Merged
niklasl merged 4 commits into
developfrom
feature/load-rdf
Oct 1, 2026
Merged

niklasl merged 4 commits into
developfrom
feature/load-rdf

Conversation

@niklasl

@niklasl niklasl commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

This is mainly in preparation for ingesting RDF/XML (part of general importer improvements for systems librarians).

Feature includes:

  • Add RdfXmlToJsonLdParser (and EmbedBlanks, currently only used for that)
  • Adapt TrigToJsonLdParser (performs expand-and-compact; could be extended to flatten and re-embed blanks)
  • Adapt create-from-rdf.groovy example script
  • Unit tests
  • Example source data

Example test creation (replace .rdf with .ttl or .jsonld for the different example input formats):

$ cd whelktool/
$ java  -Dxl.secret.properties=../some-secret.properties \
        -Drdfdata=scripts/examples/records/libris-example-record.rdf \
        -jar build/libs/whelktool.jar --dry-run --step scripts/examples/create-from-rdf.groovy

(Each file contains one main entity (and some extra meta for the record). It will fail since create requires loud mode, but choose p to print the resulting jsonld form that would have been created in XL.)


Following this, we want:

  1. Some discussion about useful IRI handling.
  2. Add the script logic as a buitlin whelktool operation? (Another such candidate is apply-rdf-patch.groovy.)
  3. One or two new ways to ingest record sets (including simply loading them as sets of files); reasonably added to DatasetImporter. We can do this as a follow-up PR.

@olovy olovy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@niklasl
niklasl merged commit a8d8afe into develop Oct 1, 2026
1 check passed
@niklasl
niklasl deleted the feature/load-rdf branch October 1, 2026 12:34
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