Introduced verbatim vc names

Change-Id: Id8dd71814f38026887a0d9b95d64692079c96e22
diff --git a/src/main/antlr/collection/CollectionQueryParser.g4 b/src/main/antlr/collection/CollectionQueryParser.g4
index 4999d25..3ed74d2 100644
--- a/src/main/antlr/collection/CollectionQueryParser.g4
+++ b/src/main/antlr/collection/CollectionQueryParser.g4
@@ -56,7 +56,7 @@
 
 vcName
 : WORD
-| WORD SLASH WORD
+| multiword
 ;
 
 token
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 674fd92..ccb1e6e 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
@@ -177,9 +177,20 @@
             
             ParseTree vcName = getFirstChildWithCat(node, "vcName");
             String vcNameStr = "";
-            for (int i=0; i < vcName.getChildCount(); i++){
-                vcNameStr = vcNameStr+vcName.getChild(i).toString();
-            }
+
+			String node_cat = getNodeCat(vcName.getChild(0));
+
+			if (node_cat.equals("multiword")) {
+				TokenStream stream = parser.getTokenStream();
+				vcNameStr = stream.getText(vcName.getChild(0).getSourceInterval());
+				// Fix verbatim keys
+				vcNameStr= vcNameStr.substring(1, vcNameStr.length()-1)
+					.replaceAll("\\\\\\\\","\\\\").replaceAll("\\\\\"", "\"");
+			}
+			else {
+				vcNameStr = vcName.getChild(0).toString();
+			};
+
             Map<String, Object> term = KoralObjectGenerator.makeDocGroupRef(vcNameStr);
             putIntoSuperObject(term);
         }
diff --git a/src/test/java/de/ids_mannheim/korap/query/test/collection/CollectionQueryProcessorTest.java b/src/test/java/de/ids_mannheim/korap/query/test/collection/CollectionQueryProcessorTest.java
index 76d3af0..f84f612 100644
--- a/src/test/java/de/ids_mannheim/korap/query/test/collection/CollectionQueryProcessorTest.java
+++ b/src/test/java/de/ids_mannheim/korap/query/test/collection/CollectionQueryProcessorTest.java
@@ -34,13 +34,20 @@
         assertEquals("koral:docGroupRef", res.at("/collection/@type").asText());
         assertEquals("vc-filename", res.at("/collection/ref").asText());
         
-        collection = "referTo mickey/MyVC";
+        collection = "referTo \"mickey/MyVC\"";
         qs.setQuery(query, ql);
         qs.setCollection(collection);
         res = mapper.readTree(qs.toJSON());
         assertEquals("koral:docGroupRef", res.at("/collection/@type").asText());
         assertEquals("mickey/MyVC", res.at("/collection/ref").asText());
-    }
+
+        collection = "referTo \"http://korap.ids-mannheim.de/user/vc/myCorpus\"";
+        qs.setQuery(query, ql);
+        qs.setCollection(collection);
+        res = mapper.readTree(qs.toJSON());
+        assertEquals("koral:docGroupRef", res.at("/collection/@type").asText());
+        assertEquals("http://korap.ids-mannheim.de/user/vc/myCorpus", res.at("/collection/ref").asText());
+	}
     
     @Test
     public void testContext () throws JsonProcessingException, IOException {