Remove RDF4J from TRS Client and use Lyo Store instead #388
Remove RDF4J from TRS Client and use Lyo Store instead #388berezovskyi merged 31 commits intomasterfrom
Conversation
cc97b19 to
c118195
Compare
|
@Jad-el-khoury I quite forgot about this PR I developed. Maybe you can start with that? |
Signed-off-by: Andrew Berezovskyi <[email protected]>
c118195 to
19abb90
Compare
|
@oslc-bot /test-all |
Signed-off-by: Andrew Berezovskyi <[email protected]>
Signed-off-by: Andrew Berezovskyi <[email protected]>
| } catch (StoreAccessException e) { | ||
| throw new RuntimeException(e); |
There was a problem hiding this comment.
The error handling here wraps StoreAccessException in RuntimeException, which may hide useful error information and make it harder for callers to handle specific SPARQL errors. Consider either propagating the StoreAccessException (by declaring it in the method signature) or logging more context about the failure before wrapping it.
trs/client/trs-client/src/main/java/org/eclipse/lyo/trs/client/util/SparqlUtil.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| /** | ||
| * For a modification event return a sparql update relfecting the change |
There was a problem hiding this comment.
Spelling error: "relfecting" should be "reflecting".
trs/client/trs-client/src/main/java/org/eclipse/lyo/trs/client/util/SparqlUtil.java
Outdated
Show resolved
Hide resolved
trs/client/trs-client/src/main/java/org/eclipse/lyo/trs/client/util/SparqlUtil.java
Outdated
Show resolved
Hide resolved
trs/client/trs-client/src/main/java/org/eclipse/lyo/trs/client/util/SparqlUtil.java
Outdated
Show resolved
Hide resolved
| // TODO: build one or use a pool | ||
| Store store = | ||
| StoreFactory.sparql( | ||
| null, sparqlUpdateService, sparql_baseAuth_userName, sparql_baseAuth_pwd); |
There was a problem hiding this comment.
Creating a new Store instance on every finishCycle call can lead to performance and resource issues. The TODO comment acknowledges this ("build one or use a pool"), but the current implementation will create excessive connections if finishCycle is called frequently. Consider: (1) Reusing a single Store instance as a class field, or (2) Implementing a connection pool, or (3) Using dependency injection to provide the Store instance. This is especially important for high-frequency TRS synchronization scenarios.
| } | ||
|
|
||
| /** | ||
| * For a modification event target return a sparql update relfecting the |
There was a problem hiding this comment.
Spelling error: "relfecting" should be "reflecting".
...ient/src/test/java/org/eclipse/lyo/trs/client/handlers/sparql/SparqlBatchingHandlerTest.java
Show resolved
Hide resolved
| * Create a sparql update ading the triples to the named graph with the | ||
| * specified name and send it to the sparql update endpoint specified using | ||
| * the given repo connection object. Uses the sesame libraries | ||
| * | ||
| * @param conn | ||
| * sesame repo connection object | ||
| * @param triples | ||
| * triples to be added to the named graph | ||
| * @param graphName | ||
| * named graph to which the triples shall be added | ||
| */ | ||
| // public void processTripleAdditionQuery(RepositoryConnection conn, String triples, String | ||
| // graphName) { | ||
| // String addTriplesToGraphQuery = SparqlUtil.addTriplesToGraphQuery(graphName, triples); | ||
| // SparqlUtil.processQuery_sesame(addTriplesToGraphQuery, conn); | ||
| // } | ||
|
|
||
| /** |
There was a problem hiding this comment.
Large blocks of commented-out RDF4J/Sesame code (lines 432-631) should be removed entirely rather than left as comments. Since this is a migration away from RDF4J, keeping this deprecated code in comments reduces code clarity and maintainability. The code history is preserved in version control, so there's no need to keep these comments. This is especially important given that line 472 contains hardcoded credentials.
| * Create a sparql update ading the triples to the named graph with the | |
| * specified name and send it to the sparql update endpoint specified using | |
| * the given repo connection object. Uses the sesame libraries | |
| * | |
| * @param conn | |
| * sesame repo connection object | |
| * @param triples | |
| * triples to be added to the named graph | |
| * @param graphName | |
| * named graph to which the triples shall be added | |
| */ | |
| // public void processTripleAdditionQuery(RepositoryConnection conn, String triples, String | |
| // graphName) { | |
| // String addTriplesToGraphQuery = SparqlUtil.addTriplesToGraphQuery(graphName, triples); | |
| // SparqlUtil.processQuery_sesame(addTriplesToGraphQuery, conn); | |
| // } | |
| /** |
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Andrew Berezovskyi <[email protected]>
Description
Store.rawUpdateQuery()method.Needs testing.
Checklist
Issues
Closes #0; Closes #00
(use exactly this syntax to link to issues, one issue per statement only!)