Repository navigation
Jena 6 2 0 - #446
Open
svanteschubert wants to merge 2 commits into
Open
Jena 6 2 0#446svanteschubert wants to merge 2 commits into
svanteschubert wants to merge 2 commits into
Conversation
…#445) ODF uses only a self-contained subset of RDFa, so InContentMetadata now builds the per-element RDF cache lazily from the DOM instead of running the unmaintained java-rdfa parser on every XML load. This drops java-rdfa, its legacy jena-iri pin and commons-validator. The internal RDFa plumbing classes of org.odftoolkit.odfdom.pkg.rdfa are removed; the Jena model API is unchanged.
Align odfdom JDT compiler settings with Java 21 and refresh the resource filters written by the Java language server.
|
This branch has not been deployed
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.



@xzel23, what do you think? Would you approve the PR?
@Horcrux7, as you requested, a release to update Jena:
Update to Apache Jena 6.2.0 and JDK 21, and replace the java-rdfa dependency
Refs #445
Why
jena-iri. Our RDFa parsernet.rootdev:java-rdfa:1.0.0-BETA1still needs that library. Without a fix, Maven quietly falls back tojava-rdfa's own transitivejena-iri3.16.0 from 2020. Pinningjena-iri5.6.0 would work for now, but that version will get no further updates.java-rdfais no longer maintained, and there is no maintained replacement: Jena has no RDFa parser, Semargl has been inactive for years, and Apache Any23 was retired in 2023.Why ODF doesn't need an RDFa library
ODF uses only a small, self-contained subset of RDFa 1.0 (ODF 1.2 Part 1, §4.2.1 and §19.905–§19.908):
xhtml:about,xhtml:property,xhtml:datatypeandxhtml:contenttext:p,text:h,text:meta,text:bookmark-start,table:table-cellandtable:covered-table-cellxhtml:aboutandxhtml:propertytogetherSo there is no
rel/rev/typeof, and no subject inheritance between nested elements. Each element states its own statements: one per predicate, with the object taken fromxhtml:contentor the element's text.ODFDOM already used a modified copy of the
java-rdfaparser (about 1,300 lines in 9 classes) that ran as a second SAX handler on every XML file load. This PR replaces all of that with one class,InContentMetadata(about 60 lines of code, with detailed Javadoc).What changed
jena-coreandjena-arq6.2.0 (ARQ is needed for RDF/XML in Jena 6). Removedjava-rdfa, thejena-iripin, andcommons-validator, which only the removed code used.maven.yml,deployment.yml), the README and the Eclipse project settings.org.odftoolkit.odfdom.pkg.rdfa.InContentMetadata: reads the RDF statements of one element, expanding CURIEs through the XML namespace declarations of the file. Its Javadoc documents the rules, with spec references.package-info.java: explains the two ways ODFDOM reads in-content metadata (the GRDDL stylesheet on the saved files, or the cache on the DOM), how the cache is kept up to date, and the history of this change.BookmarkRDFMetadataExtractoruses the same code for bookmark metadata.API impact
Unchanged: all methods that return Jena models, i.e.
getRDFMetadata(),getInContentMetadata(),getManifestRDFMetadata(),getInContentMetadataFromCache(),getBookmarkRDFMetadata(),OdfFileDom.getInContentMetadataCache(),OdfFileDom.updateInContentMetadataCache(Node)andBookmarkRDFMetadataExtractor. The GRDDL-basedgetInContentMetadata()/getRDFMetadata()never usedjava-rdfa.Removed: these were public only because
pkg.rdfais an exported package, and nothing else in the repository used them:JenaSink,SAXRDFaParser,DOMRDFaParser,URIExtractor,DOMAttributes,MultiContentHandlerOdfFileDom.getSink(), whose Javadoc said "The end users needn't to care of this method"OdfFileSaxHandler.setSink(JenaSink)Moving off them is simple: read metadata with
OdfFileDom.getInContentMetadataCache(), or withInContentMetadata.addStatements(model, element, text)for a single element.OdfFileDom.getRDFBaseUri()is new and takes the place of whatgetSink()was used for.Note that Jena's
Modeltype is part of the ODFDOM API, so moving to Jena 6 is already a breaking change for users who depend on Jena directly. That makes this release a good point to remove the internal classes too.Behaviour changes
xhtml:propertyand supportxhtml:datatype. Before, a list of properties was expanded as if it were a single CURIE.[_:x]) now also work when the cache is updated after loading. Before, that path would throw aNullPointerException.xml:langis not read, since the ODF schema does not allow it on these elements.Unchanged on purpose: relative IRIs in
xhtml:aboutare still used as they are (the GRDDL stylesheet resolves#idagainst the file's IRI instead).Testing
odfdombuild: 629 tests, 0 failures (21 skipped, already marked@Ignore), plus 2 integration tests.RDFMetadataTest.testGetInContentMetadataFromCachecovers the cache: safe CURIE subjects, several predicates, typed literals,xhtml:contenttaking precedence over the text, updating the text, and removing elements. The previous test for the cache had been commented out.RDFMetadataTest.testRdfXmlRoundTripchecks that RDF/XML reading and writing still works with Jena 6 (needs ARQ).test_rdfmeta.odt: the cache triples are identical. The only difference is the bookmark whitespace trimming described above.Is it worth it?
Yes: