From b92e542c9035e6d14a240296f50376ba9b6adfcc Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Fri, 27 Sep 2024 13:08:28 +0200 Subject: [PATCH] [#274] Replace the invocation of loadConfiguration() with loadManualConfiguration() in all methods that use it. Refactor the code. --- .../modules/DatasetDiscoveryModule.java | 5 ----- .../cvut/spipes/modules/SUTimeModuleNew.java | 2 +- .../modules/ApplyConstructAbstractModule.java | 22 ++++--------------- .../modules/ApplyConstructV2Module.java | 2 +- ...hunkedValuesAndScrollableCursorModule.java | 1 - ...ApplyConstructWithChunkedValuesModule.java | 2 +- ...lyConstructWithScrollableCursorModule.java | 2 +- .../spipes/modules/DownloadGraphModule.java | 2 +- .../ImproveSPOWithMarginalsModule.java | 2 +- .../spipes/modules/RetrieveGraphModule.java | 2 +- .../spipes/modules/TextAnalysisModule.java | 5 ----- 11 files changed, 11 insertions(+), 36 deletions(-) diff --git a/s-pipes-modules/module-dataset-discovery/src/main/java/cz/cvut/spipes/modules/DatasetDiscoveryModule.java b/s-pipes-modules/module-dataset-discovery/src/main/java/cz/cvut/spipes/modules/DatasetDiscoveryModule.java index 466a0892..7c2ae370 100644 --- a/s-pipes-modules/module-dataset-discovery/src/main/java/cz/cvut/spipes/modules/DatasetDiscoveryModule.java +++ b/s-pipes-modules/module-dataset-discovery/src/main/java/cz/cvut/spipes/modules/DatasetDiscoveryModule.java @@ -35,14 +35,9 @@ public class DatasetDiscoveryModule extends AnnotatedAbstractModule { private static final String TYPE_URI = KBSS_MODULE.uri + "dataset-discovery-v1"; - private static final Property P_USER_INPUT = getParameter("prp-user-input"); @Parameter(iri = TYPE_URI + "/" + "prp-user-input", comment = "Keywords query. Keywords are separated by space.") private String userInput; - private static Property getParameter(final String name) { - return ResourceFactory.createProperty(TYPE_URI + "/" + name); - } - private List getDatasetsForQuery(final String s, final String endpoint) { final List datasets = new ArrayList<>(); 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 a0fde158..c198f0ff 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 @@ -48,7 +48,7 @@ public class SUTimeModuleNew extends AnnotatedAbstractModule { private static final Property P_PAGE_SIZE = ResourceFactory.createProperty(TYPE_PREFIX + "page-size"); @Parameter(iri = TYPE_PREFIX + "page-size", comment = "Page size. Default value is 10000.") - private Integer pageSize = DEFAULT_PAGE_SIZE; + private int pageSize = DEFAULT_PAGE_SIZE; @Parameter(iri = SML.constructQuery, comment = "List of construct queries. The module annotates the lexical form of objects of the output statements of these queries.")// TODO - revise comment 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 bca2de10..3ad05b72 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 @@ -137,23 +137,9 @@ protected String substituteQueryMarkers(int currentIteration, String queryStr) { return queryStr; } -// @Override -// public void loadConfiguration() { -// -// // TODO sparql expressions -// // TODO load default values from configuration -// -// // TODO does not work with string query as object is not RDF resource ??? -// constructQueries = getResourcesByProperty(SML.JENA.constructQuery); -// -// log.debug("Loaded {} spin construct queries.", constructQueries.size()); -// -// //TODO default value must be taken from template definition -// isReplace = this.getPropertyValue(SML.JENA.replace, false); -// -// parseText = this.getPropertyValue(KBSS_MODULE.JENA.is_parse_text, true); -// iterationCount = this.getPropertyValue(KBSS_MODULE.JENA.has_max_iteration_count, -1); -// } - + @Override + public void loadManualConfiguration(){ + log.debug("Loaded {} spin construct queries.", constructQueries.size()); + } } diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructV2Module.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructV2Module.java index 0b7ea451..44eeaf25 100644 --- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructV2Module.java +++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructV2Module.java @@ -21,7 +21,7 @@ public String getTypeURI() { @Override public void loadManualConfiguration() { - super.loadConfiguration(); + super.loadManualConfiguration(); iterationCount = this.getPropertyValue(KBSS_MODULE.JENA.has_max_iteration_count, 1); } } 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 566bff5c..f2c1dea2 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 @@ -107,7 +107,6 @@ protected String substituteQueryMarkers(int currentIteration, String queryStr) { @Override public void loadManualConfiguration() { - super.loadConfiguration(); super.loadManualConfiguration(); //iterationCount = this.getPropertyValue(KBSS_MODULE.JENA.s_max_iteration_count, 1); } 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 85dc30e5..93ac1008 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 @@ -114,7 +114,7 @@ protected String substituteQueryMarkers(int currentIteration, String queryStr) { @Override public void loadManualConfiguration() { - super.loadConfiguration(); + super.loadManualConfiguration(); //iterationCount = this.getPropertyValue(KBSS_MODULE.JENA.s_max_iteration_count, 1); } diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithScrollableCursorModule.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithScrollableCursorModule.java index ebe757b3..77bf606b 100644 --- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithScrollableCursorModule.java +++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ApplyConstructWithScrollableCursorModule.java @@ -77,7 +77,7 @@ protected String substituteQueryMarkers(int currentIteration, String queryStr) { @Override public void loadManualConfiguration() { - super.loadConfiguration(); + super.loadManualConfiguration(); //iterationCount = this.getPropertyValue(KBSS_MODULE.JENA.s_max_iteration_count, 1); } } diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/DownloadGraphModule.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/DownloadGraphModule.java index 25c6b593..db1df5ae 100644 --- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/DownloadGraphModule.java +++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/DownloadGraphModule.java @@ -40,7 +40,7 @@ public class DownloadGraphModule extends AnnotatedAbstractModule { private String outputResourceVariable; @Parameter(iri = TYPE_PREFIX + "page-size", comment = "Page size. Default value is 10000.") - private Integer pageSize = DEFAULT_PAGE_SIZE; + private int pageSize = DEFAULT_PAGE_SIZE; protected long numberOfDownloadedTriples; diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ImproveSPOWithMarginalsModule.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ImproveSPOWithMarginalsModule.java index ef04a70d..53c0fad5 100644 --- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ImproveSPOWithMarginalsModule.java +++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/ImproveSPOWithMarginalsModule.java @@ -381,7 +381,7 @@ public String getTypeURI() { @Override public void loadManualConfiguration() { - super.loadConfiguration(); + super.loadManualConfiguration(); } private @NotNull diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/RetrieveGraphModule.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/RetrieveGraphModule.java index 51af7557..65f12e6a 100644 --- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/RetrieveGraphModule.java +++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/modules/RetrieveGraphModule.java @@ -31,7 +31,7 @@ public class RetrieveGraphModule extends AnnotatedAbstractModule { private String endpointUrl; @Parameter(iri = TYPE_PREFIX + "page-size", comment = "Page size. Default is 10000.") - private Integer pageSize = DEFAULT_PAGE_SIZE; + private int pageSize = DEFAULT_PAGE_SIZE; public String getTypeURI() { return TYPE_URI; 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 6d846d6c..285e45b4 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 @@ -186,11 +186,6 @@ private String annotateObjectLiteral(String objectValue) { return annotatedText; } - @Override - public void loadManualConfiguration() { - super.loadConfiguration(); - } - @Override public String getTypeURI() { return TYPE_URI;