An "epic" refactoring changing how RDF is read on the back end. The current approach has two fundamental deficiencies:
a new RDF4J repository connection is opened for every read operation, no matter how small; this results in ~100 connection opening/closures to read a DataObject instance. Additionally, many read operations produce a ClosableIterator that keeps the connection open, and close it when fully consumed or explicitly closed. As a result, there is high risk of writing code prone to connection leaks, and this has caused a serious malfunction in production.
validation of property cardinalities is done in an unforgiving manner, by throwing an exception. This has benefits of discovering metadata problems quickly, but makes the services unnecessarily fragile.
This PR makes several types of improvements:
introduces TriplestoreConnection that will handle most read operations instead of InstanceServer, who is now used to provide the connection for safe "open connection -> complex read -> close connection" operations.
introduces a concept of RdfLens allowing to focus TriplestoreConnection on different RDF graphs without the need of creating a different RDF4J connection, or using a different InstanceServer.
uses Scala 3 opaque types to add type safety with various flavours of TriplestoreConnection (depending on what RDF graphs they can "see")
uses Validated datatype to wrap all RDF property cardinality validations instead of throwing exceptions. This allows retaining error information while still producing usable output. The errors are then displayed as warnings on the landing pages (to begin with).
changes all the RDF reading code accordingly to the changes listed above
improves "plumbing" of various components, reducing needless object creations; uses "vanilla" (without SPARQL "magic") triplestore when "magic" is not needed.
An "epic" refactoring changing how RDF is read on the back end. The current approach has two fundamental deficiencies:
DataObject
instance. Additionally, many read operations produce aClosableIterator
that keeps the connection open, and close it when fully consumed or explicitly closed. As a result, there is high risk of writing code prone to connection leaks, and this has caused a serious malfunction in production.This PR makes several types of improvements:
TriplestoreConnection
that will handle most read operations instead ofInstanceServer
, who is now used to provide the connection for safe "open connection -> complex read -> close connection" operations.RdfLens
allowing to focusTriplestoreConnection
on different RDF graphs without the need of creating a different RDF4J connection, or using a differentInstanceServer
.TriplestoreConnection
(depending on what RDF graphs they can "see")Validated
datatype to wrap all RDF property cardinality validations instead of throwing exceptions. This allows retaining error information while still producing usable output. The errors are then displayed as warnings on the landing pages (to begin with).