From 87b657c2cf5077a55e5afbd89a107f9a5b4c4ae6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Mar 2023 21:15:43 +0000 Subject: [PATCH 01/29] build(deps): bump webpack in /qanary-configuration-frontend Bumps [webpack](https://github.com/webpack/webpack) from 5.69.0 to 5.76.1. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.69.0...v5.76.1) --- updated-dependencies: - dependency-name: webpack dependency-type: indirect ... Signed-off-by: dependabot[bot] --- .../package-lock.json | 77 ++++++++----------- 1 file changed, 34 insertions(+), 43 deletions(-) diff --git a/qanary-configuration-frontend/package-lock.json b/qanary-configuration-frontend/package-lock.json index 29dfc1d8..42d6b9cd 100644 --- a/qanary-configuration-frontend/package-lock.json +++ b/qanary-configuration-frontend/package-lock.json @@ -8,6 +8,7 @@ "name": "qanary-configuration-frontend", "version": "1.0.3", "dependencies": { + "@babel/core": "7.20.12", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^12.1.2", "@testing-library/user-event": "^7.2.1", @@ -17,7 +18,7 @@ "react-scripts": "^5.0.1" }, "devDependencies": { - "@babel/core": "^7.20.12", + "@babel/core": "7.20.12", "axios": "^0.21.2" } }, @@ -4106,9 +4107,9 @@ } }, "node_modules/acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", "bin": { "acorn": "bin/acorn" }, @@ -6426,9 +6427,9 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.0.tgz", - "integrity": "sha512-weDYmzbBygL7HzGGS26M3hGQx68vehdEg6VUmqSOaFzXExFqlnKuSvsEJCVGQHScS8CQMbrAqftT+AzzHNt/YA==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz", + "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==", "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -10997,11 +10998,6 @@ "node": ">=4" } }, - "node_modules/json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" - }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -15628,9 +15624,9 @@ } }, "node_modules/watchpack": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz", - "integrity": "sha512-x0t0JuydIo8qCNctdDrn1OzH/qDzk2+rdCOC3YzumZ42fiMqmQ7T3xQurykYMhYfHaPHTp4ZxAx2NfUo1K6QaA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", "dependencies": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" @@ -15656,33 +15652,33 @@ } }, "node_modules/webpack": { - "version": "5.69.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.69.0.tgz", - "integrity": "sha512-E5Fqu89Gu8fR6vejRqu26h8ld/k6/dCVbeGUcuZjc+goQHDfCPU9rER71JmdtBYGmci7Ec2aFEATQ2IVXKy2wg==", + "version": "5.76.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.1.tgz", + "integrity": "sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==", "dependencies": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^0.0.51", "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/wasm-edit": "1.11.1", "@webassemblyjs/wasm-parser": "1.11.1", - "acorn": "^8.4.1", + "acorn": "^8.7.1", "acorn-import-assertions": "^1.7.6", "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.9.0", + "enhanced-resolve": "^5.10.0", "es-module-lexer": "^0.9.0", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.2.9", - "json-parse-better-errors": "^1.0.2", + "json-parse-even-better-errors": "^2.3.1", "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", "schema-utils": "^3.1.0", "tapable": "^2.1.1", "terser-webpack-plugin": "^5.1.3", - "watchpack": "^2.3.1", + "watchpack": "^2.4.0", "webpack-sources": "^3.2.3" }, "bin": { @@ -19446,9 +19442,9 @@ } }, "acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==" + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==" }, "acorn-globals": { "version": "6.0.0", @@ -21148,9 +21144,9 @@ "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" }, "enhanced-resolve": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.0.tgz", - "integrity": "sha512-weDYmzbBygL7HzGGS26M3hGQx68vehdEg6VUmqSOaFzXExFqlnKuSvsEJCVGQHScS8CQMbrAqftT+AzzHNt/YA==", + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz", + "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==", "requires": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -24399,11 +24395,6 @@ "jsesc": { "version": "2.5.2" }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" - }, "json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -27633,9 +27624,9 @@ } }, "watchpack": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz", - "integrity": "sha512-x0t0JuydIo8qCNctdDrn1OzH/qDzk2+rdCOC3YzumZ42fiMqmQ7T3xQurykYMhYfHaPHTp4ZxAx2NfUo1K6QaA==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", "requires": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" @@ -27655,33 +27646,33 @@ "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==" }, "webpack": { - "version": "5.69.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.69.0.tgz", - "integrity": "sha512-E5Fqu89Gu8fR6vejRqu26h8ld/k6/dCVbeGUcuZjc+goQHDfCPU9rER71JmdtBYGmci7Ec2aFEATQ2IVXKy2wg==", + "version": "5.76.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.1.tgz", + "integrity": "sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==", "requires": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^0.0.51", "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/wasm-edit": "1.11.1", "@webassemblyjs/wasm-parser": "1.11.1", - "acorn": "^8.4.1", + "acorn": "^8.7.1", "acorn-import-assertions": "^1.7.6", "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.9.0", + "enhanced-resolve": "^5.10.0", "es-module-lexer": "^0.9.0", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.2.9", - "json-parse-better-errors": "^1.0.2", + "json-parse-even-better-errors": "^2.3.1", "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", "schema-utils": "^3.1.0", "tapable": "^2.1.1", "terser-webpack-plugin": "^5.1.3", - "watchpack": "^2.3.1", + "watchpack": "^2.4.0", "webpack-sources": "^3.2.3" }, "dependencies": { From 2d3c758968ad4515252e15486517b9e6339bc205 Mon Sep 17 00:00:00 2001 From: heinpa Date: Tue, 4 Apr 2023 16:51:36 +0200 Subject: [PATCH 02/29] reactivate Qanary pipeline gerbil-execute endpoint --- qanary_commons/pom.xml | 4 ++-- .../eu/wdaqua/qanary/commons/QanaryQuestion.java | 12 +++++++----- qanary_pipeline-template/pom.xml | 2 +- .../eu/wdaqua/qanary/web/QanaryGerbilController.java | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/qanary_commons/pom.xml b/qanary_commons/pom.xml index 3b74371d..96de99f0 100644 --- a/qanary_commons/pom.xml +++ b/qanary_commons/pom.xml @@ -2,7 +2,7 @@ 4.0.0 eu.wdaqua.qanary qa.commons - 3.7.1 + 3.8.0 org.springframework.boot spring-boot-starter-parent @@ -299,4 +299,4 @@ - \ No newline at end of file + diff --git a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java index 76945ddf..dfe1d5f7 100644 --- a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java +++ b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java @@ -603,21 +603,23 @@ public String getJsonResult() throws SparqlQueryFailed { + " ?a a qa:AnnotationOfAnswerJson . " // + " ?a oa:hasBody ?answer . " // + " ?answer rdf:value ?json . " // -// + " ?a a qa:AnnotationOfAnswerJSON . " // -// + " ?a oa:hasBody ?json " // -// TODO: this should be body of AnswerJson with rdf:value answer + "}"; logger.debug("getJsonResult: SELECT using:\n{}", sparql); ResultSet resultset = this.getQanaryTripleStoreConnector().select(sparql); - // the default value has to be null to distinguish missing values from empty values + // OLD: the default value has to be null to distinguish missing values from empty values + // NEW: returning null would result in "null" being part of the response JSON, + // return an empty string instead. + // This way, a distinction is still possible: + // missing values: "" + // empty values: [] String sparqlAnnotation = null; while (resultset.hasNext()) { sparqlAnnotation = resultset.next().get("json").asLiteral().toString(); } if (sparqlAnnotation == null) { - return sparqlAnnotation; + return ""; } else { return sparqlAnnotation.replace("\\\"", "\""); } diff --git a/qanary_pipeline-template/pom.xml b/qanary_pipeline-template/pom.xml index 3f7e81f1..cbe7a112 100644 --- a/qanary_pipeline-template/pom.xml +++ b/qanary_pipeline-template/pom.xml @@ -5,7 +5,7 @@ 4.0.0 qa.pipeline eu.wdaqua.qanary - 3.7.3 + 3.8.0 org.springframework.boot spring-boot-starter-parent diff --git a/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/QanaryGerbilController.java b/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/QanaryGerbilController.java index 08e7a145..fe1b70a9 100644 --- a/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/QanaryGerbilController.java +++ b/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/QanaryGerbilController.java @@ -198,7 +198,7 @@ public ResponseEntity gerbil( } String questionText = myQanaryQuestion.getTextualRepresentation(); String sparqlQueryString = myQanaryQuestion.getSparqlResult(); // returns empty String if no Query was found - String jsonAnswerString = "{}"; // TODO: myQanaryQuestion.getJsonResult(); // returns empty String if no answer was found + String jsonAnswerString = myQanaryQuestion.getJsonResult(); GerbilExecuteResponse obj = new GerbilExecuteResponse(Jackson2ObjectMapperBuilder.json().build(), // questionText, language, sparqlQueryString, jsonAnswerString); From f433f1198664800a09625eae9b6e64228f8219b5 Mon Sep 17 00:00:00 2001 From: heinpa Date: Tue, 9 May 2023 20:12:57 +0200 Subject: [PATCH 03/29] catch NullPointerException for no response --- .../java/eu/wdaqua/qanary/commons/QanaryQuestion.java | 4 ++-- .../wdaqua/qanary/web/messages/GerbilExecuteResponse.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java index dfe1d5f7..fedd8a20 100644 --- a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java +++ b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java @@ -582,11 +582,11 @@ public class SparqlAnnotation { } public String getSparqlResult() throws SparqlQueryFailed { - // added try and catch to prevent indexOutOfBoundsException, returns empty String if no Query was found + // added try and catch to prevent indexOutOfBoundsException and NullPointerException, returns empty String if no Query was found String sparqlResult = ""; try { sparqlResult = this.getSparqlResults().get(0).query; - } catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException | NullPointerException e) { logger.warn("No SPARQL Query found, index out of bounds"); } return sparqlResult; diff --git a/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/messages/GerbilExecuteResponse.java b/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/messages/GerbilExecuteResponse.java index a6af1481..e9785cb7 100644 --- a/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/messages/GerbilExecuteResponse.java +++ b/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/messages/GerbilExecuteResponse.java @@ -88,12 +88,12 @@ public GerbilExecuteResponse(ObjectMapper objectMapper, String questionText, Str QueryObj queryObj = new QueryObj(sparqlQueryString); - JsonNode answersObj2 = null; + List answersArray = new LinkedList<>(); + //JsonNode answersObj2 = null; if (jsonAnswerString != null && jsonAnswerString.length() > 0) { - answersObj2 = objectMapper.readTree(jsonAnswerString); + JsonNode answersObj2 = objectMapper.readTree(jsonAnswerString); + answersArray.add(answersObj2); } - List answersArray = new LinkedList<>(); - answersArray.add(answersObj2); LinkedList questionsArray = new LinkedList<>(); Question question = new Question(queryObj, answersArray, questionDataArray); From ebff63b3d08765480da5cb50510a735f4138edeb Mon Sep 17 00:00:00 2001 From: Calvin Date: Sun, 4 Jun 2023 21:05:36 +0200 Subject: [PATCH 04/29] qa.commons 3.7.2 add CacheTest as static function --- qanary_commons/pom.xml | 2 +- .../qanary/commons/config/CacheConfig.java | 92 ++++++++++++++++++- 2 files changed, 92 insertions(+), 2 deletions(-) diff --git a/qanary_commons/pom.xml b/qanary_commons/pom.xml index 3b74371d..d12c48e3 100644 --- a/qanary_commons/pom.xml +++ b/qanary_commons/pom.xml @@ -2,7 +2,7 @@ 4.0.0 eu.wdaqua.qanary qa.commons - 3.7.1 + 3.7.2 org.springframework.boot spring-boot-starter-parent diff --git a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/config/CacheConfig.java b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/config/CacheConfig.java index 6d0ad6e9..30b8559e 100644 --- a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/config/CacheConfig.java +++ b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/config/CacheConfig.java @@ -1,5 +1,8 @@ package eu.wdaqua.qanary.commons.config; +import eu.wdaqua.qanary.communications.CacheOfRestTemplateResponse; +import eu.wdaqua.qanary.communications.RestTemplateWithCaching; +import org.apache.commons.cli.MissingArgumentException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -10,6 +13,12 @@ import org.springframework.context.annotation.Configuration; import com.github.benmanes.caffeine.cache.Caffeine; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.concurrent.TimeUnit; /** * this component configures Caffeine the cache used by the component @@ -35,7 +44,7 @@ public class CacheConfig { public static final String CACHENAME = "qanary.webservicecalls.cache"; - Logger logger = LoggerFactory.getLogger(CacheConfig.class); + private static final Logger logger = LoggerFactory.getLogger(CacheConfig.class); @Bean public Caffeine caffeineConfig() { @@ -56,4 +65,85 @@ public CacheManager cacheManager(Caffeine caffeine, return caffeineCacheManager; } + public static void testCache( + RestTemplateWithCaching myRestTemplate, + CacheOfRestTemplateResponse myCacheOfResponse, + int testPort, + long maxTimeSpanSeconds + ) throws MissingArgumentException, RuntimeException, URISyntaxException, InterruptedException { + + + if (myRestTemplate == null) { + throw new MissingArgumentException("myRestTemplate is null"); + } + if (myCacheOfResponse == null) { + throw new MissingArgumentException("myCacheOfResponse is null"); + } + + URI testServiceURL0 = new URI("http://localhost:" + testPort + "/"); + URI testServiceURL1 = new URI("http://localhost:" + testPort + "/component-description"); + + long initialNumberOfRequests = myCacheOfResponse.getNumberOfExecutedRequests(); + + callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.NOT_CACHED); // cache miss + callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.CACHED); // cache hit + callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.CACHED); // cache hit + TimeUnit.SECONDS.sleep(maxTimeSpanSeconds + 5); // wait until it is too late for caching + callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.NOT_CACHED); // cache miss: too long ago + callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.CACHED); // cache hit + callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL1, Cache.NOT_CACHED); // cache miss: different URI + callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.CACHED); // cache hit + callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL1, Cache.CACHED); // cache hit + + if (initialNumberOfRequests + 3 != myCacheOfResponse.getNumberOfExecutedRequests()) { + logger.error("Cache is not working as expected, number of executed requests should be {}: {}", initialNumberOfRequests + 3, myCacheOfResponse.getNumberOfExecutedRequests()); + + long num = initialNumberOfRequests + 3; + throw new RuntimeException("number of executed requests should be " + num + ": " + myCacheOfResponse.getNumberOfExecutedRequests()); + } + } + + /** + * @param uri + * @param cacheStatus + * @throws URISyntaxException + */ + private static void callRestTemplateWithCaching( + RestTemplateWithCaching myRestTemplate, + CacheOfRestTemplateResponse myCacheOfResponse, + URI uri, + Cache cacheStatus + ) throws RuntimeException { + long numberOfNewlyExecutedRequests = myCacheOfResponse.getNumberOfExecutedRequests(); + ResponseEntity responseEntity = myRestTemplate.getForEntity(uri, String.class); + numberOfNewlyExecutedRequests = myCacheOfResponse.getNumberOfExecutedRequests() - numberOfNewlyExecutedRequests; + logger.info("numberOfExecutedRequest since last request: new={}, count={}, teststatus={}", // + numberOfNewlyExecutedRequests, myCacheOfResponse.getNumberOfExecutedRequests(), cacheStatus); + + if (!HttpStatus.OK.equals(responseEntity.getStatusCode())) { + throw new RuntimeException("HTTP status code is not OK: " + responseEntity.getStatusCode()); + } + + switch (cacheStatus) { + case NOT_CACHED: + if (1 != numberOfNewlyExecutedRequests) { + logger.error("Cache is not working as expected, number of newly executed requests should be 1: {}", numberOfNewlyExecutedRequests); + throw new RuntimeException("Number of newly executed requests should be 1: " + numberOfNewlyExecutedRequests); + } + break; + case CACHED: + if (0 != numberOfNewlyExecutedRequests) { + logger.error("Cache is not working as expected, number of newly executed requests should be 0: {}", numberOfNewlyExecutedRequests); + throw new RuntimeException("Number of newly executed requests should be 0: " + numberOfNewlyExecutedRequests); + } + break; + default: + throw new RuntimeException("Test case misconfigured"); + } + } + + private enum Cache { + CACHED, NOT_CACHED + } + } \ No newline at end of file From 8bd30bfbd8f9d727ee2b55d38dbd0fd4adec4074 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Mon, 3 Jul 2023 19:09:01 +0000 Subject: [PATCH 05/29] fix: upgrade de.codecentric:spring-boot-admin-starter-client from 2.6.7 to 2.7.10 Snyk has created this PR to upgrade de.codecentric:spring-boot-admin-starter-client from 2.6.7 to 2.7.10. See this package in Maven Repository: https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-starter-client/ See this project in Snyk: https://app.snyk.io/org/anbo-de/project/fa2494f3-77ea-4f01-adf8-9cae41ab9a6c?utm_source=github&utm_medium=referral&page=upgrade-pr --- qanary_component-template/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qanary_component-template/pom.xml b/qanary_component-template/pom.xml index 4e85b1f5..6c584b32 100644 --- a/qanary_component-template/pom.xml +++ b/qanary_component-template/pom.xml @@ -14,7 +14,7 @@ 11 - 2.6.7 + 2.7.10 From 6ef65186b84b24c13e9fd33758a7f890d20bec76 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Mon, 3 Jul 2023 19:41:13 +0000 Subject: [PATCH 06/29] fix: upgrade org.glassfish.jaxb:jaxb-runtime from 4.0.0 to 4.0.2 Snyk has created this PR to upgrade org.glassfish.jaxb:jaxb-runtime from 4.0.0 to 4.0.2. See this package in Maven Repository: https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime/ See this project in Snyk: https://app.snyk.io/org/anbo-de/project/058df90d-5302-40f9-adb6-ef041cb23519?utm_source=github&utm_medium=referral&page=upgrade-pr --- qanary_commons/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qanary_commons/pom.xml b/qanary_commons/pom.xml index 500f350b..aa050def 100644 --- a/qanary_commons/pom.xml +++ b/qanary_commons/pom.xml @@ -248,7 +248,7 @@ org.glassfish.jaxb jaxb-runtime - 4.0.0 + 4.0.2 jakarta.xml.bind From b7933b1c0fae975ae9a15e4b7c6f6184498678af Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Mon, 3 Jul 2023 19:41:19 +0000 Subject: [PATCH 07/29] fix: upgrade com.google.code.gson:gson from 2.10 to 2.10.1 Snyk has created this PR to upgrade com.google.code.gson:gson from 2.10 to 2.10.1. See this package in Maven Repository: https://mvnrepository.com/artifact/com.google.code.gson/gson/ See this project in Snyk: https://app.snyk.io/org/anbo-de/project/058df90d-5302-40f9-adb6-ef041cb23519?utm_source=github&utm_medium=referral&page=upgrade-pr --- qanary_commons/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qanary_commons/pom.xml b/qanary_commons/pom.xml index 500f350b..01a7b0a0 100644 --- a/qanary_commons/pom.xml +++ b/qanary_commons/pom.xml @@ -242,7 +242,7 @@ com.google.code.gson gson - 2.10 + 2.10.1 compile From 33f36c2ae57e9263fdc8255d6b2acbb06c8cc8dd Mon Sep 17 00:00:00 2001 From: Oliver Schmidtke <78377118+MindMaster98@users.noreply.github.com> Date: Tue, 11 Jul 2023 14:44:43 +0200 Subject: [PATCH 08/29] Update docker-deployment.yml --- .github/workflows/docker-deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-deployment.yml b/.github/workflows/docker-deployment.yml index b688de41..c68a72d9 100644 --- a/.github/workflows/docker-deployment.yml +++ b/.github/workflows/docker-deployment.yml @@ -19,7 +19,7 @@ jobs: - name: Build the Docker images and Push to Dockerhub run: bash -c ./service_config/build_images.sh - name: Init update - uses: MindMaster98/docker-service-updater@v0.1.5 + uses: WSE-research/docker-service-updater@v0.2.1 with: api_key: ${{ secrets.API_KEY }} updater_host: ${{ secrets.UPDATER_HOST }} From 88c3ac461454dd375c7a17fd4712a836a714df49 Mon Sep 17 00:00:00 2001 From: Oliver Schmidtke <78377118+MindMaster98@users.noreply.github.com> Date: Tue, 11 Jul 2023 14:46:03 +0200 Subject: [PATCH 09/29] Dependabot integration --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..44d89841 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" From a4461153412a565f937e15cb32b875fed74f455a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jul 2023 06:39:48 +0000 Subject: [PATCH 10/29] build(deps): bump word-wrap in /qanary-configuration-frontend Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4. - [Release notes](https://github.com/jonschlinkert/word-wrap/releases) - [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4) --- updated-dependencies: - dependency-name: word-wrap dependency-type: indirect ... Signed-off-by: dependabot[bot] --- qanary-configuration-frontend/package-lock.json | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/qanary-configuration-frontend/package-lock.json b/qanary-configuration-frontend/package-lock.json index 29dfc1d8..1d093439 100644 --- a/qanary-configuration-frontend/package-lock.json +++ b/qanary-configuration-frontend/package-lock.json @@ -8,6 +8,7 @@ "name": "qanary-configuration-frontend", "version": "1.0.3", "dependencies": { + "@babel/core": "7.20.12", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^12.1.2", "@testing-library/user-event": "^7.2.1", @@ -17,7 +18,7 @@ "react-scripts": "^5.0.1" }, "devDependencies": { - "@babel/core": "^7.20.12", + "@babel/core": "7.20.12", "axios": "^0.21.2" } }, @@ -16106,9 +16107,9 @@ } }, "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz", + "integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==", "engines": { "node": ">=0.10.0" } @@ -27971,9 +27972,9 @@ } }, "word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.4.tgz", + "integrity": "sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA==" }, "workbox-background-sync": { "version": "6.4.2", From af439b9bf521304596e00eaa4339c3b2ed64adae Mon Sep 17 00:00:00 2001 From: Calvin Date: Tue, 25 Jul 2023 13:22:19 +0200 Subject: [PATCH 11/29] Revert "qa.commons 3.7.2" This reverts commit ebff63b3d08765480da5cb50510a735f4138edeb. --- qanary_commons/pom.xml | 2 +- .../qanary/commons/config/CacheConfig.java | 92 +------------------ 2 files changed, 2 insertions(+), 92 deletions(-) diff --git a/qanary_commons/pom.xml b/qanary_commons/pom.xml index d12c48e3..3b74371d 100644 --- a/qanary_commons/pom.xml +++ b/qanary_commons/pom.xml @@ -2,7 +2,7 @@ 4.0.0 eu.wdaqua.qanary qa.commons - 3.7.2 + 3.7.1 org.springframework.boot spring-boot-starter-parent diff --git a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/config/CacheConfig.java b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/config/CacheConfig.java index 30b8559e..6d0ad6e9 100644 --- a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/config/CacheConfig.java +++ b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/config/CacheConfig.java @@ -1,8 +1,5 @@ package eu.wdaqua.qanary.commons.config; -import eu.wdaqua.qanary.communications.CacheOfRestTemplateResponse; -import eu.wdaqua.qanary.communications.RestTemplateWithCaching; -import org.apache.commons.cli.MissingArgumentException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -13,12 +10,6 @@ import org.springframework.context.annotation.Configuration; import com.github.benmanes.caffeine.cache.Caffeine; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.concurrent.TimeUnit; /** * this component configures Caffeine the cache used by the component @@ -44,7 +35,7 @@ public class CacheConfig { public static final String CACHENAME = "qanary.webservicecalls.cache"; - private static final Logger logger = LoggerFactory.getLogger(CacheConfig.class); + Logger logger = LoggerFactory.getLogger(CacheConfig.class); @Bean public Caffeine caffeineConfig() { @@ -65,85 +56,4 @@ public CacheManager cacheManager(Caffeine caffeine, return caffeineCacheManager; } - public static void testCache( - RestTemplateWithCaching myRestTemplate, - CacheOfRestTemplateResponse myCacheOfResponse, - int testPort, - long maxTimeSpanSeconds - ) throws MissingArgumentException, RuntimeException, URISyntaxException, InterruptedException { - - - if (myRestTemplate == null) { - throw new MissingArgumentException("myRestTemplate is null"); - } - if (myCacheOfResponse == null) { - throw new MissingArgumentException("myCacheOfResponse is null"); - } - - URI testServiceURL0 = new URI("http://localhost:" + testPort + "/"); - URI testServiceURL1 = new URI("http://localhost:" + testPort + "/component-description"); - - long initialNumberOfRequests = myCacheOfResponse.getNumberOfExecutedRequests(); - - callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.NOT_CACHED); // cache miss - callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.CACHED); // cache hit - callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.CACHED); // cache hit - TimeUnit.SECONDS.sleep(maxTimeSpanSeconds + 5); // wait until it is too late for caching - callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.NOT_CACHED); // cache miss: too long ago - callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.CACHED); // cache hit - callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL1, Cache.NOT_CACHED); // cache miss: different URI - callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL0, Cache.CACHED); // cache hit - callRestTemplateWithCaching(myRestTemplate, myCacheOfResponse, testServiceURL1, Cache.CACHED); // cache hit - - if (initialNumberOfRequests + 3 != myCacheOfResponse.getNumberOfExecutedRequests()) { - logger.error("Cache is not working as expected, number of executed requests should be {}: {}", initialNumberOfRequests + 3, myCacheOfResponse.getNumberOfExecutedRequests()); - - long num = initialNumberOfRequests + 3; - throw new RuntimeException("number of executed requests should be " + num + ": " + myCacheOfResponse.getNumberOfExecutedRequests()); - } - } - - /** - * @param uri - * @param cacheStatus - * @throws URISyntaxException - */ - private static void callRestTemplateWithCaching( - RestTemplateWithCaching myRestTemplate, - CacheOfRestTemplateResponse myCacheOfResponse, - URI uri, - Cache cacheStatus - ) throws RuntimeException { - long numberOfNewlyExecutedRequests = myCacheOfResponse.getNumberOfExecutedRequests(); - ResponseEntity responseEntity = myRestTemplate.getForEntity(uri, String.class); - numberOfNewlyExecutedRequests = myCacheOfResponse.getNumberOfExecutedRequests() - numberOfNewlyExecutedRequests; - logger.info("numberOfExecutedRequest since last request: new={}, count={}, teststatus={}", // - numberOfNewlyExecutedRequests, myCacheOfResponse.getNumberOfExecutedRequests(), cacheStatus); - - if (!HttpStatus.OK.equals(responseEntity.getStatusCode())) { - throw new RuntimeException("HTTP status code is not OK: " + responseEntity.getStatusCode()); - } - - switch (cacheStatus) { - case NOT_CACHED: - if (1 != numberOfNewlyExecutedRequests) { - logger.error("Cache is not working as expected, number of newly executed requests should be 1: {}", numberOfNewlyExecutedRequests); - throw new RuntimeException("Number of newly executed requests should be 1: " + numberOfNewlyExecutedRequests); - } - break; - case CACHED: - if (0 != numberOfNewlyExecutedRequests) { - logger.error("Cache is not working as expected, number of newly executed requests should be 0: {}", numberOfNewlyExecutedRequests); - throw new RuntimeException("Number of newly executed requests should be 0: " + numberOfNewlyExecutedRequests); - } - break; - default: - throw new RuntimeException("Test case misconfigured"); - } - } - - private enum Cache { - CACHED, NOT_CACHED - } - } \ No newline at end of file From a911d7d157eecadcda326ff9f3f265b5934ff40a Mon Sep 17 00:00:00 2001 From: heinpa Date: Tue, 18 Jul 2023 21:15:24 +0200 Subject: [PATCH 12/29] add getTextualRepresentation with language param --- qanary_commons/pom.xml | 2 +- .../wdaqua/qanary/commons/QanaryQuestion.java | 80 ++++++++++++++----- ...ect_all_AnnotationOfQuestionTranslation.rq | 11 +++ .../select_uri_textual_representation.rq | 9 +++ 4 files changed, 81 insertions(+), 21 deletions(-) create mode 100644 qanary_commons/src/main/resources/queries/select_all_AnnotationOfQuestionTranslation.rq create mode 100644 qanary_commons/src/main/resources/queries/select_uri_textual_representation.rq diff --git a/qanary_commons/pom.xml b/qanary_commons/pom.xml index 500f350b..8028c4a7 100644 --- a/qanary_commons/pom.xml +++ b/qanary_commons/pom.xml @@ -2,7 +2,7 @@ 4.0.0 eu.wdaqua.qanary qa.commons - 3.7.5 + 3.8.0 org.springframework.boot spring-boot-starter-parent diff --git a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java index 76945ddf..b5694bae 100644 --- a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java +++ b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java @@ -9,11 +9,12 @@ import org.apache.jena.atlas.json.JSON; import org.apache.jena.atlas.json.JsonObject; import org.apache.jena.query.QuerySolution; +import org.apache.jena.query.QuerySolutionMap; import org.apache.jena.query.ResultSet; +import org.apache.jena.rdf.model.ResourceFactory; import org.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.ResponseEntity; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; @@ -40,7 +41,7 @@ public class QanaryQuestion { private static final Logger logger = LoggerFactory.getLogger(QanaryQuestion.class); private QanaryMessage qanaryMessage; - private QanaryUtils qanaryUtil; + private QanaryUtils qanaryUtils; private T raw; // note: uri not final due to different sources for the value (some from // triplestore, some pre-set) @@ -54,6 +55,9 @@ public class QanaryQuestion { private QanaryConfigurator myQanaryConfigurator; + private String FILENAME_SELECT_TRANSLATION_ANNOTATION = "/queries/select_all_AnnotationOfQuestionTranslation.rq"; + private String FILENAME_SELECT_URI_TEXTUAL_REPRESENTATION = "/queries/select_uri_textual_representation.rq"; + /** * init the graph in the triplestore (c.f., application.properties), a new graph * is constructed @@ -169,7 +173,7 @@ public QanaryQuestion(QanaryMessage qanaryMessage, final QanaryConfigurator myQa public QanaryQuestion(QanaryMessage qanaryMessage, final QanaryTripleStoreConnector myQanaryTripleStoreConnector) { this.qanaryMessage = qanaryMessage; this.myQanaryTripleStoreConnector = myQanaryTripleStoreConnector; - this.qanaryUtil = new QanaryUtils(qanaryMessage, myQanaryTripleStoreConnector); + this.qanaryUtils = new QanaryUtils(qanaryMessage, myQanaryTripleStoreConnector); // save where the answer is stored this.namedGraph = qanaryMessage.getInGraph(); } @@ -201,7 +205,7 @@ public QanaryTripleStoreConnector getQanaryTripleStoreConnector() { */ private void initFromTriplestore(final QanaryConfigurator myQanaryConfigurator) throws URISyntaxException { this.qanaryMessage = new QanaryMessage(myQanaryConfigurator.getEndpoint(), namedGraph); - this.qanaryUtil = new QanaryUtils(this.qanaryMessage, this.getQanaryTripleStoreConnector()); + this.qanaryUtils = new QanaryUtils(this.qanaryMessage, this.getQanaryTripleStoreConnector()); } /** @@ -376,22 +380,17 @@ public T getRawData() throws Exception { */ public URI getUriTextualRepresentation() throws Exception { if (this.uriTextualRepresentation == null) { - String sparql = "" // - + "PREFIX qa: " // - + "PREFIX oa: " // - + "PREFIX xsd: " // - + "SELECT ?uri " // - + "FROM <" + this.getInGraph() + "> { " // - + " ?a a qa:AnnotationOfTextRepresentation . " // - + " ?a oa:hasBody ?uri " // - + "}"; // - - ResultSet resultset = this.getQanaryTripleStoreConnector().select(sparql); + QuerySolutionMap bindingsForSelect = new QuerySolutionMap(); + bindingsForSelect.add("graph", ResourceFactory.createResource(this.getOutGraph().toASCIIString())); + String sparql = QanaryTripleStoreConnector.readFileFromResourcesWithMap(FILENAME_SELECT_URI_TEXTUAL_REPRESENTATION, bindingsForSelect); + logger.info("SPARQL query: {}", sparql); + ResultSet resultSet = this.qanaryUtils.getQanaryTripleStoreConnector().select(sparql); + int i = 0; String uriTextRepresentation = null; - while (resultset.hasNext()) { - uriTextRepresentation = resultset.next().get("uri").asResource().getURI(); + while (resultSet.hasNext()) { + uriTextRepresentation = resultSet.next().get("uri").asResource().getURI(); logger.debug("{}: qa#Question = {}", i++, uriTextRepresentation); } if (i > 1) { @@ -420,6 +419,47 @@ public String getTextualRepresentation() throws Exception { return responseRaw.getBody(); } + public String getTextualRepresentation(String language) throws Exception { + // attempt to get original question language, if annotated by LD component + String questionLanguage = ""; + try { + questionLanguage = this.getLanguage(); + logger.info("Language of original text representation: {}", questionLanguage); + if (questionLanguage.equals(language)) { + // if language alrady matches, return getTextualRepresentation + return this.getTextualRepresentation(); + } + } catch (Exception e) { + logger.warn("Language of original text representation is not known!\n{}", e.getMessage()); + } if (language.trim().length() == 2) { + // look for annotation of translation with matching language + return this.getTranslatedTextualRepresentation(language); + } else { + throw new Exception("parameter `language` is invalid: " + language); + } + } + + public String getTranslatedTextualRepresentation(String language) throws Exception { + QuerySolutionMap bindingsForSelect = new QuerySolutionMap(); + bindingsForSelect.add("graph", ResourceFactory.createResource(this.getOutGraph().toASCIIString())); + bindingsForSelect.add("targetQuestion", ResourceFactory.createResource(this.getUri().toASCIIString())); + bindingsForSelect.add("language", ResourceFactory.createStringLiteral(language)); + + String sparql = QanaryTripleStoreConnector.readFileFromResourcesWithMap(FILENAME_SELECT_TRANSLATION_ANNOTATION, bindingsForSelect); + logger.info("SPARQL query: {}", sparql); + ResultSet resultSet = this.qanaryUtils.getQanaryTripleStoreConnector().select(sparql); + + while (resultSet.hasNext()) { + QuerySolution result = resultSet.next(); + String translatedQuestionString = result.get("translation").asLiteral().getString(); + // take the first best result + return translatedQuestionString; + } + // if nothing was found + throw new Exception("No uriTextRepresentation available in graph " + this.getInGraph() + + " for language " + language + " at " + this.getEndpoint()); + } + /** * get the uri of the audio representation of the question */ @@ -518,7 +558,7 @@ public void addAnnotations(Collection selectors) throws Ex + " ] ; " // + resourceSparql // + scoreSparql // - + " oa:annotatedBy <" + qanaryUtil.getComponentUri() + "> ; " // + + " oa:annotatedBy <" + qanaryUtils.getComponentUri() + "> ; " // + " oa:annotatedAt ?time . " // + "}} WHERE { " // + " BIND (IRI(str(RAND())) AS ?a) ." // @@ -627,7 +667,7 @@ public void putTextRepresentation(String text) throws Exception { RestTemplate restTemplate = new RestTemplate(); MultiValueMap map = new LinkedMultiValueMap(); map.add("question", text); - String r = restTemplate.postForObject(qanaryUtil.getHostUri() + "/question", map, String.class); + String r = restTemplate.postForObject(qanaryUtils.getHostUri() + "/question", map, String.class); logger.info("DEBUG {}", r); JSONObject obj = new JSONObject(r); String uriTextRepresention = obj.get("questionURI").toString(); @@ -641,7 +681,7 @@ public void putTextRepresentation(String text) throws Exception { + " ?a a qa:AnnotationOfTextualRepresentation . " // + " ?a oa:hasTarget <" + this.getUri() + "> . " // + " ?a oa:hasBody <" + uriTextRepresention + "> ;" // - + " oa:annotatedBy <" + qanaryUtil.getComponentUri() + "> ; " // + + " oa:annotatedBy <" + qanaryUtils.getComponentUri() + "> ; " // + " oa:AnnotatedAt ?time " // + "}} " // + "WHERE { " // diff --git a/qanary_commons/src/main/resources/queries/select_all_AnnotationOfQuestionTranslation.rq b/qanary_commons/src/main/resources/queries/select_all_AnnotationOfQuestionTranslation.rq new file mode 100644 index 00000000..8774205e --- /dev/null +++ b/qanary_commons/src/main/resources/queries/select_all_AnnotationOfQuestionTranslation.rq @@ -0,0 +1,11 @@ +PREFIX qa: +PREFIX oa: + +SELECT ?a ?translation ?time +FROM ?graph +WHERE { + ?a a qa:AnnotationOfQuestionTranslation . + ?a oa:hasTarget ?targetQuestion . + ?a oa:hasBody ?translation . + FILTER (lang(?translation) = ?language). +} diff --git a/qanary_commons/src/main/resources/queries/select_uri_textual_representation.rq b/qanary_commons/src/main/resources/queries/select_uri_textual_representation.rq new file mode 100644 index 00000000..cdccb359 --- /dev/null +++ b/qanary_commons/src/main/resources/queries/select_uri_textual_representation.rq @@ -0,0 +1,9 @@ +PREFIX qa: +PREFIX oa: +SELECT ?uri +FROM ?graph { + ?q a qa:Question . + ?a a qa:AnnotationOfTextRepresentation . + ?a oa:hasTarget ?q . + ?a oa:hasBody ?uri . +} From c73964689378772d99faf0d010cf41902ec4d0e1 Mon Sep 17 00:00:00 2001 From: Calvin Date: Tue, 25 Jul 2023 15:45:49 +0200 Subject: [PATCH 13/29] qa.commons 3.7.6 remove old cache test add new CacheTest as new class in the test scope update pom to provide a test-jar --- qanary_commons/pom.xml | 18 ++- .../test/java/qa/commons/QanaryCacheTest.java | 99 ++++++++++++ .../qa/commons/RestTemplateCacheLiveTest.java | 144 ------------------ ...estTemplateCacheLiveTestConfiguration.java | 5 - 4 files changed, 116 insertions(+), 150 deletions(-) create mode 100644 qanary_commons/src/test/java/qa/commons/QanaryCacheTest.java delete mode 100644 qanary_commons/src/test/java/qa/commons/RestTemplateCacheLiveTest.java diff --git a/qanary_commons/pom.xml b/qanary_commons/pom.xml index 500f350b..f5dd00da 100644 --- a/qanary_commons/pom.xml +++ b/qanary_commons/pom.xml @@ -2,12 +2,15 @@ 4.0.0 eu.wdaqua.qanary qa.commons - 3.7.5 + 3.7.6 + org.springframework.boot spring-boot-starter-parent 2.6.7 + + 11 2.7.10 @@ -297,6 +300,19 @@ + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + diff --git a/qanary_commons/src/test/java/qa/commons/QanaryCacheTest.java b/qanary_commons/src/test/java/qa/commons/QanaryCacheTest.java new file mode 100644 index 00000000..8e013d38 --- /dev/null +++ b/qanary_commons/src/test/java/qa/commons/QanaryCacheTest.java @@ -0,0 +1,99 @@ +package qa.commons; + +import eu.wdaqua.qanary.communications.CacheOfRestTemplateResponse; +import eu.wdaqua.qanary.communications.RestTemplateWithCaching; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.concurrent.TimeUnit; + +import static org.junit.jupiter.api.Assertions.*; + +public class QanaryCacheTest { + private static final Logger LOGGER = LoggerFactory.getLogger(QanaryCacheTest.class); + + private final int testPort; + // time span for caching, tests wait this time span during the test runs + private final int maxTimeSpanSeconds; + private final RestTemplateWithCaching myRestTemplate; + private final CacheOfRestTemplateResponse myCacheOfResponse; + + public QanaryCacheTest( + int testPort, // + int maxTimeSpanSeconds, // + @Autowired RestTemplateWithCaching myRestTemplate, // + @Autowired CacheOfRestTemplateResponse myCacheOfResponse // + ) { + this.testPort = testPort; + this.maxTimeSpanSeconds = maxTimeSpanSeconds; + this.myRestTemplate = myRestTemplate; + this.myCacheOfResponse = myCacheOfResponse; + } + + /** + * @throws InterruptedException + * @throws URISyntaxException + */ + public void givenRestTemplate_whenRequested_thenLogAndModifyResponse() throws InterruptedException, URISyntaxException { + + assertNotNull(this.myRestTemplate); + assertNotNull(this.myCacheOfResponse); + + URI testServiceURL0 = new URI("http://localhost:" + this.testPort + "/"); + URI testServiceURL1 = new URI("http://localhost:" + this.testPort + "/component-description"); + + long initialNumberOfRequests = this.myCacheOfResponse.getNumberOfExecutedRequests(); + + callRestTemplateWithCaching(testServiceURL0, Cache.NOT_CACHED); // cache miss + callRestTemplateWithCaching(testServiceURL0, Cache.CACHED); // cache hit + callRestTemplateWithCaching(testServiceURL0, Cache.CACHED); // cache hit + + TimeUnit.SECONDS.sleep(this.maxTimeSpanSeconds + 5); // wait until it is too late for caching + + callRestTemplateWithCaching(testServiceURL0, Cache.NOT_CACHED); // cache miss: too long ago + callRestTemplateWithCaching(testServiceURL0, Cache.CACHED); // cache hit + callRestTemplateWithCaching(testServiceURL1, Cache.NOT_CACHED); // cache miss: different URI + callRestTemplateWithCaching(testServiceURL0, Cache.CACHED); // cache hit + callRestTemplateWithCaching(testServiceURL1, Cache.CACHED); // cache hit + + assertEquals(initialNumberOfRequests + 3, this.myCacheOfResponse.getNumberOfExecutedRequests()); + + } + + /** + * @param uri + * @param cacheStatus + * @throws URISyntaxException + */ + private void callRestTemplateWithCaching(URI uri, Cache cacheStatus) throws URISyntaxException { + long numberOfNewlyExecutedRequests = this.myCacheOfResponse.getNumberOfExecutedRequests(); + ResponseEntity responseEntity = this.myRestTemplate.getForEntity(uri, String.class); + numberOfNewlyExecutedRequests = this.myCacheOfResponse.getNumberOfExecutedRequests() - numberOfNewlyExecutedRequests; + this.LOGGER.info("numberOfExecutedRequest since last request: new={}, count={}, teststatus={}", // + numberOfNewlyExecutedRequests, this.myCacheOfResponse.getNumberOfExecutedRequests(), cacheStatus); + + assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); + + switch (cacheStatus) { + case NOT_CACHED: + assertEquals(1, numberOfNewlyExecutedRequests); + break; + case CACHED: + assertEquals(0, numberOfNewlyExecutedRequests); + break; + default: + fail("Test case misconfigured"); + break; + } + } + + private enum Cache { + CACHED, NOT_CACHED + } +} + diff --git a/qanary_commons/src/test/java/qa/commons/RestTemplateCacheLiveTest.java b/qanary_commons/src/test/java/qa/commons/RestTemplateCacheLiveTest.java deleted file mode 100644 index f2bc1a93..00000000 --- a/qanary_commons/src/test/java/qa/commons/RestTemplateCacheLiveTest.java +++ /dev/null @@ -1,144 +0,0 @@ -package qa.commons; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import static org.junit.jupiter.api.Assertions.fail; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.concurrent.TimeUnit; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.web.AnnotationConfigWebContextLoader; - -import eu.wdaqua.qanary.commons.config.CacheConfig; -import eu.wdaqua.qanary.communications.CacheOfRestTemplateResponse; -import eu.wdaqua.qanary.communications.RestTemplateWithCaching; - -/** - * Test is validating the correct functionality of RestTemplateWithCaching - * (i.e., repeated requests to a Web service are cached) - */ -@ExtendWith(SpringExtension.class) -@SpringBootTest(classes=RestTemplateCacheLiveTest.class) -@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { CacheConfig.class }) -@Import(RestTemplateCacheLiveTestConfiguration.class) -class RestTemplateCacheLiveTest { - // time span for caching, tests wait this time span during the test runs - protected final static int MAX_TIME_SPAN_SECONDS = 5; - - private Logger logger = LoggerFactory.getLogger(RestTemplateCacheLiveTest.class); - - private enum Cache { - CACHED, NOTCACHED - } - - @Autowired - RestTemplateWithCaching restTemplate; - - @Autowired - CacheOfRestTemplateResponse myCacheOfResponse; - - @Test - void givenRestTemplate_whenRequested_thenLogAndModifyResponse() - throws InterruptedException, URISyntaxException { - - // myCacheOfResponse = new CacheOfRestTemplateResponse(); - // restTemplate = new RestTemplateWithCaching(myCacheOfResponse); - assertNotNull(restTemplate); - assertNotNull(myCacheOfResponse); - - LoginForm loginForm0 = new LoginForm("userName", "password"); - LoginForm loginForm1 = new LoginForm("userName2", "password2"); - - assertEquals(0, myCacheOfResponse.getNumberOfExecutedRequests()); - - callRestTemplateWithCaching(loginForm0, Cache.NOTCACHED); // cache miss - callRestTemplateWithCaching(loginForm0, Cache.CACHED); // cache hit - callRestTemplateWithCaching(loginForm0, Cache.CACHED); // cache hit - TimeUnit.SECONDS.sleep(MAX_TIME_SPAN_SECONDS + 1); // wait until it is too late for caching - callRestTemplateWithCaching(loginForm0, Cache.NOTCACHED); // cache miss: too long ago - callRestTemplateWithCaching(loginForm0, Cache.CACHED); // cache hit - callRestTemplateWithCaching(loginForm1, Cache.NOTCACHED); // cache miss: different body - callRestTemplateWithCaching(loginForm0, Cache.CACHED); // cache hit - callRestTemplateWithCaching(loginForm1, Cache.CACHED); // cache hit - - assertEquals(3, myCacheOfResponse.getNumberOfExecutedRequests()); - - } - - private void callRestTemplateWithCaching(LoginForm loginForm, Cache cacheStatus) throws URISyntaxException { - URI TESTSERVICEURL = new URI("http://httpbin.org/post"); - - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - HttpEntity requestEntity = new HttpEntity(loginForm, headers); - - long numberOfNewlyExecutedRequests = myCacheOfResponse.getNumberOfExecutedRequests(); - ResponseEntity responseEntity = restTemplate.postForEntity(TESTSERVICEURL, requestEntity, String.class); - numberOfNewlyExecutedRequests = myCacheOfResponse.getNumberOfExecutedRequests() - - numberOfNewlyExecutedRequests; - logger.info("numberOfExecutedRequest since last request: new={}, count={}, teststatus={}", // - numberOfNewlyExecutedRequests, myCacheOfResponse.getNumberOfExecutedRequests(), cacheStatus); - - assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); - - switch (cacheStatus) { - case NOTCACHED: - assertEquals(1, numberOfNewlyExecutedRequests); - break; - case CACHED: - assertEquals(0, numberOfNewlyExecutedRequests); - break; - default: - fail("Test case misconfigured"); - break; - } - } - - public class LoginForm { - private String username; - private String password; - - public LoginForm() { - } - - public LoginForm(String username, String password) { - super(); - this.username = username; - this.password = password; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - } -} diff --git a/qanary_commons/src/test/java/qa/commons/RestTemplateCacheLiveTestConfiguration.java b/qanary_commons/src/test/java/qa/commons/RestTemplateCacheLiveTestConfiguration.java index dfbd9ac5..24efcc74 100644 --- a/qanary_commons/src/test/java/qa/commons/RestTemplateCacheLiveTestConfiguration.java +++ b/qanary_commons/src/test/java/qa/commons/RestTemplateCacheLiveTestConfiguration.java @@ -9,11 +9,6 @@ @TestConfiguration public class RestTemplateCacheLiveTestConfiguration { - // define here the current CaffeineCacheManager configuration - static { - System.setProperty("qanary.webservicecalls.cache.specs", - "maximumSize=1000,expireAfterAccess=" + RestTemplateCacheLiveTest.MAX_TIME_SPAN_SECONDS + "s"); - } @Bean @Primary From 9b5d5aa883df7729ebc25de611450b6a6b480dc9 Mon Sep 17 00:00:00 2001 From: caldoe <60075860+caldoe@users.noreply.github.com> Date: Tue, 1 Aug 2023 12:21:03 +0200 Subject: [PATCH 14/29] Update Stardog credentials --- service_config/files/pipeline | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service_config/files/pipeline b/service_config/files/pipeline index 1e5e1d75..26ed5b3d 100644 --- a/service_config/files/pipeline +++ b/service_config/files/pipeline @@ -1,7 +1,7 @@ QANARY_PROCESS_ALLOW-ADDITIONAL-TRIPLES=false SERVER_HOST=http://demos.swe.htwk-leipzig.de -STARDOG_URL=http://demos.swe.htwk-leipzig.de:40102/ +STARDOG_URL=https://sd-55647adf.stardog.cloud:5820 STARDOG_PASSWORD=SECRETS_STARDOG_PASSWORD -STARDOG_USERNAME=admin +STARDOG_USERNAME=qanary MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE=* -SERVER_PORT=40111 \ No newline at end of file +SERVER_PORT=40111 From d9a84156762401f5005ca27b11e928d310c97c8d Mon Sep 17 00:00:00 2001 From: heinpa Date: Tue, 8 Aug 2023 16:16:28 +0200 Subject: [PATCH 15/29] simplify query to get AnnotationOfAnswerSPARQL --- .../wdaqua/qanary/commons/QanaryQuestion.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java index fedd8a20..bdbcc2d9 100644 --- a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java +++ b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java @@ -545,14 +545,16 @@ public List getSparqlResults() throws SparqlQueryFailed { + " } \n" // + " OPTIONAL { ?a qa:score ?confidence . } \n" // + " OPTIONAL { ?a qa:overKnowledgeGraph ?kb . } \n" // - + " ?a oa:annotatedAt ?time1 . \n" // - + " { \n" // - + " SELECT ?time1 { \n" // - + " ?a a qa:AnnotationOfAnswerSPARQL . \n" // - + " ?a oa:annotatedAt ?time1 . \n" // - + " } \n" // - + " ORDER BY DESC(?time1) \n" // - + " LIMIT 1 \n" // + + " OPTIONAL { \n" // + + " ?a oa:annotatedAt ?time1 . \n" // + + " { \n" // + + " SELECT ?time1 { \n" // + + " ?a a qa:AnnotationOfAnswerSPARQL . \n" // + + " ?a oa:annotatedAt ?time1 . \n" // + + " } \n" // + + " ORDER BY DESC(?time1) \n" // + + " LIMIT 1 \n" // + + " } \n" // + " } \n" // + "} \n" // + "ORDER BY DESC(?score) \n"; From 67d75c14f048593a1f20d799e21a27305e68ad7b Mon Sep 17 00:00:00 2001 From: caldoe <60075860+caldoe@users.noreply.github.com> Date: Tue, 15 Aug 2023 16:41:57 +0200 Subject: [PATCH 16/29] Update pipeline deployment --- service_config/files/pipeline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_config/files/pipeline b/service_config/files/pipeline index 26ed5b3d..8a1a0093 100644 --- a/service_config/files/pipeline +++ b/service_config/files/pipeline @@ -1,6 +1,6 @@ QANARY_PROCESS_ALLOW-ADDITIONAL-TRIPLES=false SERVER_HOST=http://demos.swe.htwk-leipzig.de -STARDOG_URL=https://sd-55647adf.stardog.cloud:5820 +STARDOG_URL=https://sd-6845aa75.stardog.cloud:5820 STARDOG_PASSWORD=SECRETS_STARDOG_PASSWORD STARDOG_USERNAME=qanary MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE=* From a7d918cdc9605e92c93c82be3496698e8411ecb6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Aug 2023 11:01:09 +0000 Subject: [PATCH 17/29] build(deps): bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/maven.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 569221e5..896224e3 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 74c342fe..117dbdf4 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up JDK 11 uses: actions/setup-java@v1 with: From 6f8cfa4507d87f202dd7fc28586c8c887b3372ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Aug 2023 19:31:18 +0000 Subject: [PATCH 18/29] build(deps): bump actions/setup-java from 1 to 3 Bumps [actions/setup-java](https://github.com/actions/setup-java) from 1 to 3. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/v1...v3) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 117dbdf4..f05f58c5 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: java-version: 11 - name: Build with Maven From 5e5f391d955aeaeea1d8e2081ac09702b02615a7 Mon Sep 17 00:00:00 2001 From: Andreas Both Date: Wed, 16 Aug 2023 21:33:40 +0200 Subject: [PATCH 19/29] Update maven.yml --- .github/workflows/maven.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index f05f58c5..5ce8daa3 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -16,9 +16,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: 11 + java-version: 17 + distribution: 'adopt' - name: Build with Maven run: mvn -B package --file pom.xml From f0b77226745901364c326827672083b64722bb10 Mon Sep 17 00:00:00 2001 From: Paul Heinze Date: Tue, 22 Aug 2023 13:23:40 +0000 Subject: [PATCH 20/29] formatting of sparql query --- .../wdaqua/qanary/commons/QanaryQuestion.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java index bdbcc2d9..27713361 100644 --- a/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java +++ b/qanary_commons/src/main/java/eu/wdaqua/qanary/commons/QanaryQuestion.java @@ -546,15 +546,15 @@ public List getSparqlResults() throws SparqlQueryFailed { + " OPTIONAL { ?a qa:score ?confidence . } \n" // + " OPTIONAL { ?a qa:overKnowledgeGraph ?kb . } \n" // + " OPTIONAL { \n" // - + " ?a oa:annotatedAt ?time1 . \n" // - + " { \n" // - + " SELECT ?time1 { \n" // - + " ?a a qa:AnnotationOfAnswerSPARQL . \n" // - + " ?a oa:annotatedAt ?time1 . \n" // - + " } \n" // - + " ORDER BY DESC(?time1) \n" // - + " LIMIT 1 \n" // - + " } \n" // + + " ?a oa:annotatedAt ?time1 . \n" // + + " { \n" // + + " SELECT ?time1 { \n" // + + " ?a a qa:AnnotationOfAnswerSPARQL . \n" // + + " ?a oa:annotatedAt ?time1 . \n" // + + " } \n" // + + " ORDER BY DESC(?time1) \n" // + + " LIMIT 1 \n" // + + " } \n" // + " } \n" // + "} \n" // + "ORDER BY DESC(?score) \n"; From 32df0fba12980a59ab6a181f969e0226a01894ae Mon Sep 17 00:00:00 2001 From: Andreas Both Date: Thu, 24 Aug 2023 01:43:35 +0200 Subject: [PATCH 21/29] qa.commons v3.7.6 --- qanary_commons/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qanary_commons/pom.xml b/qanary_commons/pom.xml index 01a7b0a0..131542e2 100644 --- a/qanary_commons/pom.xml +++ b/qanary_commons/pom.xml @@ -2,7 +2,7 @@ 4.0.0 eu.wdaqua.qanary qa.commons - 3.7.5 + 3.7.6 org.springframework.boot spring-boot-starter-parent From 0e8df0ebcce00c7e8c792d813adf8ca67a0d6f25 Mon Sep 17 00:00:00 2001 From: Andreas Both Date: Thu, 24 Aug 2023 01:45:19 +0200 Subject: [PATCH 22/29] qa.commons v3.8.2 --- qanary_commons/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qanary_commons/pom.xml b/qanary_commons/pom.xml index aa050def..91f045f1 100644 --- a/qanary_commons/pom.xml +++ b/qanary_commons/pom.xml @@ -2,7 +2,7 @@ 4.0.0 eu.wdaqua.qanary qa.commons - 3.7.5 + 3.8.2 org.springframework.boot spring-boot-starter-parent From 3773bb263385ac78b7b3498e1b42ad64284fb36e Mon Sep 17 00:00:00 2001 From: caldoe <60075860+caldoe@users.noreply.github.com> Date: Sat, 26 Aug 2023 14:13:39 +0200 Subject: [PATCH 23/29] Update pipeline auto deployment Update stardog server for auto deployment --- service_config/files/pipeline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_config/files/pipeline b/service_config/files/pipeline index 8a1a0093..f2fa33f2 100644 --- a/service_config/files/pipeline +++ b/service_config/files/pipeline @@ -1,6 +1,6 @@ QANARY_PROCESS_ALLOW-ADDITIONAL-TRIPLES=false SERVER_HOST=http://demos.swe.htwk-leipzig.de -STARDOG_URL=https://sd-6845aa75.stardog.cloud:5820 +STARDOG_URL=https://sd-f961e5f7.stardog.cloud:5820 STARDOG_PASSWORD=SECRETS_STARDOG_PASSWORD STARDOG_USERNAME=qanary MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE=* From b109d1dd7bf8422feb05d58e3ee224c3d5a3220b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 30 Aug 2023 03:06:36 +0000 Subject: [PATCH 24/29] build(deps): bump @adobe/css-tools in /qanary-configuration-frontend Bumps [@adobe/css-tools](https://github.com/adobe/css-tools) from 4.0.1 to 4.3.1. - [Changelog](https://github.com/adobe/css-tools/blob/main/History.md) - [Commits](https://github.com/adobe/css-tools/commits) --- updated-dependencies: - dependency-name: "@adobe/css-tools" dependency-type: indirect ... Signed-off-by: dependabot[bot] --- qanary-configuration-frontend/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qanary-configuration-frontend/package-lock.json b/qanary-configuration-frontend/package-lock.json index 0045bd03..d92a74b7 100644 --- a/qanary-configuration-frontend/package-lock.json +++ b/qanary-configuration-frontend/package-lock.json @@ -23,9 +23,9 @@ } }, "node_modules/@adobe/css-tools": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.0.1.tgz", - "integrity": "sha512-+u76oB43nOHrF4DDWRLWDCtci7f3QJoEBigemIdIeTi1ODqjx6Tad9NCVnPRwewWlKkVab5PlK8DCtPTyX7S8g==" + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.1.tgz", + "integrity": "sha512-/62yikz7NLScCGAAST5SHdnjaDJQBDq0M2muyRTpf2VQhw6StBg2ALiu73zSJQ4fMVLA+0uBhBHAle7Wg+2kSg==" }, "node_modules/@ampproject/remapping": { "version": "2.1.1", @@ -16565,9 +16565,9 @@ }, "dependencies": { "@adobe/css-tools": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.0.1.tgz", - "integrity": "sha512-+u76oB43nOHrF4DDWRLWDCtci7f3QJoEBigemIdIeTi1ODqjx6Tad9NCVnPRwewWlKkVab5PlK8DCtPTyX7S8g==" + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.1.tgz", + "integrity": "sha512-/62yikz7NLScCGAAST5SHdnjaDJQBDq0M2muyRTpf2VQhw6StBg2ALiu73zSJQ4fMVLA+0uBhBHAle7Wg+2kSg==" }, "@ampproject/remapping": { "version": "2.1.1", From 34af6bb5a6554dbd00fc422617c8df19a31bb825 Mon Sep 17 00:00:00 2001 From: caldoe <60075860+caldoe@users.noreply.github.com> Date: Fri, 1 Sep 2023 12:46:53 +0200 Subject: [PATCH 25/29] Update autodeployment add new Stardog endpoint --- service_config/files/pipeline | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service_config/files/pipeline b/service_config/files/pipeline index f2fa33f2..1983fcd2 100644 --- a/service_config/files/pipeline +++ b/service_config/files/pipeline @@ -1,7 +1,7 @@ QANARY_PROCESS_ALLOW-ADDITIONAL-TRIPLES=false SERVER_HOST=http://demos.swe.htwk-leipzig.de -STARDOG_URL=https://sd-f961e5f7.stardog.cloud:5820 +STARDOG_URL=https://sd-174feb1e.stardog.cloud:5820 STARDOG_PASSWORD=SECRETS_STARDOG_PASSWORD -STARDOG_USERNAME=qanary +STARDOG_USERNAME=readwrite MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE=* SERVER_PORT=40111 From 1fc75c974871abd831bccd3298d2dc511368e445 Mon Sep 17 00:00:00 2001 From: Andreas Both Date: Mon, 4 Sep 2023 04:22:51 +0200 Subject: [PATCH 26/29] removed comments --- .../eu/wdaqua/qanary/web/messages/GerbilExecuteResponse.java | 1 - 1 file changed, 1 deletion(-) diff --git a/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/messages/GerbilExecuteResponse.java b/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/messages/GerbilExecuteResponse.java index e9785cb7..00735e1e 100644 --- a/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/messages/GerbilExecuteResponse.java +++ b/qanary_pipeline-template/src/main/java/eu/wdaqua/qanary/web/messages/GerbilExecuteResponse.java @@ -89,7 +89,6 @@ public GerbilExecuteResponse(ObjectMapper objectMapper, String questionText, Str QueryObj queryObj = new QueryObj(sparqlQueryString); List answersArray = new LinkedList<>(); - //JsonNode answersObj2 = null; if (jsonAnswerString != null && jsonAnswerString.length() > 0) { JsonNode answersObj2 = objectMapper.readTree(jsonAnswerString); answersArray.add(answersObj2); From 1fa07c1d9113d0bfadf507de2ed7280b8dba4e51 Mon Sep 17 00:00:00 2001 From: Andreas Both Date: Mon, 4 Sep 2023 04:24:11 +0200 Subject: [PATCH 27/29] Update pom.xml --- qanary_commons/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qanary_commons/pom.xml b/qanary_commons/pom.xml index 500f350b..c9d811e3 100644 --- a/qanary_commons/pom.xml +++ b/qanary_commons/pom.xml @@ -2,7 +2,7 @@ 4.0.0 eu.wdaqua.qanary qa.commons - 3.7.5 + 3.7.6 org.springframework.boot spring-boot-starter-parent From 4d2e0376224c436e85edbdad01bd22b1ff5e5fb2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 07:20:41 +0000 Subject: [PATCH 28/29] build(deps): bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/docker-deployment.yml | 2 +- .github/workflows/maven.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 896224e3..2b7a0b33 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/docker-deployment.yml b/.github/workflows/docker-deployment.yml index c68a72d9..69abdf24 100644 --- a/.github/workflows/docker-deployment.yml +++ b/.github/workflows/docker-deployment.yml @@ -15,7 +15,7 @@ jobs: with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_PASSWORD }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build the Docker images and Push to Dockerhub run: bash -c ./service_config/build_images.sh - name: Init update diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 5ce8daa3..89ee6e0a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK 17 uses: actions/setup-java@v3 with: From 2a118443f4d42d14320565bac2830c4bd30df04a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 07:59:20 +0000 Subject: [PATCH 29/29] build(deps): bump docker/login-action from 2 to 3 Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docker-deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-deployment.yml b/.github/workflows/docker-deployment.yml index c68a72d9..67039393 100644 --- a/.github/workflows/docker-deployment.yml +++ b/.github/workflows/docker-deployment.yml @@ -11,7 +11,7 @@ jobs: STARDOG_PASSWORD: ${{ secrets.STARDOG_PASSWORD }} steps: - name: Docker Login - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_PASSWORD }}