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.
Hello,
This PR upgrades uses of Apache Jena to 5.3.0 for RDF writing and reading. This resolves #6302.
The main issue is that Jena removed the uses of reader and writer in their read and write methods in version 5, so I modified the utility method to check for StringReader and InputStreamReader on read, and building a OutputStream out of the passed writer. Those readers were the types I could infer that were coming in from HAPI for RDF. Jena only handles a couple types anyway.
Below are the more specific changes I made to accommodate the use of the latest version, as well as removing some unmaintained testing dependencies for RDF.
If there are any adjustments/changes I should make, let me know and I can try to make them. We plan to use HAPI within CMS, where I work, and we'd like to be able to contribute to the code where we can/when needed, such as resolving security issues.
Changes:
-fixes CVE-2024-7254 in dependencies prior to 5.2.0
-hapi-fhir-base: include httpclient dependency which was removed from jena-arq
-hapi-fhir-base RDFParser: init JenaSystem on initialization
-hapi-fhir-base RDFParser: specify signature for null values on methods that are overloaded
-hapi-fhir-base RDFUtil: Jena Riot RDFDataMgr no longer accepts reading and writing into generic reader and writer. Handle reading for StringReader and InputStreamReader. Handle writing by building an output stream from the writer.
-hapi-fhir-structures-r4: Remove shexjava dependency - unmaintained
-hapi-fhir-structures-r4: Use jena-shex for shex validation
-hapi-fhir-structures-r4 RDFParserTest: use jena libraries - compatibile with jena-shex
-hapi-fhir-structures-r4 RDFParserTest: simplify FixedShapeMapEntry by attaching nodes vs recreating them (handles blank nodes)
-hapi-fhir-structures-r4 RDFParserR4Test: jena 5.0.0 defaults to using PREFIX, not @Prefix. Read testing strings and use isomorphic comparison to check for equality. Added extra assertion to test isomorphism check.