From cf8763035a069823c02f2e1caf78424cdbfd5fb9 Mon Sep 17 00:00:00 2001 From: Evgenii Grigorev Date: Mon, 8 Jul 2024 23:59:54 +0200 Subject: [PATCH] [#231] Improve logs readability --- .../cz/cvut/spipes/modules/AbstractModule.java | 2 +- .../cvut/spipes/modules/BindBySelectModule.java | 3 ++- .../main/java/cz/cvut/spipes/util/QueryUtils.java | 15 ++++++++++++++- .../spipes/transform/AnonNodeTransformer.java | 3 ++- .../cz/cvut/spipes/modules/SUTimeModuleNew.java | 2 +- .../modules/ApplyConstructAbstractModule.java | 2 +- ...ithChunkedValuesAndScrollableCursorModule.java | 3 ++- .../ApplyConstructWithChunkedValuesModule.java | 2 +- .../java/cz/cvut/spipes/modules/TarqlModule.java | 3 ++- .../cvut/spipes/modules/TextAnalysisModule.java | 3 ++- 10 files changed, 28 insertions(+), 10 deletions(-) diff --git a/s-pipes-core/src/main/java/cz/cvut/spipes/modules/AbstractModule.java b/s-pipes-core/src/main/java/cz/cvut/spipes/modules/AbstractModule.java index 7c78314b..ef43518e 100644 --- a/s-pipes-core/src/main/java/cz/cvut/spipes/modules/AbstractModule.java +++ b/s-pipes-core/src/main/java/cz/cvut/spipes/modules/AbstractModule.java @@ -257,7 +257,7 @@ private void checkConstraints(Model model, QuerySolution bindings, List String getFromQuery(Resource r, Class resClass) { - Query q = ARQFactory.get().createQuery(r.as(resClass)); + Query q = QueryUtils.createQuery(r.as(resClass)); Model m = r.getModel(); PrefixMapping mapping = new PrefixMappingImpl(); mapping.setNsPrefixes(m.getNsPrefixMap()); diff --git a/s-pipes-modules/module-nlp/src/main/java/cz/cvut/spipes/modules/SUTimeModuleNew.java b/s-pipes-modules/module-nlp/src/main/java/cz/cvut/spipes/modules/SUTimeModuleNew.java index 9d319b5e..605880da 100644 --- a/s-pipes-modules/module-nlp/src/main/java/cz/cvut/spipes/modules/SUTimeModuleNew.java +++ b/s-pipes-modules/module-nlp/src/main/java/cz/cvut/spipes/modules/SUTimeModuleNew.java @@ -131,7 +131,7 @@ public ExecutionContext executeSelf() { String queryStr = spinConstructRes.getProperty(SP.text).getLiteral().getString(); query = QueryFactory.create(substituteQueryMarkers(count, queryStr)); } else { - query = ARQFactory.get().createQuery(spinConstructRes); + query = QueryUtils.createQuery(spinConstructRes); } Model queriedModel = QueryUtils.execConstruct( diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructAbstractModule.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructAbstractModule.java index 291fa30e..0f20bd16 100644 --- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructAbstractModule.java +++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructAbstractModule.java @@ -148,7 +148,7 @@ public ExecutionContext executeSelf() { String queryStr = spinConstructRes.getProperty(SP.text).getLiteral().getString(); query = QueryFactory.create(substituteQueryMarkers(count, queryStr)); } else { - query = ARQFactory.get().createQuery(spinConstructRes); + query = QueryUtils.createQuery(spinConstructRes); } Model constructedModel = QueryUtils.execConstruct( diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithChunkedValuesAndScrollableCursorModule.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithChunkedValuesAndScrollableCursorModule.java index 7caa8604..09f92abb 100644 --- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithChunkedValuesAndScrollableCursorModule.java +++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithChunkedValuesAndScrollableCursorModule.java @@ -8,6 +8,7 @@ import cz.cvut.spipes.recursion.CombinedQueryTemplateRecursionProvider; import cz.cvut.spipes.recursion.QueryTemplateRecursionProvider; import cz.cvut.spipes.recursion.ScrollableCursorProvider; +import cz.cvut.spipes.util.QueryUtils; import org.apache.jena.query.Query; import org.apache.jena.query.QueryExecution; import org.apache.jena.query.QueryExecutionFactory; @@ -74,7 +75,7 @@ public void setSelectQuery(Select selectQuery) { } private ResultSet getSelectQueryResultSet() { - Query query = ARQFactory.get().createQuery(selectQuery); + Query query = QueryUtils.createQuery(selectQuery); QuerySolution inputBindings = executionContext.getVariablesBinding().asQuerySolution(); diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithChunkedValuesModule.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithChunkedValuesModule.java index 98ce7e82..d505afad 100644 --- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithChunkedValuesModule.java +++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithChunkedValuesModule.java @@ -66,7 +66,7 @@ public void setSelectQuery(Select selectQuery) { } public void initializeQuery() { - Query query = ARQFactory.get().createQuery(selectQuery); + Query query = QueryUtils.createQuery(selectQuery); QuerySolution inputBindings = executionContext.getVariablesBinding().asQuerySolution(); diff --git a/s-pipes-modules/module-tarql/src/main/java/cz/cvut/spipes/modules/TarqlModule.java b/s-pipes-modules/module-tarql/src/main/java/cz/cvut/spipes/modules/TarqlModule.java index a5881869..265a794b 100644 --- a/s-pipes-modules/module-tarql/src/main/java/cz/cvut/spipes/modules/TarqlModule.java +++ b/s-pipes-modules/module-tarql/src/main/java/cz/cvut/spipes/modules/TarqlModule.java @@ -8,6 +8,7 @@ import cz.cvut.spipes.modules.annotations.SPipesModule; import cz.cvut.spipes.registry.StreamResource; import cz.cvut.spipes.registry.StreamResourceRegistry; +import cz.cvut.spipes.util.QueryUtils; import org.apache.jena.ext.com.google.common.io.Files; import org.apache.jena.query.Query; import org.apache.jena.rdf.model.Model; @@ -102,7 +103,7 @@ public ExecutionContext executeSelf() { for (Resource constructQueryRes : constructQueries) { Construct spinConstructRes = constructQueryRes.as(Construct.class); - Query query = ARQFactory.get().createQuery(spinConstructRes); + Query query = QueryUtils.createQuery(spinConstructRes); try { // save string query to temporary file diff --git a/s-pipes-modules/module-text-analysis/src/main/java/cz/cvut/spipes/modules/TextAnalysisModule.java b/s-pipes-modules/module-text-analysis/src/main/java/cz/cvut/spipes/modules/TextAnalysisModule.java index 534d93a4..1f75e11e 100644 --- a/s-pipes-modules/module-text-analysis/src/main/java/cz/cvut/spipes/modules/TextAnalysisModule.java +++ b/s-pipes-modules/module-text-analysis/src/main/java/cz/cvut/spipes/modules/TextAnalysisModule.java @@ -5,6 +5,7 @@ import cz.cvut.spipes.engine.ExecutionContext; import cz.cvut.spipes.modules.annotations.SPipesModule; import cz.cvut.spipes.modules.constants.Termit; +import cz.cvut.spipes.util.QueryUtils; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; @@ -91,7 +92,7 @@ ExecutionContext executeSelf() { return executionContext; } - Query query = ARQFactory.get().createQuery(selectQuery); + Query query = QueryUtils.createQuery(selectQuery); try (QueryExecution queryExecution = QueryExecutionFactory.create(query, inputModel)) { ResultSet resultSet = queryExecution.execSelect(); List listOfObjects = new ArrayList<>();