improved logging
Added a logmessage at level DEBUG for each execution of a message validator, to allow pinpointing problems
@@ -4,14 +4,16 @@ import org.apache.jena.graph.Node;
import org.apache.jena.query.*;
import org.apache.jena.sparql.core.Var;
import org.apache.jena.sparql.engine.binding.Binding;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* User: ypanchenko
* Date: 02.06.2015
*/
-public class WonSparqlValidator
-{
-
+public class WonSparqlValidator {
+ private final Logger logger = LoggerFactory.getLogger(getClass());
public static final Var SELECT_VALIDATION_VARIABLE = Var.alloc("check");
public static final String SELECT_VALIDATION_PASSED_VALUE = "OK";
@@ -34,6 +36,9 @@ public class WonSparqlValidator
}
public ValidationResult validate(Dataset input) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("validating constraint of WonSparqlValidator '{}'", name);
+ }
if (constraint.isAskType()) {
return validateAsk(input);
} else if (constraint.isSelectType()) {
@@ -43,8 +48,7 @@ public class WonSparqlValidator
}
private ValidationResult validateSelect(final Dataset input) {
- try (QueryExecution qe = QueryExecutionFactory.create(constraint, input))
- {
+ try (QueryExecution qe = QueryExecutionFactory.create(constraint, input)) {
ResultSet result = qe.execSelect();
while (result.hasNext()) {
Binding binding = result.nextBinding();
