Added debug flags.
Change-Id: I1f6aeeddfeab505d36191af24cca15f3569bb71c
diff --git a/Changes b/Changes
index e3acb5a..9ec1522 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+0.33 2019-01-08
+ - Added debug flags (margaretha)
+
0.32 2018-12-13
- [bugfix] Support verbatim string queries (#57; diewald).
diff --git a/pom.xml b/pom.xml
index 3e5b271..7d5a151 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
<groupId>de.ids_mannheim.korap</groupId>
<artifactId>Koral</artifactId>
- <version>0.32</version>
+ <version>0.33</version>
<packaging>jar</packaging>
<name>Koral</name>
<url>http://maven.apache.org</url>
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java
index cc45e09..5689705 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessor.java
@@ -52,6 +52,7 @@
* @since 0.1.0
*/
public class AnnisQueryProcessor extends Antlr4AbstractQueryProcessor {
+ private static final boolean DEBUG = false;
private static Logger log = LoggerFactory
.getLogger(AnnisQueryProcessor.class);
/**
@@ -187,9 +188,13 @@
else {
throw new NullPointerException("Parser has not been instantiated!");
}
- log.info("Processing Annis query: " + query);
+ if (DEBUG) {
+ log.info("Processing Annis query: " + query);
+ }
if (tree != null) {
- log.debug("ANTLR parse tree: " + tree.toStringTree(parser));
+ if (DEBUG) {
+ log.debug("ANTLR parse tree: " + tree.toStringTree(parser));
+ }
processNode(tree);
// Last check to see if all relations have left the queue
if (!queuedRelations.isEmpty()) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java
index 3848f5b..2688675 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessor.java
@@ -36,6 +36,7 @@
*/
public class CollectionQueryProcessor extends Antlr4AbstractQueryProcessor {
+ private static final boolean DEBUG = false;
private static Logger log = LoggerFactory
.getLogger(CollectionQueryProcessor.class);
@@ -66,9 +67,13 @@
else {
throw new NullPointerException("Parser has not been instantiated!");
}
- log.info("Processing virtual collection query: " + query);
+ if (DEBUG) {
+ log.debug("Processing virtual collection query: " + query);
+ }
if (tree != null) {
- log.debug("ANTLR parse tree: " + tree.toStringTree(parser));
+ if (DEBUG) {
+ log.debug("ANTLR parse tree: " + tree.toStringTree(parser));
+ }
processNode(tree);
}
else {
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
index 91dad6e..9570366 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
@@ -40,6 +40,8 @@
*/
public class Cosmas2QueryProcessor extends Antlr3AbstractQueryProcessor {
+ private static final boolean DEBUG = false;
+
private static Logger log =
LoggerFactory.getLogger(Cosmas2QueryProcessor.class);
@@ -138,7 +140,9 @@
KoralObjectGenerator.setQueryProcessor(this);
this.query = query;
process(query);
- log.info(">>> " + requestMap.get("query") + " <<<");
+ if (DEBUG) {
+ log.debug(">>> " + requestMap.get("query") + " <<<");
+ }
}
@@ -146,9 +150,13 @@
public void process (String query) {
Tree tree = null;
tree = parseCosmasQuery(query);
- log.info("Processing CosmasII query: " + query);
+ if (DEBUG) {
+ log.debug("Processing CosmasII query: " + query);
+ }
if (tree != null) {
- log.debug("ANTLR parse tree: " + tree.toStringTree());
+ if (DEBUG) {
+ log.debug("ANTLR parse tree: " + tree.toStringTree());
+ }
processNode(tree);
}
}
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
index 922db7f..7bde9bc 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessor.java
@@ -41,6 +41,7 @@
*/
public class PoliqarpPlusQueryProcessor extends Antlr4AbstractQueryProcessor {
+ private static final boolean DEBUG = false;
private static Logger log = LoggerFactory
.getLogger(PoliqarpPlusQueryProcessor.class);
private int classCounter = 1;
@@ -57,7 +58,9 @@
public PoliqarpPlusQueryProcessor (String query) {
KoralObjectGenerator.setQueryProcessor(this);
process(query);
- log.info(">>> " + requestMap.get("query") + " <<<");
+ if (DEBUG) {
+ log.debug(">>> " + requestMap.get("query") + " <<<");
+ }
}
@@ -67,9 +70,13 @@
tree = parsePoliqarpQuery(query);
// fixme: not required!?
super.parser = this.parser;
- log.info("Processing PoliqarpPlus query: " + query);
+ if (DEBUG) {
+ log.debug("Processing PoliqarpPlus query: " + query);
+ }
if (tree != null) {
- log.debug("ANTLR parse tree: " + tree.toStringTree(parser));
+ if (DEBUG){
+ log.debug("ANTLR parse tree: " + tree.toStringTree(parser));
+ }
processNode(tree);
}
else {
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/TreeTemplate.java b/src/main/java/de/ids_mannheim/korap/query/serialize/TreeTemplate.java
index b6ce44b..087ae32 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/TreeTemplate.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/TreeTemplate.java
@@ -29,6 +29,7 @@
* @since 0.1.0
*/
public class TreeTemplate extends Antlr4AbstractQueryProcessor {
+ private static final boolean DEBUG = false;
private static Logger log = LoggerFactory.getLogger(TreeTemplate.class);
@@ -51,7 +52,9 @@
ParseTree tree = parseQuery(query);
super.parser = this.parser;
if (tree != null) {
- log.debug("ANTLR parse tree: " + tree.toStringTree(parser));
+ if (DEBUG) {
+ log.debug("ANTLR parse tree: " + tree.toStringTree(parser));
+ }
processNode(tree);
}
else {