new context, new version number (0.3.0), span keys as regex

Change-Id: I9afe3aa4e782a19d3b32727e279e96bc4e231eb8
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractQueryProcessor.java
index 0240a15..d53cb14 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractQueryProcessor.java
@@ -18,7 +18,7 @@
  * JSON-LD tree for that query. 
  * 
  * @author Joachim Bingel (bingel@ids-mannheim.de)
- * @version 0.1.0
+ * @version 0.3.0
  * @since 0.1.0
  */
 public abstract class AbstractQueryProcessor {
@@ -86,8 +86,8 @@
     private ArrayList<Integer> highlightClasses = new ArrayList<Integer>();
 
     AbstractQueryProcessor() {
-        requestMap.put("@context", "http://ids-mannheim.de/ns/KorAP/json-ld/"
-                + "v0.2/context.jsonld");
+        requestMap.put("@context",
+                "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld");
         requestMap.put("errors", errors);
         requestMap.put("warnings", warnings);
         requestMap.put("messages", messages);
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 dcdb802..224d088 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
@@ -35,7 +35,7 @@
  * @see http://annis-tools.org/aql.html
  * 
  * @author Joachim Bingel (bingel@ids-mannheim.de)
- * @version 0.1.0
+ * @version 0.3.0
  * @since 0.1.0
  */
 public class AnnisQueryProcessor extends Antlr4AbstractQueryProcessor {
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr3AbstractQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr3AbstractQueryProcessor.java
index 3750220..9b86e69 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr3AbstractQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr3AbstractQueryProcessor.java
@@ -16,7 +16,7 @@
  * for some node. 
  * 
  * @author Joachim Bingel (bingel@ids-mannheim.de)
- * @version 0.1.0
+ * @version 0.3.0
  * @since 0.1.0
  */
 public abstract class Antlr3AbstractQueryProcessor extends
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr4AbstractQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr4AbstractQueryProcessor.java
index 324d25e..d22c8b3 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr4AbstractQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/Antlr4AbstractQueryProcessor.java
@@ -16,7 +16,7 @@
  * for some node. 
  * 
  * @author Joachim Bingel (bingel@ids-mannheim.de)
- * @version 0.1.0
+ * @version 0.3.0
  * @since 0.1.0
  */
 public abstract class Antlr4AbstractQueryProcessor extends  
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 a884171..d85c03e 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
@@ -24,7 +24,7 @@
  * 
  * @author Michael Hanl (hanl@ids-mannheim.de)
  * @author Joachim Bingel (bingel@ids-mannheim.de)
- * @version 0.1.0
+ * @version 0.3.0
  * @since 0.1.0
  */
 public class CollectionQueryProcessor extends Antlr4AbstractQueryProcessor {
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 c3b0e2b..b139206 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
@@ -25,7 +25,7 @@
  * Map representation of CosmasII syntax tree as returned by ANTLR
  *
  * @author Joachim Bingel (bingel@ids-mannheim.de)
- * @version 0.2
+ * @version 0.3
  */
 public class Cosmas2QueryProcessor extends Antlr3AbstractQueryProcessor {
 
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 5067a3c..1ec4b9f 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
@@ -15,9 +15,11 @@
 import java.util.*;
 
 /**
- * Map representation of Poliqarp syntax tree as returned by ANTLR
+ * Map representation of PoliqarpPlus syntax tree as returned by ANTLR
  *
  * @author Joachim Bingel (bingel@ids-mannheim.de)
+ * @version 0.3.0
+ * @since 0.1.0
  */
 public class PoliqarpPlusQueryProcessor extends Antlr4AbstractQueryProcessor {
 
@@ -373,7 +375,14 @@
                 layer = "lemma";
             span.put("layer", layer);
         }
-        span.put("key", keyNode.getText());
+        String key = keyNode.getText();
+        // check if key is regular expression
+        if (hasChild(keyNode, "regex")) {
+            // remove leading/trailing double quotes
+            key = key.substring(1, key.length()-1); 
+            span.put("type", "type:regex");
+        }
+        span.put("key", key);
         if (termOpNode != null) {
             String termOp = termOpNode.getText();
             if (termOp.equals("=="))
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
index d9e7a0d..8c8e591 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
@@ -16,7 +16,10 @@
 import java.util.*;
 
 /**
- * @author bingel, hanl
+ * Main class for Koral, serializes queries from concrete QLs to KoralQuery
+ * @author Joachim Bingel (bingel@ids-mannheim.de), Michael Hanl (hanl@ids-mannheim.de)
+ * @version 0.3.0
+ * @since 0.1.0
  */
 public class QuerySerializer {
 
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/QueryUtils.java b/src/main/java/de/ids_mannheim/korap/query/serialize/QueryUtils.java
index ea32134..e3d32b5 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/QueryUtils.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/QueryUtils.java
@@ -15,6 +15,8 @@
 /**
  * @author Joachim Bingel (bingel@ids-mannheim.de), Michael Hanl (hanl@ids-mannheim.de)
  * @date 10/12/2013
+ * @version 0.3.0
+ * @since 0.1.0
  */
 public class QueryUtils {
 
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 27caa3d..7cc8174 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
@@ -24,7 +24,8 @@
 /**
  * Map representation of syntax tree as returned by ANTLR
  * @author Joachim Bingel (bingel@ids-mannheim.de)
- *
+ * @version 0.3.0
+ * @since 0.1.0
  */
 public class TreeTemplate extends Antlr4AbstractQueryProcessor {
 	private static Logger log = LoggerFactory.getLogger(TreeTemplate.class);
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessorTest.java
index 4901137..80087eb 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/AnnisQueryProcessorTest.java
@@ -29,7 +29,7 @@
 
     @Test
     public void testContext() throws JsonProcessingException, IOException {
-        String contextUrl = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld";
+        String contextUrl = "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld";
         query = "foo";
         qs.setQuery(query, "annis");
         res = mapper.readTree(qs.toJSON());
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java
index 2f40075..a8b9b6e 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/CollectionQueryProcessorTest.java
@@ -26,7 +26,7 @@
 	@Test
 	public void testContext() throws JsonProcessingException, IOException {
 		collection = "textClass=politik";
-		String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld";
+		String contextString = "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld";
 		qs.setQuery(query,ql);
 		qs.setCollection(collection);
 		res = mapper.readTree(qs.toJSON());
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessorTest.java
index d5cfcc4..be4bcec 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessorTest.java
@@ -30,7 +30,7 @@
 
     @Test
     public void testContext() throws JsonProcessingException, IOException {
-        String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld";
+        String contextString = "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld";
         query = "foo";
         qs.setQuery(query, "cosmas2");
         res = mapper.readTree(qs.toJSON());
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
index 7b7d89c..e2020f4 100644
--- a/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusQueryProcessorTest.java
@@ -31,7 +31,7 @@
     @Test
     public void testContext() throws JsonProcessingException, IOException {
         query = "foo";
-        String contextString = "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld";
+        String contextString = "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld";
         qs.setQuery(query, "poliqarpplus");
         res = mapper.readTree(qs.toJSON());
         assertEquals(contextString, res.get("@context").asText());