in s-pipes-modules\module.sms.ttl
// TODO - we should be able to annotate directly "StreamResource e5xResource" instead
@Parameter(name = "has-resource-uri", comment = "Uri of a resource referencing content of an e5x file.")
@@ -67,31 +64,31 @@ ExecutionContext executeSelf() {
try {
if ("text/xml".equals(e5xResource.getContentType()) || "application/xml".equals(e5xResource.getContentType())) {
- LOG.debug("File considered XML (Content Type: {})", e5xResource.getContentType());
- LOG.debug("- content length: {}, content (as string) : ", e5xResource.getContent().length, new String(e5xResource.getContent()));
+ log.debug("File considered XML (Content Type: {})", e5xResource.getContentType());
+ log.debug("- content length: {}, content (as string) : ", e5xResource.getContent().length, new String(e5xResource.getContent()));
// create factory to parse eccairs values
final E5XXMLParser e5xXMLParser = new E5XXMLParser(eaf);
e5xXMLParser.parseDocument(e5xResourceStream);
r = e5xXMLParser.getReport();
} else if ("application/zip".equals(e5xResource.getContentType()) || "application/octet-stream".equals(e5xResource.getContentType()) || e5xResource.getContentType() == null || e5xResource.getContentType().isEmpty()) {
- LOG.debug("File considered ZIP (Content Type: {})", e5xResource.getContentType());
- LOG.debug("- content length: {}, content (as byte array): {}",e5xResource.getContent().length, Arrays.toString(e5xResource.getContent()));
+ log.debug("File considered ZIP (Content Type: {})", e5xResource.getContentType());
+ log.debug("- content length: {}, content (as byte array): {}",e5xResource.getContent().length, Arrays.toString(e5xResource.getContent()));
// ZIP by default
final E5XMLLoader loader = new E5XMLLoader(e5xResourceStream, eaf);
- LOG.debug("- loader created based on resource stream name:{}, email:{}, stream:{}, closed: {}", e5xResourceStream.getName(), e5xResourceStream.getEmailId(), e5xResourceStream.getContent(), e5xResourceStream.isCloased());
+ log.debug("- loader created based on resource stream name:{}, email:{}, stream:{}, closed: {}", e5xResourceStream.getName(), e5xResourceStream.getEmailId(), e5xResourceStream.getContent(), e5xResourceStream.isCloased());
EccairsReport[] s = loader.loadData().toArray(EccairsReport[]::new);
- LOG.debug("- found {} reports", s.length);
+ log.debug("- found {} reports", s.length);
if ( s.length > 0 ) {
r = s[0];
}
} else {
- LOG.debug("Unsupported Content Type {}", e5xResource.getContentType());
+ log.debug("Unsupported Content Type {}", e5xResource.getContentType());
return outputExecutionContext;
}
if ( r == null ) {
- LOG.debug("No report parsed, terminating.");
+ log.debug("No report parsed, terminating.");
return outputExecutionContext;
}
@@ -134,9 +131,9 @@ ExecutionContext executeSelf() {
sesameRepo.getConnection().close();
sesameRepo.shutDown();
} catch (IOException e) {
- LOG.warn("An exception occurred during report processing.", e);
+ log.warn("An exception occurred during report processing.", e);
} catch (RepositoryException e) {
- LOG.warn("Failed to close sesame repository connection", e);
+ log.warn("Failed to close sesame repository connection", e);
}
return outputExecutionContext;
}
diff --git a/s-pipes-modules/module-eccairs/src/main/java/cz/cvut/spipes/modules/eccairs/SesameDataDao.java b/s-pipes-modules/module-eccairs/src/main/java/cz/cvut/spipes/modules/eccairs/SesameDataDao.java
index 826a72f7..6f4f1531 100644
--- a/s-pipes-modules/module-eccairs/src/main/java/cz/cvut/spipes/modules/eccairs/SesameDataDao.java
+++ b/s-pipes-modules/module-eccairs/src/main/java/cz/cvut/spipes/modules/eccairs/SesameDataDao.java
@@ -1,5 +1,6 @@
package cz.cvut.spipes.modules.eccairs;
+import lombok.extern.slf4j.Slf4j;
import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.repository.Repository;
import org.eclipse.rdf4j.repository.RepositoryConnection;
@@ -14,15 +15,9 @@
import java.io.ByteArrayOutputStream;
import java.net.URI;
-
+@Slf4j
public class SesameDataDao {
- private static final Logger LOG = LoggerFactory.getLogger(SesameDataDao.class);
-
-
-
-
-
/**
* Gets raw content of the repository. Use null for contextUri to get whole content of the repository.
*
@@ -57,7 +52,7 @@ private static void getRepositoryData(Repository sesameRepository, URI contextUr
connection.close();
}
} catch (RepositoryException | RDFHandlerException e) {
- LOG.error("Unable to read data from repository.", e);
+ log.error("Unable to read data from repository.", e);
}
}
}
diff --git a/s-pipes-modules/module-form/pom.xml b/s-pipes-modules/module-form/pom.xml
index 983dff29..a5b8184d 100644
--- a/s-pipes-modules/module-form/pom.xml
+++ b/s-pipes-modules/module-form/pom.xml
@@ -82,5 +82,10 @@
${project.version}
test
+
+ org.projectlombok
+ lombok
+ provided
+
\ No newline at end of file
diff --git a/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/ConstructFormMetadataModule.java b/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/ConstructFormMetadataModule.java
index b8d4ce41..0b7d3a76 100644
--- a/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/ConstructFormMetadataModule.java
+++ b/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/ConstructFormMetadataModule.java
@@ -5,25 +5,22 @@
import cz.cvut.spipes.constants.SML;
import cz.cvut.spipes.engine.ExecutionContext;
import cz.cvut.spipes.modules.annotations.SPipesModule;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.jena.rdf.model.*;
import org.apache.jena.vocabulary.RDF;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.util.LinkedList;
import java.util.List;
import static cz.cvut.spipes.form.JenaFormUtils.getAnswerOrigin;
import static cz.cvut.spipes.form.JenaFormUtils.getQuestionOrigin;
+@Slf4j
@SPipesModule(label = "construct form metadata", comment = "Compute form:has-origin-path and form:has-origin-path-id properties.")
public class ConstructFormMetadataModule extends AnnotatedAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(ConstructFormMetadataModule.class);
-
private static final String TYPE_URI = KBSS_MODULE.uri + "construct-form-metadata";
private static final String PATH_SEPARATOR = ",";
private static final String INSTANCE_TYPE_SEPARATOR = "|";
@@ -55,9 +52,9 @@ ExecutionContext executeSelf() {
List rootQuestions = getRootQuestions(inpModel);
- LOG.debug("Found {} root questions.", rootQuestions.size());
- if (LOG.isTraceEnabled()) {
- LOG.trace("Found root questions: {}", rootQuestions);
+ log.debug("Found {} root questions.", rootQuestions.size());
+ if (log.isTraceEnabled()) {
+ log.trace("Found root questions: {}", rootQuestions);
}
Model constructedModel = ModelFactory.createDefaultModel();
diff --git a/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/ConstructTextualViewModule.java b/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/ConstructTextualViewModule.java
index bceeb6fd..fc6168ef 100644
--- a/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/ConstructTextualViewModule.java
+++ b/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/ConstructTextualViewModule.java
@@ -13,6 +13,7 @@
import cz.cvut.spipes.form.JenaFormUtils;
import cz.cvut.spipes.form.JopaPersistenceUtils;
import cz.cvut.spipes.modules.annotations.SPipesModule;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
@@ -22,14 +23,13 @@
import java.util.List;
import java.util.function.Predicate;
+@Slf4j
@SPipesModule(label = "construct textual view", comment =
"For input Q&A models constructs textual view of specified questions. Each textual" +
" view represent the question and its sub-questions recursively."
)
public class ConstructTextualViewModule extends AnnotatedAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(ConstructTextualViewModule.class);
-
private static final String TYPE_URI = KBSS_MODULE.uri + "construct-textual-view";
@Parameter(urlPrefix = SML.uri, name = "replace", comment = "Replace context flag. Default value is false.")
@@ -62,9 +62,9 @@ ExecutionContext executeSelf() {
List questions = getQuestions(inpModel, isProcessNonRootQuestions);
- LOG.debug("Found {} questions.", questions.size());
- if (LOG.isTraceEnabled()) {
- LOG.trace("Found questions: {}", questions);
+ log.debug("Found {} questions.", questions.size());
+ if (log.isTraceEnabled()) {
+ log.trace("Found questions: {}", questions);
}
Model constructedModel = ModelFactory.createDefaultModel();
diff --git a/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/FetchPossibleValuesModule.java b/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/FetchPossibleValuesModule.java
index c88501e1..3d3012c0 100644
--- a/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/FetchPossibleValuesModule.java
+++ b/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/FetchPossibleValuesModule.java
@@ -7,22 +7,20 @@
import cz.cvut.spipes.engine.ExecutionContext;
import cz.cvut.spipes.form.JenaFormUtils;
import cz.cvut.spipes.modules.annotations.SPipesModule;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.util.HashMap;
import java.util.Map;
+@Slf4j
@SPipesModule(label = "fetch possible values", comment =
"Fetches possible values for answers of questions. Inputs are forms using Q&A model. Possible values of " +
"questions are added to questions that does not have any value attached and contains possible value query."
)
public class FetchPossibleValuesModule extends AnnotatedAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(FetchPossibleValuesModule.class);
private static final String TYPE_URI = KBSS_MODULE.uri + "fetch-possible-values";
@Parameter(urlPrefix = SML.uri, name = "replace", comment = "Specifies whether a module should overwrite triples" +
@@ -50,11 +48,11 @@ ExecutionContext executeSelf() {
PossibleValuesQueryProcessor qProcessor = query2possibleValue.get(possibleValuesQuery);
if (qProcessor == null) {
qProcessor = new PossibleValuesQueryProcessor(possibleValuesQuery);
- LOG.debug("Retrieved {} new possible values for question {}.",
+ log.debug("Retrieved {} new possible values for question {}.",
qProcessor.getPossibleValuesCount(), q.getURI());
query2possibleValue.put(possibleValuesQuery, qProcessor);
} else {
- LOG.debug("Using cache of {} possible values for question {}.",
+ log.debug("Using cache of {} possible values for question {}.",
qProcessor.getPossibleValuesCount(), q.getURI());
}
qProcessor.addQuestion(q);
diff --git a/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/MergeFormMetadataModule.java b/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/MergeFormMetadataModule.java
index c70b3b07..d7a52c6f 100644
--- a/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/MergeFormMetadataModule.java
+++ b/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/MergeFormMetadataModule.java
@@ -7,15 +7,14 @@
import cz.cvut.spipes.engine.ExecutionContext;
import cz.cvut.spipes.form.JenaFormUtils;
import cz.cvut.spipes.modules.annotations.SPipesModule;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.util.ResourceUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.util.Random;
+@Slf4j
@SPipesModule(label = "merge form metadata", comment =
"Merges form metadata. Inputs are sample form and Q&A model. Questions from both models are remapped to new" +
" IRIs based on question origin combined with executionId. New question instances are created using" +
@@ -23,7 +22,6 @@
)
public class MergeFormMetadataModule extends AnnotatedAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(MergeFormMetadataModule.class);
private static final Random RANDOM = new Random();
private static final String TYPE_URI = KBSS_MODULE.uri + "merge-form-metadata";
@@ -64,8 +62,8 @@ ExecutionContext executeSelf() {
.replace(QUESTION_ORIGIN_HASH_VAR, originHash)
.replace(EXECUTION_ID_VAR, executionId);
if (!q.getURI().equals(newQuestionUrl)) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Renaming questions {} -> {}", q, newQuestionUrl);
+ if (log.isTraceEnabled()) {
+ log.trace("Renaming questions {} -> {}", q, newQuestionUrl);
}
ResourceUtils.renameResource(q, newQuestionUrl);
}
diff --git a/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/PossibleValuesQueryProcessor.java b/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/PossibleValuesQueryProcessor.java
index d6f675ba..374d09e7 100644
--- a/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/PossibleValuesQueryProcessor.java
+++ b/s-pipes-modules/module-form/src/main/java/cz/cvut/spipes/modules/PossibleValuesQueryProcessor.java
@@ -1,11 +1,10 @@
package cz.cvut.spipes.modules;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.util.FileUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@@ -19,9 +18,9 @@
import java.util.LinkedList;
import java.util.List;
+@Slf4j
class PossibleValuesQueryProcessor {
- private static final Logger LOG = LoggerFactory.getLogger(PossibleValuesQueryProcessor.class);
String possibleValuesQuery;
String retrievedPossibleValues;
Model possibleValuesModel;
@@ -49,7 +48,7 @@ private String fetchPossibleValues(String possibleValueQuery) {
String.class);
return result.getBody();
} catch (Exception e) {
- LOG.error("Error when requesting remote data, url: {}.", urlWithQuery, e);
+ log.error("Error when requesting remote data, url: {}.", urlWithQuery, e);
}
return null;
}
diff --git a/s-pipes-modules/module-nlp/pom.xml b/s-pipes-modules/module-nlp/pom.xml
index 4b388f31..116360c3 100644
--- a/s-pipes-modules/module-nlp/pom.xml
+++ b/s-pipes-modules/module-nlp/pom.xml
@@ -62,6 +62,11 @@
0.4.0
test
+
+ org.projectlombok
+ lombok
+ provided
+
diff --git a/s-pipes-modules/module-nlp/src/main/java/cz/cvut/spipes/modules/SUTimeModule.java b/s-pipes-modules/module-nlp/src/main/java/cz/cvut/spipes/modules/SUTimeModule.java
index dd7b1e16..2395d264 100644
--- a/s-pipes-modules/module-nlp/src/main/java/cz/cvut/spipes/modules/SUTimeModule.java
+++ b/s-pipes-modules/module-nlp/src/main/java/cz/cvut/spipes/modules/SUTimeModule.java
@@ -19,6 +19,7 @@
import java.time.format.DateTimeFormatter;
import java.util.*;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.*;
import org.apache.jena.vocabulary.RDF;
import org.slf4j.Logger;
@@ -27,12 +28,10 @@
import java.nio.file.Path;
import java.nio.file.Paths;
-
+@Slf4j
@SPipesModule(label = "temporal v0.1", comment = "Annotate temporal expressions in literals in input model.")
public class SUTimeModule extends AbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(SUTimeModule.class);
-
public static final String TYPE_URI = KBSS_MODULE.getURI() + "temporal-v0.1";
@Parameter(urlPrefix = DescriptorModel.prefix, name = "has-rule-file", comment = "Rule file, multivalued.") // TODO - revise comment
@@ -173,10 +172,10 @@ private ArrayList temporalAnalysis(AnnotationPipeline pipeline, Str
afm = new AnnforModel(beginDateforModel, endDateforModel, typeDateforModel, extractionDateforModel);
} catch (NullPointerException e) {
- LOG.info("catched in temporalAnalyze " + e.getMessage());
+ log.info("catched in temporalAnalyze " + e.getMessage());
} catch (ParseException e) {
- LOG.info("catched in parse exception " + e.getMessage());
+ log.info("catched in parse exception " + e.getMessage());
}
afmArr = new ArrayList<>();
afmArr.add(afm);
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 605880da..35dd2e1a 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
@@ -15,6 +15,7 @@
import edu.stanford.nlp.time.TimeAnnotator;
import edu.stanford.nlp.time.TimeExpression;
import edu.stanford.nlp.util.CoreMap;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryFactory;
import org.apache.jena.query.QuerySolution;
@@ -33,12 +34,10 @@
import java.text.SimpleDateFormat;
import java.util.*;
-
+@Slf4j
@SPipesModule(label = "temporal-v1", comment = "Module annotates input triples using NLP analysis of time using library SUTime.")
public class SUTimeModuleNew extends AbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(SUTimeModuleNew.class);
-
private static final String TYPE_URI = KBSS_MODULE.uri + "temporal-v1";
private static final String TYPE_PREFIX = TYPE_URI + "/";
private static final int DEFAULT_PAGE_SIZE = 10000;
@@ -158,7 +157,7 @@ public ExecutionContext executeSelf() {
private Model analyzeModel(Model m) {
- LOG.debug("Extracting temporal information from model of size {}", m.size());
+ log.debug("Extracting temporal information from model of size {}", m.size());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
List temporalAnnotationStmts = new LinkedList<>();
m.listStatements()
@@ -260,10 +259,10 @@ private ArrayList temporalAnalysis(AnnotationPipeline pipeline, Str
afm = new AnnforModel(beginDateforModel, endDateforModel, typeDateforModel, extractionDateforModel);
} catch (NullPointerException e) {
- LOG.info("catched in temporalAnalyze " + e.getMessage());
+ log.info("catched in temporalAnalyze " + e.getMessage());
} catch (ParseException e) {
- LOG.info("catched in parse exception " + e.getMessage());
+ log.info("catched in parse exception " + e.getMessage());
}
afmArr = new ArrayList<>();
afmArr.add(afm);
@@ -290,7 +289,7 @@ private AnnotationPipeline loadPipeline() {
private String substituteQueryMarkers(int currentIteration, String queryStr) {
int offset = pageSize * (currentIteration - 1);
- LOG.debug("Creating query with LIMIT {} for OFFSET {}.", pageSize, offset);
+ log.debug("Creating query with LIMIT {} for OFFSET {}.", pageSize, offset);
String markerValue = "\n" + "OFFSET " + offset
+ "\n" + "LIMIT " + pageSize + "\n";
diff --git a/s-pipes-modules/module-rdf4j/pom.xml b/s-pipes-modules/module-rdf4j/pom.xml
index f8920ff7..8ef2d0d5 100644
--- a/s-pipes-modules/module-rdf4j/pom.xml
+++ b/s-pipes-modules/module-rdf4j/pom.xml
@@ -55,6 +55,12 @@
test
+
+ org.projectlombok
+ lombok
+ provided
+
+
diff --git a/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jCreateRepositoryModule.java b/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jCreateRepositoryModule.java
index 8faf53fe..f8f9ef0c 100644
--- a/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jCreateRepositoryModule.java
+++ b/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jCreateRepositoryModule.java
@@ -4,6 +4,7 @@
import cz.cvut.spipes.engine.ExecutionContext;
import cz.cvut.spipes.exceptions.RepositoryAlreadyExistsException;
import cz.cvut.spipes.modules.annotations.SPipesModule;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.ResourceFactory;
import org.eclipse.rdf4j.repository.config.RepositoryConfig;
@@ -11,14 +12,12 @@
import org.eclipse.rdf4j.repository.manager.RepositoryManager;
import org.eclipse.rdf4j.repository.sail.config.SailRepositoryConfig;
import org.eclipse.rdf4j.sail.nativerdf.config.NativeStoreConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.Objects;
+@Slf4j
@SPipesModule(label = "rdf4j create repository", comment = "Module creates native store rdf4j repository on the given server with the given name.")
public class Rdf4jCreateRepositoryModule extends AbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(Rdf4jCreateRepositoryModule.class.getName());
private static final String TYPE_URI = KBSS_MODULE.uri + "rdf4j-create-repository";
private static final String PROPERTY_PREFIX_URI = KBSS_MODULE.uri + "rdf4j";
@@ -77,14 +76,14 @@ ExecutionContext executeSelf() {
SailRepositoryConfig sailRepositoryConfig = new SailRepositoryConfig(nativeStoreConfig);
repositoryManager.init();
- LOG.info("Server url:{}, Repsitory name:{}, Ignore if repository exist:{}.",
+ log.info("Server url:{}, Repsitory name:{}, Ignore if repository exist:{}.",
rdf4jServerURL,
rdf4jRepositoryName,
rdf4jIgnoreIfExists);
if((!rdf4jIgnoreIfExists) && repositoryManager.hasRepositoryConfig(rdf4jRepositoryName)){
- LOG.info("Repository \"{}\" already exists",
+ log.info("Repository \"{}\" already exists",
rdf4jRepositoryName);
throw new RepositoryAlreadyExistsException(rdf4jRepositoryName);
}
diff --git a/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jDeployModule.java b/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jDeployModule.java
index 1aed700f..01e8d597 100644
--- a/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jDeployModule.java
+++ b/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jDeployModule.java
@@ -6,6 +6,7 @@
import cz.cvut.spipes.exception.ModuleConfigurationInconsistentException;
import cz.cvut.spipes.modules.annotations.SPipesModule;
import cz.cvut.spipes.util.CoreConfigProperies;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.query.Dataset;
import org.apache.jena.query.DatasetFactory;
import org.apache.jena.rdf.model.Model;
@@ -27,9 +28,6 @@
import org.eclipse.rdf4j.rio.RDFParseException;
import org.eclipse.rdf4j.sail.nativerdf.config.NativeStoreConfig;
import org.jetbrains.annotations.NotNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import javax.annotation.Nullable;
import java.io.IOException;
import java.io.StringReader;
@@ -37,14 +35,13 @@
import java.util.ArrayList;
import java.util.Optional;
+@Slf4j
@SPipesModule(label = "deploy", comment =
"Module deploys content of input execution context into default context of repository (if p-rdf4j-context-iri " +
"is not specified) or concrete context (if p-rdf4j-context-iri is specified)."
)
public class Rdf4jDeployModule extends AbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(Rdf4jDeployModule.class);
-
private final static String TYPE_URI = KBSS_MODULE.uri + "deploy";
private final static String PROPERTY_PREFIX_URI = KBSS_MODULE.uri + "rdf4j";
@@ -128,7 +125,7 @@ public void setReplaceContext(boolean replaceContext) {
@Override
ExecutionContext executeSelf() {
- LOG.debug("Deploying data into {} of rdf4j server repository {}/{}.",
+ log.debug("Deploying data into {} of rdf4j server repository {}/{}.",
getContextsInfo(),
rdf4jServerURL,
rdf4jRepositoryName);
@@ -136,7 +133,7 @@ ExecutionContext executeSelf() {
try {
if (repository == null) {
- LOG.info("Creating new repository {} within rdf4j server {} ...",
+ log.info("Creating new repository {} within rdf4j server {} ...",
rdf4jServerURL, rdf4jRepositoryName);
RepositoryConfig repConfig = new RepositoryConfig(rdf4jRepositoryName);
SailRepositoryConfig config = new SailRepositoryConfig(new NativeStoreConfig());
@@ -148,7 +145,7 @@ ExecutionContext executeSelf() {
Dataset dataset = createDataset(executionContext.getDefaultModel(), rdf4jContextIRI, inferContextIRIs);
if (dataset.isEmpty()) {
- LOG.info("No triples found to deploy.");
+ log.info("No triples found to deploy.");
return ExecutionContextFactory.createContext(executionContext.getDefaultModel());
}
@@ -171,20 +168,20 @@ ExecutionContext executeSelf() {
connection.add(new StringReader(w.getBuffer().toString()), "", RDFFormat.NQUADS);
connection.commit();
} catch (final RepositoryException | RDFParseException | RepositoryConfigException | IOException e) {
- LOG.error(e.getMessage(),e);
+ log.error(e.getMessage(),e);
} finally {
try {
if (connection != null && connection.isOpen()) {
connection.close();
}
} catch (RepositoryException e) {
- LOG.error(e.getMessage(), e);
+ log.error(e.getMessage(), e);
} finally {
if ((repository != null) && (repository.isInitialized())) {
try {
repository.shutDown();
} catch (RepositoryException e) {
- LOG.error("During finally: ", e);
+ log.error("During finally: ", e);
}
}
}
@@ -206,7 +203,7 @@ ExecutionContext executeSelf() {
static Dataset createDataset(@NotNull Model model, String outputGraphId, boolean inferGraphsFromAnnotatedModel) {
boolean isOutputGraphSpecified = (outputGraphId != null) && (!outputGraphId.isEmpty());
if (isOutputGraphSpecified && inferGraphsFromAnnotatedModel) {
- LOG.error("Module is set to deploy in one context as well as infer contexts from annotated model. " +
+ log.error("Module is set to deploy in one context as well as infer contexts from annotated model. " +
"Thus, ignoring deploy of triples.");
return DatasetFactory.create();
}
@@ -267,7 +264,7 @@ public void loadConfiguration() {
}
repository = repositoryManager.getRepository(rdf4jRepositoryName);
inferContextIRIs = getPropertyValue(P_RDF4J_INFER_CONTEXT_IRIS,false);
- LOG.debug("Inferring contexts from annotated input triples.");
+ log.debug("Inferring contexts from annotated input triples.");
}
private static @Nullable String getConfigurationVariable(String variableName) {
if (variableName == null) {
diff --git a/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jUpdateModule.java b/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jUpdateModule.java
index 141d0954..794d3c6c 100644
--- a/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jUpdateModule.java
+++ b/s-pipes-modules/module-rdf4j/src/main/java/cz/cvut/spipes/modules/Rdf4jUpdateModule.java
@@ -7,6 +7,7 @@
import cz.cvut.spipes.exceptions.RepositoryAccessException;
import cz.cvut.spipes.modules.annotations.SPipesModule;
import cz.cvut.spipes.util.QueryUtils;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.Resource;
@@ -20,18 +21,16 @@
import org.eclipse.rdf4j.repository.RepositoryConnection;
import org.eclipse.rdf4j.repository.RepositoryException;
import org.eclipse.rdf4j.repository.sparql.SPARQLRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.topbraid.spin.vocabulary.SP;
import java.util.List;
import java.util.stream.Collectors;
+@Slf4j
@SPipesModule(label = "rdf4j update", comment = "Updates sparql endpoint configured in rdf4jServerURL" +
" using specified list updateQueries. The list of queries can be executed multiple times specified by " +
" `has-max-iteration-count` property.")
public class Rdf4jUpdateModule extends AbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(Rdf4jUpdateModule.class.getName());
private static final String TYPE_URI = KBSS_MODULE.uri + "rdf4j-update";
private static final String PROPERTY_PREFIX_URI = KBSS_MODULE.uri + "rdf4j";
@@ -125,19 +124,19 @@ private static Property getParameter(final String name) {
@Override
ExecutionContext executeSelf() {
try (RepositoryConnection updateConnection = updateRepository.getConnection()) {
- LOG.debug("Connected to {}", rdf4jRepositoryName);
+ log.debug("Connected to {}", rdf4jRepositoryName);
long newTriplesCount = updateConnection.size();
long oldTriplesCount;
- LOG.debug("Number of triples before execution of updates: {}", newTriplesCount);
+ log.debug("Number of triples before execution of updates: {}", newTriplesCount);
for(int i = 0;i < iterationCount; i++) {
oldTriplesCount = newTriplesCount;
for (int j = 0; j < updateQueries.size(); j++) {
String updateQuery = updateQueries.get(j);
- if (LOG.isTraceEnabled()) {
+ if (log.isTraceEnabled()) {
String queryComment = QueryUtils.getQueryComment(updateQuery);
- LOG.trace(
+ log.trace(
"Executing iteration {}/{} with {}/{} query \"{}\" ...",
i+1, iterationCount, j + 1, updateQueries.size(), queryComment
);
@@ -145,11 +144,11 @@ ExecutionContext executeSelf() {
makeUpdate(updateQuery, updateConnection);
}
newTriplesCount = updateConnection.size();
- LOG.debug("Number of triples after finishing iteration {}/{}: {}",
+ log.debug("Number of triples after finishing iteration {}/{}: {}",
i+1, iterationCount, newTriplesCount
);
if (onlyIfTripleCountChanges && (newTriplesCount == oldTriplesCount)) {
- LOG.debug("Stopping execution of iterations as triples count did not change.");
+ log.debug("Stopping execution of iterations as triples count did not change.");
break;
}
}
@@ -165,20 +164,20 @@ void makeUpdate(String updateString, RepositoryConnection updateConnection) {
try {
prepareUpdate = updateConnection.prepareUpdate(QueryLanguage.SPARQL, updateString);
} catch (MalformedQueryException e) {
- LOG.error("Malformed Query, query text:\n{}",
+ log.error("Malformed Query, query text:\n{}",
updateString);
return;
} catch (RepositoryException e) {
- LOG.error("Repository exception\n{}",
+ log.error("Repository exception\n{}",
e.getMessage());
return;
}
try {
assert prepareUpdate != null;
prepareUpdate.execute();
- LOG.debug("Update successful");
+ log.debug("Update successful");
} catch (UpdateExecutionException e) {
- LOG.error("Update execution exception, query text:\n{}\n{}",
+ log.error("Update execution exception, query text:\n{}\n{}",
updateString,
e.getMessage());
}
@@ -195,7 +194,7 @@ public void loadConfiguration() {
rdf4jRepositoryName = getEffectiveValue(P_RDF4J_REPOSITORY_NAME).asLiteral().getString();
iterationCount = getPropertyValue(KBSS_MODULE.has_max_iteration_count,1);
onlyIfTripleCountChanges = getPropertyValue(P_RDF4J_STOP_ITERATION_ON_STABLE_TRIPLE_COUNT,false);
- LOG.debug("Iteration count={}\nOnlyIf...Changes={}"
+ log.debug("Iteration count={}\nOnlyIf...Changes={}"
,iterationCount
,onlyIfTripleCountChanges);
if (updateRepository != null && rdf4jServerURL != null) {
diff --git a/s-pipes-modules/module-sparql-endpoint/pom.xml b/s-pipes-modules/module-sparql-endpoint/pom.xml
index 12baa73c..9a52eaac 100644
--- a/s-pipes-modules/module-sparql-endpoint/pom.xml
+++ b/s-pipes-modules/module-sparql-endpoint/pom.xml
@@ -25,6 +25,12 @@
${org.apache.jena}
+
+ org.projectlombok
+ lombok
+ provided
+
+
org.junit.jupiter
diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/ModelLogger.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/ModelLogger.java
index 6d2ea028..39c0a383 100644
--- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/ModelLogger.java
+++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/ModelLogger.java
@@ -3,14 +3,15 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
+
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.util.FileUtils;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+@Slf4j
public class ModelLogger {
- private static final Logger LOG = LoggerFactory.getLogger(ModelLogger.class);
private Logger classLogger;
private String logDirectoryPrefix = "";
private Path logDirectory;
@@ -28,7 +29,7 @@ public void trace(String modelId, Model model) {
classLogger.trace("Saving model with id " + modelId + " to " + filePath);
model.write(Files.newOutputStream(filePath), FileUtils.langTurtle);
} catch (IOException e) {
- LOG.warn("Unnable to save model to " + filePath);
+ log.warn("Unnable to save model to " + filePath);
}
}
}
@@ -39,7 +40,7 @@ private Path getLogDirectory() {
logDirectory = Files.createTempDirectory(logDirectoryPrefix);
}
} catch (IOException e) {
- LOG.warn("Unnable to create temporary directory with prefix " + logDirectoryPrefix);
+ log.warn("Unnable to create temporary directory with prefix " + logDirectoryPrefix);
}
return logDirectory;
}
diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/impl/GraphChunkedDownload.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/impl/GraphChunkedDownload.java
index 95e0a1a1..c46b44c6 100644
--- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/impl/GraphChunkedDownload.java
+++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/impl/GraphChunkedDownload.java
@@ -1,13 +1,12 @@
package cz.cvut.spipes.impl;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.query.QueryExecutionFactory;
import org.apache.jena.rdf.model.Model;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+@Slf4j
public abstract class GraphChunkedDownload {
-
- private static final Logger LOG = LoggerFactory.getLogger(GraphChunkedDownload.class);
private static final int DEFAULT_PAGE_SIZE = 10000;
@@ -34,7 +33,7 @@ public GraphChunkedDownload(String endpointUrl, String namedGrapheId, int pageSi
public void execute() {
long offset = 0;
while (true) {
- LOG.debug("Executing query for offset: {}", offset);
+ log.debug("Executing query for offset: {}", offset);
String query = prepareQuery(offset);
Model model = executeQuery(query);
if (model.isEmpty()) {
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 0f20bd16..01144dcc 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
@@ -5,14 +5,13 @@
import cz.cvut.spipes.engine.ExecutionContext;
import cz.cvut.spipes.util.JenaUtils;
import cz.cvut.spipes.util.QueryUtils;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryFactory;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.topbraid.spin.arq.ARQFactory;
import org.topbraid.spin.model.Construct;
import org.topbraid.spin.system.SPINModuleRegistry;
@@ -20,9 +19,9 @@
import java.util.List;
+@Slf4j
public abstract class ApplyConstructAbstractModule extends AnnotatedAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(ApplyConstructAbstractModule.class);
private static final String TYPE_URI = KBSS_MODULE.uri + "abstract-apply-construct";
private static final String PROPERTY_PREFIX_URI = KBSS_MODULE.uri + "";
//sml:constructQuery
@@ -181,7 +180,7 @@ public void loadConfiguration() {
// TODO does not work with string query as object is not RDF resource ???
constructQueries = getResourcesByProperty(SML.constructQuery);
- LOG.debug("Loaded {} spin construct queries.", constructQueries.size());
+ log.debug("Loaded {} spin construct queries.", constructQueries.size());
//TODO default value must be taken from template definition
isReplace = this.getPropertyValue(SML.replace, false);
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 5d34f56c..adffba66 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
@@ -11,8 +11,6 @@
@SPipesModule(label = "apply construct v2", comment = "Generates triples from input model using specified constructQueries.")
public class ApplyConstructV2Module extends ApplyConstructAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(ApplyConstructV2Module.class);
-
private static final String TYPE_URI = KBSS_MODULE.uri + "apply-construct-v2";
@Override
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 09f92abb..b77322b9 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
@@ -9,6 +9,7 @@
import cz.cvut.spipes.recursion.QueryTemplateRecursionProvider;
import cz.cvut.spipes.recursion.ScrollableCursorProvider;
import cz.cvut.spipes.util.QueryUtils;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
@@ -18,8 +19,6 @@
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.ResourceFactory;
import org.jetbrains.annotations.NotNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.topbraid.spin.arq.ARQFactory;
import org.topbraid.spin.model.Select;
@@ -28,11 +27,10 @@
* TODO issue with redundant call {@link ScrollableCursorProvider}
* TODO supports only one CONSTRUCT query
*/
+@Slf4j
@SPipesModule(label = "apply construct with chunked values and scrollable cursor", comment = "Apply construct with chunked values and scrollable cursor")
public class ApplyConstructWithChunkedValuesAndScrollableCursorModule extends ApplyConstructAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(ApplyConstructWithChunkedValuesAndScrollableCursorModule.class);
-
private static final String TYPE_URI = KBSS_MODULE.uri + "apply-construct-with-chunked-values-and-scrollable-cursor";
private static final String TYPE_PREFIX = TYPE_URI + "/";
private static final int DEFAULT_CHUNK_SIZE = 10;
@@ -81,14 +79,14 @@ private ResultSet getSelectQueryResultSet() {
QueryExecution execution = QueryExecutionFactory.create(query, executionContext.getDefaultModel(), inputBindings);
- LOG.debug("Executing query of chunk provider ...");
+ log.debug("Executing query of chunk provider ...");
ResultSet selectResultSet = execution.execSelect();
VariablesBinding variablesBinding = new VariablesBinding();
if (!selectResultSet.hasNext()) {
- LOG.debug("\"{}\" query did not return any values.", getLabel());
+ log.debug("\"{}\" query did not return any values.", getLabel());
}
return selectResultSet;
}
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 d505afad..b94efd06 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
@@ -6,6 +6,8 @@
import cz.cvut.spipes.modules.annotations.SPipesModule;
import cz.cvut.spipes.util.QueryUtils;
import java.util.Objects;
+
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
@@ -15,19 +17,16 @@
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.ResourceFactory;
import org.jetbrains.annotations.NotNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.topbraid.spin.arq.ARQFactory;
import org.topbraid.spin.model.Select;
/**
* TODO Order of queries is not enforced.
*/
+@Slf4j
@SPipesModule(label = "apply construct with chunked values", comment = "Apply construct with chunked values.")
public class ApplyConstructWithChunkedValuesModule extends ApplyConstructAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(ApplyConstructWithChunkedValuesModule.class);
-
private static final String TYPE_URI = KBSS_MODULE.uri + "";
private static final String TYPE_PREFIX = TYPE_URI + "/";
private static final int DEFAULT_CHUNK_SIZE = 10;
@@ -72,14 +71,14 @@ public void initializeQuery() {
QueryExecution execution = QueryExecutionFactory.create(query, executionContext.getDefaultModel(), inputBindings);
- LOG.debug("Executing query of chunk provider ...");
+ log.debug("Executing query of chunk provider ...");
selectResultSet = execution.execSelect();
VariablesBinding variablesBinding = new VariablesBinding();
if (! selectResultSet.hasNext()) {
- LOG.debug("\"{}\" query did not return any values.", getLabel());
+ log.debug("\"{}\" query did not return any values.", getLabel());
}
}
@@ -109,7 +108,7 @@ protected String substituteQueryMarkers(int currentIteration, String queryStr) {
String markerValue = QueryUtils.nextResultsToValuesClause(getCurrentResultSetInstance(), chunkSize);
- LOG.debug("Creating query with values clause: \n{}.", markerValue );
+ log.debug("Creating query with values clause: \n{}.", markerValue );
return QueryUtils
.substituteMarkers(VALUES_CLAUSE_MARKER_NAME,
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 bf6754f5..79ed2a6c 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
@@ -3,15 +3,15 @@
import cz.cvut.spipes.constants.KBSS_MODULE;
import cz.cvut.spipes.modules.annotations.SPipesModule;
import cz.cvut.spipes.util.QueryUtils;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.ResourceFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* TODO Order of queries is not enforced.
*/
+@Slf4j
@SPipesModule(label = "apply construct with scrollable cursor",
comment = "Runs one or more construct queries (bound to sml:constructQuery) on the input triples. Queries are " +
"executed multiple times with scrollable cursor that is injected through query marker #${LIMIT_OFFSET}. " +
@@ -20,8 +20,6 @@
"the input triples.")
public class ApplyConstructWithScrollableCursorModule extends ApplyConstructAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(ApplyConstructWithScrollableCursorModule.class);
-
private static final String TYPE_URI = KBSS_MODULE.uri + "apply-construct-with-scrollable-cursor";
private static final String TYPE_PREFIX = TYPE_URI + "/";
private static final int DEFAULT_PAGE_SIZE = 10000;
@@ -68,7 +66,7 @@ protected boolean shouldTerminate(int currentIteration, Model previousInferredMo
protected String substituteQueryMarkers(int currentIteration, String queryStr) {
int offset = pageSize * (currentIteration - 1);
- LOG.debug("Creating query with LIMIT {} for OFFSET {}.", pageSize, offset );
+ log.debug("Creating query with LIMIT {} for OFFSET {}.", pageSize, offset );
String markerValue = "\n" + "OFFSET " + offset
+ "\n" + "LIMIT " + pageSize + "\n";
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 587473b5..04bcb835 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
@@ -12,20 +12,18 @@
import java.nio.file.Path;
import cz.cvut.spipes.modules.annotations.SPipesModule;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.riot.Lang;
import org.apache.jena.riot.RDFDataMgr;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+@Slf4j
@SPipesModule(label = "sparql endpoint download graph", comment = "Downloads named graph namedGraphId from sparql endpoint endpointUrl.")
public class DownloadGraphModule extends AnnotatedAbstractModule {
private static final String TYPE_URI = KBSS_MODULE.uri + "sparql-endpoint-download-graph";
private static final String TYPE_PREFIX = TYPE_URI + "/";
private static final int DEFAULT_PAGE_SIZE = 10000;
- private static final Logger LOG = LoggerFactory.getLogger(DownloadGraphModule.class);
@Parameter(urlPrefix = TYPE_PREFIX, name = "named-graph-id", comment = "Named graph id")
private String namedGraphId;
@@ -96,7 +94,7 @@ ExecutionContext executeSelf() {
@Override
protected void processPartialModel(Model partialModel) {
numberOfDownloadedTriples += partialModel.size();
- LOG.trace("persisting partial download, {} triples from (<{}>,<{}>)",
+ log.trace("persisting partial download, {} triples from (<{}>,<{}>)",
partialModel.size(), endpointUrl, namedGraphId);
RDFDataMgr.write(os, partialModel, Lang.NTRIPLES);
}
@@ -120,7 +118,7 @@ private Path createTempFile() {
Path file;
try {
file = Files.createTempFile("downloaded-graph-", ".nt");
- LOG.trace("persisting downloaded graph (<{}>,<{}>), to file \"{}\"", endpointUrl, namedGraphId, file.toString());
+ log.trace("persisting downloaded graph (<{}>,<{}>), to file \"{}\"", endpointUrl, namedGraphId, file.toString());
} catch (IOException e) {
throw new RuntimeException("Could not create temporary file.", e);
}
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 626c6457..a8946413 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
@@ -22,6 +22,8 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryFactory;
import org.apache.jena.query.QueryParseException;
@@ -35,12 +37,11 @@
import org.apache.jena.rdf.model.ResourceFactory;
import org.apache.jena.util.FileUtils;
import org.jetbrains.annotations.NotNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* TODO Order of queries is not enforced.
*/
+@Slf4j
@SPipesModule(label = "improve spo with marginals", comment = "Constructs improved spo-summary descriptor with knowledge " +
"of provided marginals of weakly described resources. This module expects as an input graph computed spo-summary " +
"patterns (or possibly whole spo-summary descriptor) compliant with data provided in ?data-service-url. Within the " +
@@ -50,8 +51,6 @@
"knowledge of marginals.")
public class ImproveSPOWithMarginalsModule extends AnnotatedAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(ImproveSPOWithMarginalsModule.class);
-
private static final String MODULE_ID = "improve-spo-with-marginals";
private static final String TYPE_URI = KBSS_MODULE.uri + MODULE_ID;
private static final String TYPE_PREFIX = TYPE_URI + "/";
@@ -89,21 +88,21 @@ private static Model loadModelFromTemporaryFile(String fileName) {
@Override
ExecutionContext executeSelf() {
- final ModelLogger mLOG = new ModelLogger(MODULE_ID, LOG);
+ final ModelLogger mLOG = new ModelLogger(MODULE_ID, log);
final Model inputModel = executionContext.getDefaultModel();
final VariablesBinding inputVB = executionContext.getVariablesBinding();
- LOG.debug("Retrieving relevant snapshots ...");
+ log.debug("Retrieving relevant snapshots ...");
// TODO it should be taken from parameter somehow
Model relevantSnapshotsModel = retrieveRelevantSnapshots(executionContext.getVariablesBinding());
mLOG.trace("relevant-snapshots", relevantSnapshotsModel);
- LOG.debug("Loading marginals ...");
+ log.debug("Loading marginals ...");
Model marginalsModel = loadModelFromFile(marginalsFileUrl);
mLOG.trace("marginals", marginalsModel);
- LOG.debug("Loading marginal definitions ...");
+ log.debug("Loading marginal definitions ...");
Model marginalDefsModel = loadModelFromFile(marginalsDefsFileUrl);
mLOG.trace("marginal-defs", marginalDefsModel);
@@ -211,13 +210,13 @@ private Model getPatternData(ResultSet breakablePatternsRS, String spoPatternDat
// substitute values
String valuesStr = QueryUtils.nextResultsToValuesClause(breakablePatternsRS, 1);
- LOG.debug("Executing query to download patterns data with values: \n{}", valuesStr);
+ log.debug("Executing query to download patterns data with values: \n{}", valuesStr);
String patternDataQueryStr = QueryUtils.substituteMarkers("VALUES", valuesStr, spoPatternDataQueryTemplate);
Query patternDataQuery = parseQuery(patternDataQueryStr);
VariablesBinding variablesBinding = new VariablesBinding("dataServiceUrl", ResourceFactory.createResource(dataServiceUrl));
- LOG.trace("Pattern data query:\n" + patternDataQueryStr);
- LOG.trace("Variables bindings:" + variablesBinding);
+ log.trace("Pattern data query:\n" + patternDataQueryStr);
+ log.trace("Variables bindings:" + variablesBinding);
Model patternDataModel = TDBTempFactory.createTDBModel();
patternDataModel = QueryUtils.execConstruct(// TODO !? implement scrollable cursor
patternDataQuery,
@@ -229,7 +228,7 @@ private Model getPatternData(ResultSet breakablePatternsRS, String spoPatternDat
private Model computeSPOWithWeight(Model spoPatternDataWithMarginalsModel, VariablesBinding variablesBinding) {
- LOG.debug("Computing SPO with weight for pattern data with marginals ...");
+ log.debug("Computing SPO with weight for pattern data with marginals ...");
Model spoModel = QueryUtils.execConstruct(
loadQueryFromFile("/compute-spo-with-weight.rq"),
spoPatternDataWithMarginalsModel,
@@ -239,7 +238,7 @@ private Model computeSPOWithWeight(Model spoPatternDataWithMarginalsModel, Varia
}
private Model computeSPOWithSnapshots(Model spoPatternDataWithMarginalsModel, VariablesBinding variablesBinding) {
- LOG.debug("Computing SPO with snapshots for pattern data with marginals ...");
+ log.debug("Computing SPO with snapshots for pattern data with marginals ...");
Model spoModel = QueryUtils.execConstruct(
loadQueryFromFile("/compute-spo-with-snapshots.rq"),
spoPatternDataWithMarginalsModel,
@@ -249,7 +248,7 @@ private Model computeSPOWithSnapshots(Model spoPatternDataWithMarginalsModel, Va
}
private Model computeMarginalTypesModel(Model patternDataModel, Model marginalWithDefsModel) {
- LOG.debug("Executing query to get typed marginals ...");
+ log.debug("Executing query to get typed marginals ...");
Model marginalTypesModel = QueryUtils.execConstruct(
loadQueryFromFile("/get-marginal-types.rq"),
ModelFactory.createUnion(patternDataModel, marginalWithDefsModel),
@@ -312,7 +311,7 @@ private Model loadModelFromFile(String marginalsFilePath) {
cachedModel.read(marginalsFilePath);
marginalDefsModelCache.put(key, cachedModel);
} else {
- LOG.debug("Using cached model of file {}", marginalsFilePath);
+ log.debug("Using cached model of file {}", marginalsFilePath);
}
return cachedModel;
}
@@ -321,7 +320,7 @@ private String computeFileContentHashKey(String filePath) {
try {
return filePath + " -- " + Files.getLastModifiedTime(Paths.get(URI.create(filePath))).toMillis();
} catch (IOException e) {
- LOG.warn("Could not access file from path " + filePath + ": " + e);
+ log.warn("Could not access file from path " + filePath + ": " + e);
throw new IllegalArgumentException("Could not access modification time of file from path " + filePath, e);
}
}
@@ -367,7 +366,7 @@ private String getFilePrefix() {
private void saveModelToTemporaryFile(Model model, String fileName) {
String filePath = getFilePrefix() + fileName;
try {
- LOG.debug("Saving model to temporary file " + filePath + " ...");
+ log.debug("Saving model to temporary file " + filePath + " ...");
model.write(new FileOutputStream(filePath), FileUtils.langTurtle);
} catch (IOException e) {
e.printStackTrace();
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 a244e22f..500c9304 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
@@ -5,18 +5,17 @@
import cz.cvut.spipes.engine.ExecutionContextFactory;
import cz.cvut.spipes.impl.GraphChunkedDownload;
import cz.cvut.spipes.modules.annotations.SPipesModule;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
// TODO - lable = SpEP retrieve graph
+@Slf4j
@SPipesModule(label = "sparql endpoint retrieve graph", comment = "Retrieves graph from sparql endpoint specified by " +
"?endpointUrl and optionaly ?namedGraphId. If ?namedGraphId is not specified it retreaves the default graph.")
public class RetrieveGraphModule extends AnnotatedAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(RetrieveGraphModule.class);
protected static final String TYPE_URI = KBSS_MODULE.uri + "sparql-endpoint-retrieve-graph";
private static final String TYPE_PREFIX = TYPE_URI + "/";
private static final int DEFAULT_PAGE_SIZE = 10000;
@@ -65,7 +64,7 @@ ExecutionContext executeSelf() {
GraphChunkedDownload downloader = new GraphChunkedDownload(endpointUrl, namedGraphId, pageSize) {
@Override
protected void processPartialModel(Model partialModel) {
- LOG.trace("persisting partial download, {} triples from (<{}>,<{}>)",
+ log.trace("persisting partial download, {} triples from (<{}>,<{}>)",
partialModel.size(), endpointUrl, namedGraphId);
outputModel.add(partialModel);
}
diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/ChunkedValuesProvider.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/ChunkedValuesProvider.java
index 221ba504..bea20bbb 100644
--- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/ChunkedValuesProvider.java
+++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/ChunkedValuesProvider.java
@@ -3,14 +3,15 @@
import cz.cvut.spipes.util.QueryUtils;
import java.util.Objects;
import java.util.Optional;
+
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.query.ResultSet;
import org.apache.jena.rdf.model.Model;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+@Slf4j
public class ChunkedValuesProvider implements QueryTemplateRecursionProvider {
- private static final Logger LOG = LoggerFactory.getLogger(ChunkedValuesProvider.class);
+
private static final String VALUES_CLAUSE_MARKER_NAME = "VALUES";
private final int iterationCount;
private ResultSet inputResultSet;
@@ -29,7 +30,7 @@ public ChunkedValuesProvider(ResultSet inputResultSet, Integer outputChunkSize,
public String substituteQueryMarkers(int currentIteration, String queryStr) {
String markerValue = QueryUtils.nextResultsToValuesClause(inputResultSet, outputChunkSize);
- LOG.debug("Creating query with values clause: \n{}.", markerValue);
+ log.debug("Creating query with values clause: \n{}.", markerValue);
return QueryUtils
.substituteMarkers(VALUES_CLAUSE_MARKER_NAME,
diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/CombinedQueryTemplateRecursionProvider.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/CombinedQueryTemplateRecursionProvider.java
index 922c8d09..6ae082a0 100644
--- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/CombinedQueryTemplateRecursionProvider.java
+++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/CombinedQueryTemplateRecursionProvider.java
@@ -3,13 +3,13 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
+
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+@Slf4j
public class CombinedQueryTemplateRecursionProvider implements QueryTemplateRecursionProvider {
-
- private static final Logger LOG = LoggerFactory.getLogger(CombinedQueryTemplateRecursionProvider.class);
+;
private final QueryTemplateRecursionProvider parentProvider;
private final QueryTemplateRecursionProvider childProvder;
private final int iterationCount;
@@ -37,7 +37,7 @@ public boolean shouldTerminate(int currentIteration, Model previousInferredModel
}
}
childIteration++;
- LOG.debug("Executing iteration {} --> ({}, {}).", currentIteration, parentIteration, childIteration);
+ log.debug("Executing iteration {} --> ({}, {}).", currentIteration, parentIteration, childIteration);
if (currentIteration == iterationCount) {
return true;
diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/ScrollableCursorProvider.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/ScrollableCursorProvider.java
index 46bb4a3a..26593f78 100644
--- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/ScrollableCursorProvider.java
+++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/recursion/ScrollableCursorProvider.java
@@ -1,16 +1,14 @@
package cz.cvut.spipes.recursion;
import cz.cvut.spipes.util.QueryUtils;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* TODO !!! scrolling detects one iteration later than it supposed to. If there is a knowledge about how many results a subquery with LIMIT+OFFSET returned, it would be more clear ...
*/
+@Slf4j
public class ScrollableCursorProvider implements QueryTemplateRecursionProvider {
- private static final Logger LOG = LoggerFactory.getLogger(ScrollableCursorProvider.class);
private static final String LIMIT_OFFSET_CLAUSE_MARKER_NAME = "LIMIT_OFFSET";
private final int pageSize;
private final int iterationCount;
@@ -43,7 +41,7 @@ public boolean shouldTerminate(int currentIteration, Model previousInferredModel
public String substituteQueryMarkers(int currentIteration, String queryStr) {
int offset = pageSize * (currentIteration - 1);
- LOG.debug("Creating query with LIMIT {} for OFFSET {}.", pageSize, offset );
+ log.debug("Creating query with LIMIT {} for OFFSET {}.", pageSize, offset );
String markerValue = "\n" + "OFFSET " + offset
+ "\n" + "LIMIT " + pageSize + "\n";
diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/tdb/TDBModelFinalizer.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/tdb/TDBModelFinalizer.java
index 5e19db01..49d05f9f 100644
--- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/tdb/TDBModelFinalizer.java
+++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/tdb/TDBModelFinalizer.java
@@ -4,14 +4,14 @@
import java.io.IOException;
import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;
+
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.jena.rdf.model.Model;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+@Slf4j
public class TDBModelFinalizer extends PhantomReference {
- private static final Logger LOG = LoggerFactory.getLogger(TDBModelFinalizer.class);
private final String datasetLocation;
public TDBModelFinalizer(Model referent, ReferenceQueue super Model> q) {
@@ -20,11 +20,11 @@ public TDBModelFinalizer(Model referent, ReferenceQueue super Model> q) {
}
public void finalizeResources() {
- LOG.debug("Removing temporary TDB dataset at directory {}.", datasetLocation);
+ log.debug("Removing temporary TDB dataset at directory {}.", datasetLocation);
try {
FileUtils.deleteDirectory(new File(datasetLocation));
} catch (IOException e) {
- LOG.error("Could not remove directory at {}, reason: {}.", datasetLocation, e);
+ log.error("Could not remove directory at {}, reason: {}.", datasetLocation, e);
}
}
}
diff --git a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/tdb/TDBTempFactory.java b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/tdb/TDBTempFactory.java
index e672e308..b2812cea 100644
--- a/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/tdb/TDBTempFactory.java
+++ b/s-pipes-modules/module-sparql-endpoint/src/main/java/cz/cvut/spipes/tdb/TDBTempFactory.java
@@ -11,23 +11,23 @@
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.jena.query.Dataset;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.tdb.TDBFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+@Slf4j
public class TDBTempFactory {
- private static final Logger LOG = LoggerFactory.getLogger(TDBTempFactory.class);
private static final ReferenceQueue referenceQueue = new ReferenceQueue<>();
private static final Set references = ConcurrentHashMap.newKeySet();
public static Model createTDBModel() {
finalizePhantomModels();
Path tempDir = getTempDir();
- LOG.debug("Creating temporary TDB dataset at directory {}.", tempDir);
+ log.debug("Creating temporary TDB dataset at directory {}.", tempDir);
Dataset ds = TDBFactory.createDataset(tempDir.toString());
Model outModel = ds.getNamedModel(getRandomModelUri());
setUpFinalization(outModel);
@@ -51,7 +51,7 @@ private static Path getTempDir() {
private static void setUpFinalization(Model tdbModel) {
String modelLocation = TDBModelHelper.getLocation(tdbModel);
- LOG.trace("Scheduling removal of directory {} on JVM exit.", modelLocation);
+ log.trace("Scheduling removal of directory {} on JVM exit.", modelLocation);
Runtime.getRuntime().addShutdownHook(new Thread(() -> FileUtils.deleteQuietly(new File(modelLocation))));
references.add(new TDBModelFinalizer(tdbModel, referenceQueue));
}
diff --git a/s-pipes-modules/module-tarql/pom.xml b/s-pipes-modules/module-tarql/pom.xml
index 40b7be70..d0606b17 100644
--- a/s-pipes-modules/module-tarql/pom.xml
+++ b/s-pipes-modules/module-tarql/pom.xml
@@ -57,5 +57,11 @@
junit-jupiter-api
test
+
+
+ org.projectlombok
+ lombok
+ provided
+
\ No newline at end of file
diff --git a/s-pipes-modules/module-tarql/src/main/java/cz/cvut/spipes/modules/ModuleTarql.java b/s-pipes-modules/module-tarql/src/main/java/cz/cvut/spipes/modules/ModuleTarql.java
index ad6e8bf6..46234a8f 100644
--- a/s-pipes-modules/module-tarql/src/main/java/cz/cvut/spipes/modules/ModuleTarql.java
+++ b/s-pipes-modules/module-tarql/src/main/java/cz/cvut/spipes/modules/ModuleTarql.java
@@ -4,24 +4,22 @@
import cz.cvut.spipes.engine.ExecutionContext;
import cz.cvut.spipes.engine.ExecutionContextFactory;
import cz.cvut.spipes.modules.annotations.SPipesModule;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Property;
import org.apache.jena.rdf.model.ResourceFactory;
import org.deri.tarql.tarql;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
+@Slf4j
@Deprecated //TODO merge with TarqlModule functionality
@SPipesModule(label = "tarql-XXX-2", comment = "Module to convert CSV file to RDF and query it using SPRQL query. The module wraps org.deri.tarql.tarql. This module is depracated.")
public class ModuleTarql extends AbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(ModuleTarql.class);
-
private static final String TYPE_URI = KBSS_MODULE.uri + "tarql" + "-XXX-2";
private static Property getParameter(final String name) {
@@ -48,7 +46,7 @@ private static Property getParameter(final String name) {
@Override
public ExecutionContext executeSelf() {
- LOG.info("Running TARQL on " + inputFile);
+ log.info("Running TARQL on " + inputFile);
Model model = ModelFactory.createDefaultModel();
try {
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 265a794b..8796779a 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
@@ -9,6 +9,7 @@
import cz.cvut.spipes.registry.StreamResource;
import cz.cvut.spipes.registry.StreamResourceRegistry;
import cz.cvut.spipes.util.QueryUtils;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.ext.com.google.common.io.Files;
import org.apache.jena.query.Query;
import org.apache.jena.rdf.model.Model;
@@ -16,8 +17,6 @@
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.util.FileUtils;
import org.deri.tarql.tarql;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.topbraid.spin.arq.ARQFactory;
import org.topbraid.spin.model.Construct;
@@ -29,11 +28,11 @@
import java.util.stream.Collectors;
// TODO merge with ModuleTarql functionality
+@Slf4j
@SPipesModule(label = "tarql", comment = "\"Runs one or more TARQL Construct queries on the input triples. The output RDF " +
"will consist of the constructed triples and (unless sml:replace is true) the input triples.\"")
public class TarqlModule extends AbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(TarqlModule.class);
//tarql [options] query.sparql [table.csv [...]]
private static final String TARQL_PROGRAM = AppConstants.BIN_DIR + "/tarql";
@@ -97,7 +96,7 @@ public ExecutionContext executeSelf() {
tabularDataFilePath = sourceFilePath;
}
- LOG.debug("Processing tabular data from file path {}.", tabularDataFilePath);
+ log.debug("Processing tabular data from file path {}.", tabularDataFilePath);
// set up variable bindings
for (Resource constructQueryRes : constructQueries) {
@@ -158,7 +157,7 @@ public void loadConfiguration() {
.map(st -> st.getObject().asResource())
.collect(Collectors.toList());
- LOG.debug("Loaded {} spin construct queries.", constructQueries.size());
+ log.debug("Loaded {} spin construct queries.", constructQueries.size());
//TODO default value must be taken from template definition
isReplace = this.getPropertyValue(SML.replace, false);
diff --git a/s-pipes-modules/module-text-analysis/pom.xml b/s-pipes-modules/module-text-analysis/pom.xml
index e7a7f4b5..40c58a6c 100644
--- a/s-pipes-modules/module-text-analysis/pom.xml
+++ b/s-pipes-modules/module-text-analysis/pom.xml
@@ -71,5 +71,10 @@
2.6
compile
+
+ org.projectlombok
+ lombok
+ provided
+
diff --git a/s-pipes-modules/module-text-analysis/src/main/java/cz/cvut/spipes/modules/ExtractTermOccurrencesModule.java b/s-pipes-modules/module-text-analysis/src/main/java/cz/cvut/spipes/modules/ExtractTermOccurrencesModule.java
index abe13e01..8026ddd2 100644
--- a/s-pipes-modules/module-text-analysis/src/main/java/cz/cvut/spipes/modules/ExtractTermOccurrencesModule.java
+++ b/s-pipes-modules/module-text-analysis/src/main/java/cz/cvut/spipes/modules/ExtractTermOccurrencesModule.java
@@ -72,8 +72,6 @@
)
public class ExtractTermOccurrencesModule extends AnnotatedAbstractModule {
- private static final Logger LOG = LoggerFactory.getLogger(ExtractTermOccurrencesModule.class);
-
private static final String TYPE_URI = KBSS_MODULE.uri + "extract-term-occurrences";
private static final String TYPE_PREFIX = 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 1f75e11e..4c683c64 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
@@ -6,6 +6,7 @@
import cz.cvut.spipes.modules.annotations.SPipesModule;
import cz.cvut.spipes.modules.constants.Termit;
import cz.cvut.spipes.util.QueryUtils;
+import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
@@ -21,8 +22,7 @@
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import org.topbraid.spin.arq.ARQFactory;
import org.topbraid.spin.model.Select;
@@ -34,6 +34,7 @@
import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
import static org.apache.commons.lang.StringEscapeUtils.unescapeHtml;
+@Slf4j
@SPipesModule(label = "Text analysis module", comment =
"Module for text analysis.\n" +
"\n" +
@@ -44,7 +45,6 @@
)
public class TextAnalysisModule extends AnnotatedAbstractModule{
- private static final Logger LOG = LoggerFactory.getLogger(TextAnalysisModule.class);
private static final String TYPE_URI = KBSS_MODULE.uri + "text-analysis";
private static final String TYPE_PREFIX = TYPE_URI + "/";
@@ -88,7 +88,7 @@ ExecutionContext executeSelf() {
Model outputModel = ModelFactory.createDefaultModel();
if (selectQuery == null) {
- LOG.warn("Select query is empty therefore returning input model.");
+ log.warn("Select query is empty therefore returning input model.");
return executionContext;
}
@@ -107,14 +107,14 @@ ExecutionContext executeSelf() {
RDFNode object = solution.get(variableBindings.next());
if (!object.isLiteral() || !(object.asLiteral().getDatatype() instanceof XSDBaseStringType)) {
- LOG.warn("Object {} is not a literal. Skipping.", object);
+ log.warn("Object {} is not a literal. Skipping.", object);
continue;
}
Literal literal = object.asLiteral();
String textElement = escapeHtml(literal.getString());
if (counter >= literalsPerRequest) {
- LOG.debug("Annotating {} literals. Progress {}%.", literalsPerRequest, totalCounter * 100L / inputModel.size());
+ log.debug("Annotating {} literals. Progress {}%.", literalsPerRequest, totalCounter * 100L / inputModel.size());
String annotatedText = annotateObjectLiteral(sb.toString());
String[] elements = splitAnnotatedText(annotatedText);
@@ -136,7 +136,7 @@ ExecutionContext executeSelf() {
}
if (counter > 0) {
- LOG.debug("Annotating {} literals. Progress {}%.", literalsPerRequest, totalCounter * 100L / inputModel.size());
+ log.debug("Annotating {} literals. Progress {}%.", literalsPerRequest, totalCounter * 100L / inputModel.size());
String annotatedText = annotateObjectLiteral(sb.toString());
String[] elements = splitAnnotatedText(annotatedText);
diff --git a/s-pipes-parent/pom.xml b/s-pipes-parent/pom.xml
index 6dadd6a5..71388053 100644
--- a/s-pipes-parent/pom.xml
+++ b/s-pipes-parent/pom.xml
@@ -29,6 +29,7 @@
5.2.0
2.21.0
2.7
+ 1.18.24
@@ -228,7 +229,8 @@
org.projectlombok
lombok
- 1.18.2
+ ${lombok.version}
+ provided
diff --git a/s-pipes-test/pom.xml b/s-pipes-test/pom.xml
index daa4a803..257dab71 100644
--- a/s-pipes-test/pom.xml
+++ b/s-pipes-test/pom.xml
@@ -34,5 +34,11 @@
org.junit.jupiter
junit-jupiter-api
+
+ org.projectlombok
+ lombok
+ provided
+
+
\ No newline at end of file
diff --git a/s-pipes-test/src/main/java/cz/cvut/spipes/test/JenaTestUtils.java b/s-pipes-test/src/main/java/cz/cvut/spipes/test/JenaTestUtils.java
index c8e6b58e..d583a68f 100644
--- a/s-pipes-test/src/main/java/cz/cvut/spipes/test/JenaTestUtils.java
+++ b/s-pipes-test/src/main/java/cz/cvut/spipes/test/JenaTestUtils.java
@@ -1,5 +1,6 @@
package cz.cvut.spipes.test;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.ontology.OntDocumentManager;
import org.apache.jena.ontology.OntModel;
import org.apache.jena.ontology.OntModelSpec;
@@ -17,10 +18,9 @@
import static org.junit.jupiter.api.Assertions.fail;
+@Slf4j
public class JenaTestUtils {
- private static Logger LOG = LoggerFactory.getLogger(JenaTestUtils.class);
-
public static void mapLocalSPipesDefinitionFiles() {
OntDocumentManager dm = OntDocumentManager.getInstance();
dm.setFileManager(FileManager.getInternal());
@@ -64,9 +64,9 @@ public static Model laodModelFromResource(String path) {
public static void assertIsomorphic(Model actualModel, Model expectedModel) {
if (!actualModel.isIsomorphicWith(expectedModel)) {
- LOG.debug("Saving actual model ... ");
+ log.debug("Saving actual model ... ");
saveModelToTemporaryFile(actualModel);
- LOG.debug("Saving expected model ... ");
+ log.debug("Saving expected model ... ");
saveModelToTemporaryFile(expectedModel);
fail("Actual model is not isomorphic with expected model (see additional information above).");
}
@@ -75,7 +75,7 @@ public static void assertIsomorphic(Model actualModel, Model expectedModel) {
private static void saveModelToTemporaryFile(Model model) {
try {
Path file = Files.createTempFile("model-output-", ".ttl");
- LOG.debug("Saving model to temporary file " + file.toString() + " ...");
+ log.debug("Saving model to temporary file " + file.toString() + " ...");
model.write(Files.newOutputStream(file.toFile().toPath()), FileUtils.langTurtle);
} catch (IOException e) {
e.printStackTrace();
diff --git a/s-pipes-web/pom.xml b/s-pipes-web/pom.xml
index 344a04ee..337940aa 100644
--- a/s-pipes-web/pom.xml
+++ b/s-pipes-web/pom.xml
@@ -24,6 +24,15 @@
+
+
+
+ org.projectlombok
+ lombok
+ provided
+
+
+
cz.cvut.kbss
diff --git a/s-pipes-web/src/main/java/cz/cvut/spipes/config/RDFMediaTypeConverter.java b/s-pipes-web/src/main/java/cz/cvut/spipes/config/RDFMediaTypeConverter.java
index 2de2502e..c1397060 100644
--- a/s-pipes-web/src/main/java/cz/cvut/spipes/config/RDFMediaTypeConverter.java
+++ b/s-pipes-web/src/main/java/cz/cvut/spipes/config/RDFMediaTypeConverter.java
@@ -1,6 +1,7 @@
package cz.cvut.spipes.config;
import cz.cvut.spipes.util.RDFMimeType;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.riot.RDFLanguages;
@@ -17,11 +18,10 @@
import java.io.IOException;
import java.util.List;
+@Slf4j
@Component
public class RDFMediaTypeConverter extends AbstractHttpMessageConverter {
- private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(RDFMediaTypeConverter.class);
-
public RDFMediaTypeConverter() {
super(
RDFMimeType.transform(RDFLanguages.N3),
@@ -33,7 +33,7 @@ public RDFMediaTypeConverter() {
}
private String getRDFLanguageForContentType( final HttpMessage m, final String defaultValue) {
- LOG.debug("Getting RDF Language for content type " + m + ", message: " + defaultValue);
+ log.debug("Getting RDF Language for content type " + m + ", message: " + defaultValue);
MediaType contentType = m.getHeaders().getContentType();
if ( contentType == null ) { contentType = MediaType.parseMediaType(defaultValue); }
return RDFLanguages.contentTypeToLang(contentType.toString().split(";")[0]).getLabel();
@@ -41,7 +41,7 @@ private String getRDFLanguageForContentType( final HttpMessage m, final String d
@Override
protected Object readInternal(Class aClass, HttpInputMessage httpInputMessage) throws IOException, HttpMessageNotReadableException {
- LOG.debug("Reading " + aClass + ", message: " + httpInputMessage.getHeaders());
+ log.debug("Reading " + aClass + ", message: " + httpInputMessage.getHeaders());
if ( ! aClass.isAssignableFrom( Model.class ) ) {
throw new UnsupportedOperationException();
}
@@ -52,11 +52,11 @@ protected Object readInternal(Class aClass, HttpInputMessage httpInputMessage) t
@Override
protected void writeInternal(Object o, HttpOutputMessage httpOutputMessage) throws IOException, HttpMessageNotWritableException {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Writing object " + o + ", message: " + httpOutputMessage.getHeaders());
+ if (log.isTraceEnabled()) {
+ log.trace("Writing object " + o + ", message: " + httpOutputMessage.getHeaders());
}
if (o instanceof Model) {
- LOG.debug("Writing model of size " + ((Model)o).size() + ", message: " + httpOutputMessage.getHeaders());
+ log.debug("Writing model of size " + ((Model)o).size() + ", message: " + httpOutputMessage.getHeaders());
} else {
throw new UnsupportedOperationException();
}
@@ -65,7 +65,7 @@ protected void writeInternal(Object o, HttpOutputMessage httpOutputMessage) thro
@Override
protected boolean supports(Class aClass) {
- LOG.debug("Supports {} ? ", aClass);
+ log.debug("Supports {} ? ", aClass);
return Model.class.isAssignableFrom(aClass);
}
}
diff --git a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesContextController.java b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesContextController.java
index 33edca72..02c8e44b 100644
--- a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesContextController.java
+++ b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesContextController.java
@@ -7,6 +7,7 @@
import cz.cvut.spipes.rest.util.ContextLoaderHelper;
import cz.cvut.spipes.rest.util.ScriptManagerFactory;
import cz.cvut.spipes.util.RDFMimeType;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.*;
import org.apache.jena.vocabulary.OWL;
import org.apache.jena.vocabulary.RDF;
@@ -19,12 +20,11 @@
import java.util.List;
import java.util.stream.Collectors;
+@Slf4j
@RestController
@EnableWebMvc
public class SPipesContextController {
-
- private static final Logger LOG = LoggerFactory.getLogger(SPipesServiceController.class);
private SPipesScriptManager scriptManager;
private List globalScripts;
private OntologyDocumentManager ontoDocManager;
diff --git a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesServiceController.java b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesServiceController.java
index 8feec825..bdf3e911 100644
--- a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesServiceController.java
+++ b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/SPipesServiceController.java
@@ -10,6 +10,7 @@
import cz.cvut.spipes.util.RDFMimeType;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.QuerySolutionMap;
import org.apache.jena.rdf.model.Model;
@@ -34,11 +35,11 @@
import java.util.*;
import java.util.stream.Collectors;
+@Slf4j
@RestController
@EnableWebMvc
public class SPipesServiceController {
- private static final Logger LOG = LoggerFactory.getLogger(SPipesServiceController.class);
private final ResourceRegisterHelper resourceRegisterHelper;
private final SPipesScriptManager scriptManager;
@@ -59,7 +60,7 @@ public SPipesServiceController() {
}
)
public Model processGetRequest(@RequestParam MultiValueMap parameters) {
- LOG.info("Processing GET request.");
+ log.info("Processing GET request.");
return runModule(ModelFactory.createDefaultModel(), parameters);
}
@@ -105,7 +106,7 @@ public Model processPostRequest(
String pOutputBindingURL,
@RequestParam MultiValueMap parameters
) {
- LOG.info("Processing POST request.");
+ log.info("Processing POST request.");
// TODO process internal params passed arguments not parameters map
return runModule(inputModel, parameters);
}
@@ -120,7 +121,7 @@ public Model processPostRequest(
}
)
public Model processServiceGetRequest(@RequestParam MultiValueMap parameters) {
- LOG.info("Processing service GET request.");
+ log.info("Processing service GET request.");
return runService(ModelFactory.createDefaultModel(), parameters);
}
@@ -152,10 +153,10 @@ public Model processServicePostRequest(@RequestParam MultiValueMap parameters)
// TODO merge it with implementation in /module
private Model runService(final Model inputDataModel, final MultiValueMap parameters) {
- LOG.info("- parameters={}", parameters);
+ log.info("- parameters={}", parameters);
String id = extractId(parameters);
@@ -207,12 +208,12 @@ private Model runService(final Model inputDataModel, final MultiValueMap parameters) {
- LOG.info("- parameters={}", parameters);
+ log.info("- parameters={}", parameters);
String id = extractId(parameters);
@@ -232,7 +233,7 @@ private Model runModule(final Model inputDataModel, final MultiValueMap JenaUtils.createUnion(inputDataModel, loadModelFromUrl(url.toString())))
@@ -333,7 +334,7 @@ private ExecutionEngine createExecutionEngine(Model configModel) {
}
private void logParam(String parameterKey, String parameterValue) {
- LOG.info("- {}={}", parameterKey, parameterValue);
+ log.info("- {}={}", parameterKey, parameterValue);
}
private @NotNull
@@ -362,16 +363,16 @@ private void extendBindingFromURL(VariablesBinding inputVariablesBinding, URL in
vb2.load(inputBindingURL.openStream(), FileUtils.langTurtle);
VariablesBinding vb3 = inputVariablesBinding.extendConsistently(vb2);
if (vb3.isEmpty()) {
- LOG.debug("- no conflict between bindings loaded from '{}' and those provided in query string.",
+ log.debug("- no conflict between bindings loaded from '{}' and those provided in query string.",
ReservedParams.P_INPUT_BINDING_URL
);
} else {
- LOG.info("- conflicts found between bindings loaded from '{}' and those provided in query string: {}",
+ log.info("- conflicts found between bindings loaded from '{}' and those provided in query string: {}",
ReservedParams.P_INPUT_BINDING_URL, vb3
);
}
} catch (IOException e) {
- LOG.warn("Could not read data from parameter {}={}, caused by: {}", ReservedParams.P_INPUT_BINDING_URL, inputBindingURL, e);
+ log.warn("Could not read data from parameter {}={}, caused by: {}", ReservedParams.P_INPUT_BINDING_URL, inputBindingURL, e);
}
}
diff --git a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/StreamResourceController.java b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/StreamResourceController.java
index fc9c3074..d27a1d07 100644
--- a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/StreamResourceController.java
+++ b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/StreamResourceController.java
@@ -3,6 +3,7 @@
import cz.cvut.spipes.registry.StreamResourceRegistry;
import cz.cvut.spipes.rest.util.ResourceRegisterHelper;
import cz.cvut.spipes.util.RestUtils;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -19,11 +20,11 @@
import java.io.*;
import java.util.UUID;
+@Slf4j
@RestController
@EnableWebMvc
public class StreamResourceController {
- private static final Logger LOG = LoggerFactory.getLogger(StreamResourceController.class);
private final ResourceRegisterHelper resourceRegisterHelper;
public StreamResourceController() {
@@ -76,7 +77,7 @@ public ResponseEntity registerStreamResource2(@RequestHeader(
resourceRegisterHelper.getRegisteredResourceLocation()
);
- LOG.info("Registering new stream resource with url {} " + res.getPersistentUri());
+ log.info("Registering new stream resource with url {} " + res.getPersistentUri());
StreamResourceRegistry.getInstance().registerResource(res.getId(), IOUtils.toByteArray(fis), contentType);
//LOG.debug("Resource content : {}", body);
diff --git a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ContextLoaderHelper.java b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ContextLoaderHelper.java
index 5de7240d..d5ade253 100644
--- a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ContextLoaderHelper.java
+++ b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ContextLoaderHelper.java
@@ -8,18 +8,19 @@
import java.nio.file.Path;
import java.util.LinkedList;
import java.util.List;
+
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.util.LocationMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Slf4j
public class ContextLoaderHelper {
- private static final Logger LOG = LoggerFactory.getLogger(ContextLoaderHelper.class);
-
// TODO should not point to scriptManager
public static void updateContextsIfNecessary(SPipesScriptManager scriptManager) {
if (isKeepUpdated()) {
- LOG.warn("Updating contexts which is not thread safe -- don't use in in production environment.");
+ log.warn("Updating contexts which is not thread safe -- don't use in in production environment.");
OntologyDocumentManager ontoDocManager = OntoDocManager.getInstance();
OntoDocManager.setReloadFiles(true);
List globalScripts = ContextLoaderHelper.registerGlobalScripts(ontoDocManager);
@@ -41,7 +42,7 @@ public static List registerGlobalScripts(OntologyDocumentManager ontDocM
ontoUri -> {
String loc = locMapper.getAltEntry(ontoUri);
if (loc.endsWith(".sms.ttl")) {
- LOG.info("Registering script from file " + loc + ".");
+ log.info("Registering script from file " + loc + ".");
_globalScripts.add(ontoUri);
}
}
diff --git a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/MultipartFileResourceResolver.java b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/MultipartFileResourceResolver.java
index 0a6cd537..0415f855 100644
--- a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/MultipartFileResourceResolver.java
+++ b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/MultipartFileResourceResolver.java
@@ -1,6 +1,7 @@
package cz.cvut.spipes.rest.util;
import cz.cvut.spipes.rest.StreamResourceDTO;
+import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -18,11 +19,10 @@
/**
* Resolver of multipart files references within query parameters.
*/
+@Slf4j
@Component
public class MultipartFileResourceResolver {
- private static final Logger LOG = LoggerFactory.getLogger(MultipartFileResourceResolver.class);
-
private final ResourceRegisterHelper resourceRegisterHelper;
@Autowired
@@ -66,7 +66,7 @@ public MultiValueMap resolveResources(
.findFirst().get(); // must be at least one present due to previous logic
if (e.getValue().size() > 1) {
- LOG.warn("Multiple values for url parameter: {}, using only first value: {}", e.getKey(), paramFilename);
+ log.warn("Multiple values for url parameter: {}, using only first value: {}", e.getKey(), paramFilename);
}
String filename = paramFilename.replaceFirst("@", "");
@@ -81,10 +81,10 @@ public MultiValueMap resolveResources(
newStreamResources.add(res);
newParameters.replace(e.getKey(), Collections.singletonList(res.getPersistentUri()));
} catch (IOException ex) {
- LOG.error(ex.getMessage(), ex);
+ log.error(ex.getMessage(), ex);
}
} else {
- LOG.error("Missing multipart file for url parameter: {} with value: {}", e.getKey(), paramFilename);
+ log.error("Missing multipart file for url parameter: {} with value: {}", e.getKey(), paramFilename);
}
});
diff --git a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ProgressListenerLoader.java b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ProgressListenerLoader.java
index 015b986b..576b9fd3 100644
--- a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ProgressListenerLoader.java
+++ b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ProgressListenerLoader.java
@@ -6,14 +6,16 @@
import java.lang.reflect.InvocationTargetException;
import java.util.LinkedList;
import java.util.List;
+
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.vocabulary.RDF;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Slf4j
public class ProgressListenerLoader {
- private static final Logger LOG = LoggerFactory.getLogger(ProgressListenerLoader.class);
public static List createListeners(Model configModel) {
final List progressListeners = new LinkedList<>();
@@ -32,7 +34,7 @@ public static List createListeners(Model configModel) {
InstantiationException | IllegalAccessException |
InvocationTargetException e) {
- LOG.error("Could not construct progress listener of classname {}, cause: {}", className, e);
+ log.error("Could not construct progress listener of classname {}, cause: {}", className, e);
throw new RuntimeException("Could not construct progress listener of classname " + className + ".", e);
}
}
diff --git a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ResourceRegisterHelper.java b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ResourceRegisterHelper.java
index 3df6866c..ff8592b8 100644
--- a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ResourceRegisterHelper.java
+++ b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ResourceRegisterHelper.java
@@ -3,6 +3,7 @@
import cz.cvut.spipes.registry.StreamResource;
import cz.cvut.spipes.registry.StreamResourceRegistry;
import cz.cvut.spipes.rest.StreamResourceDTO;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -13,11 +14,10 @@
import java.io.InputStream;
import java.util.UUID;
+@Slf4j
@Component
public class ResourceRegisterHelper {
- private static final Logger LOG = LoggerFactory.getLogger(ResourceRegisterHelper.class);
-
public StreamResourceDTO registerStreamResource(String contentType, InputStream body) {
StreamResourceDTO res = new StreamResourceDTO(
UUID.randomUUID().toString(),
@@ -25,7 +25,7 @@ public StreamResourceDTO registerStreamResource(String contentType, InputStream
getRegisteredResourceLocation()
);
- LOG.info("Registering new stream resource with id {} and url {} ", res.getId(), res.getPersistentUri());
+ log.info("Registering new stream resource with id {} and url {} ", res.getId(), res.getPersistentUri());
final byte[] data;
try {
@@ -33,9 +33,9 @@ public StreamResourceDTO registerStreamResource(String contentType, InputStream
StreamResource streamResource = StreamResourceRegistry.getInstance()
.registerResource(res.getId(), data, contentType);
res.attachStreamResource(streamResource);
- LOG.info("Resource content size: {}", data.length);
+ log.info("Resource content size: {}", data.length);
} catch (IOException e) {
- LOG.error("Unable to read payload: ", e);
+ log.error("Unable to read payload: ", e);
}
return res;
diff --git a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ServiceParametersHelper.java b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ServiceParametersHelper.java
index 2aa54bd0..c4393a14 100644
--- a/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ServiceParametersHelper.java
+++ b/s-pipes-web/src/main/java/cz/cvut/spipes/rest/util/ServiceParametersHelper.java
@@ -7,15 +7,16 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
+
+import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.MultiValueMap;
+@Slf4j
public class ServiceParametersHelper {
- private static final Logger LOG = LoggerFactory.getLogger(ServiceParametersHelper.class);
-
@NotNull
final MultiValueMap parameters;
@@ -38,7 +39,7 @@ public String getParameterValue(@NotNull final String parameterKey) {
List values = parameters.get(parameterKey);
String lastValue = values.get(values.size() - 1);
if (parameters.get(parameterKey).size() > 1) {
- LOG.warn("Parameter {} has multiple values: {}. Last assignment of the parameter, i.e. {}, will be used.",
+ log.warn("Parameter {} has multiple values: {}. Last assignment of the parameter, i.e. {}, will be used.",
parameterKey,
values,
lastValue);
diff --git a/s-pipes-web/src/test/java/cz/cvut/spipes/rest/SPipesServiceControllerTest.java b/s-pipes-web/src/test/java/cz/cvut/spipes/rest/SPipesServiceControllerTest.java
index a88bc3e7..2a6d12ab 100644
--- a/s-pipes-web/src/test/java/cz/cvut/spipes/rest/SPipesServiceControllerTest.java
+++ b/s-pipes-web/src/test/java/cz/cvut/spipes/rest/SPipesServiceControllerTest.java
@@ -4,6 +4,7 @@
import cz.cvut.spipes.engine.VariablesBinding;
import cz.cvut.spipes.rest.util.ReservedParams;
import cz.cvut.spipes.util.RDFMimeType;
+import lombok.extern.slf4j.Slf4j;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.ResourceFactory;
@@ -38,12 +39,12 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+@Slf4j
@ExtendWith(SpringExtension.class)
@WebAppConfiguration
@ContextConfiguration(classes = WebAppConfig.class)
public class SPipesServiceControllerTest {
- private static final Logger LOGGER = LoggerFactory.getLogger(SPipesServiceControllerTest.class);
public static final String SAMPLE_IDENTITY_MODULE = "http://onto.fel.cvut.cz/ontologies/s-pipes/identity#SampleIdentity";
public static final String CREATE_SAMPLE_TRIPLES = "http://onto.fel.cvut.cz/ontologies/test/apply-construct#CreateSampleTriples";
@@ -95,7 +96,7 @@ public void testRunExistingModule() throws Exception {
MvcResult result = mockMvc.perform(createDefaultIdentityModuleBuilder().
accept(RDFMimeType.LD_JSON_STRING)
).andExpect(status().isOk()).andReturn();
- LOGGER.info("Resulting JSON: " + result.getResponse().getContentAsString());
+ log.info("Resulting JSON: " + result.getResponse().getContentAsString());
}
@Test
@@ -110,7 +111,7 @@ private void testMimeType( final String mimeType, boolean pass ) throws Exceptio
MvcResult result = mockMvc.perform(createDefaultIdentityModuleBuilder().
accept(mimeType)
).andExpect(pass ? status().isOk() : status().is4xxClientError()).andReturn();
- LOGGER.info("Result: {}", result.getResponse().getContentAsString());
+ log.info("Result: {}", result.getResponse().getContentAsString());
final Model m = ModelFactory.createDefaultModel();
try {
m.read(new ByteArrayInputStream(result.getResponse().getContentAsByteArray()), "", RDFLanguages.contentTypeToLang(mimeType).getName());
@@ -138,7 +139,7 @@ private void testModule(
int expectedNumberOfStatements
) throws Exception {
- LOGGER.info("Testing module with parameters:\n - id={},\n - cfg={},\n - inputBinding={}", id, resourceConfig,inputVariablesBinding);
+ log.info("Testing module with parameters:\n - id={},\n - cfg={},\n - inputBinding={}", id, resourceConfig,inputVariablesBinding);
if ( inputVariablesBinding == null ) {
inputVariablesBinding = new VariablesBinding();
}
@@ -167,7 +168,7 @@ private void testModule(
outputBinding.load(new FileInputStream(outputBindingFile), "TURTLE");
// Assert.assertEquals(Lists.newArrayList(outputBinding.getVarNames()), Lists.newArrayList(expectedOutputVariablesBinding.getVarNames())); TODO uncomment !!!
- LOGGER.info(" - content returned: {}", result.getResponse().getContentAsString());
+ log.info(" - content returned: {}", result.getResponse().getContentAsString());
final StringReader res = new StringReader(result.getResponse().getContentAsString());
final Model mOutput = ModelFactory.createDefaultModel();