Removed version from FCSQL query processor.
Change-Id: I906d7c1d66feb90d7ca0ca8e4ad1eb51f2f54806
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessor.java
index ef7e375..671f505 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/FCSQLQueryProcessor.java
@@ -12,8 +12,9 @@
import eu.clarin.sru.server.fcs.parser.QueryParser;
import eu.clarin.sru.server.fcs.parser.QueryParserException;
-/** FCSQLQueryProcessor is accountable for the serialization of FCSQL to KoralQuery.
- * The KoralQuery is structured as a map containing parts of JSON-LD serializations of KoralObjects.
+/** FCSQLQueryProcessor is accountable for the serialization of FCSQL
+ * to KoralQuery. The KoralQuery is structured as a map containing
+ * parts of JSON-LD serializations of KoralObjects.
*
* @author margaretha
*
@@ -32,22 +33,13 @@
}
}
- private static final String VERSION_2_0 = "2.0";
-
private final QueryParser fcsParser = new QueryParser();
- private String version;
- public FCSQLQueryProcessor (String query) {
- this(query, VERSION_2_0);
- }
-
/** Constructs FCSQLQueryProcessor for the given query and version.
* @param query an FCS query string
- * @param version the FCSQL version of the query
*/
- public FCSQLQueryProcessor (String query, String version) {
+ public FCSQLQueryProcessor (String query) {
super();
- this.version = version;
process(query);
}
@@ -58,33 +50,17 @@
@Override
public void process(String query) {
- if (isVersionValid()) {
- FCSSRUQuery fcsSruQuery = parseQueryStringtoFCSQuery(query);
- if (fcsSruQuery != null) {
- QueryNode fcsQueryNode = fcsSruQuery.getParsedQuery();
- try {
- parseFCSQueryToKoralQuery(fcsQueryNode);
- } catch (KoralException e) {
- addError(e.getStatusCode(), e.getMessage());
- }
- }
+ FCSSRUQuery fcsSruQuery = parseQueryStringtoFCSQuery(query);
+ if (fcsSruQuery != null) {
+ QueryNode fcsQueryNode = fcsSruQuery.getParsedQuery();
+ try {
+ parseFCSQueryToKoralQuery(fcsQueryNode);
+ } catch (KoralException e) {
+ addError(e.getStatusCode(), e.getMessage());
+ }
}
}
- private boolean isVersionValid() {
- if (version == null || version.isEmpty()) {
- addError(StatusCodes.MISSING_VERSION,
- "Version number is missing.");
- return false;
- }
- else if (!version.equals(VERSION_2_0)) {
- addError(StatusCodes.UNSUPPORTED_VERSION,
- "Only supports SRU version 2.0.");
- return false;
- }
- return true;
- }
-
/** Translates the given FCS query string into an FCSSSRUQuery object.
* @param query an FCS query string
* @return an FCSSRUQuery
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 4b192b0..699581b 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
@@ -1,15 +1,21 @@
package de.ids_mannheim.korap.query.serialize;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import de.ids_mannheim.korap.query.serialize.util.KoralObjectGenerator;
-import de.ids_mannheim.korap.query.serialize.util.StatusCodes;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
import org.apache.log4j.BasicConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.util.*;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import de.ids_mannheim.korap.query.serialize.util.KoralObjectGenerator;
+import de.ids_mannheim.korap.query.serialize.util.StatusCodes;
/**
* Main class for Koral, serializes queries from concrete QLs to KoralQuery
@@ -118,7 +124,7 @@
ast = new CqlQueryProcessor(query);
}
else if (queryLanguage.equalsIgnoreCase("fcsql")) {
- ast = new FCSQLQueryProcessor(query, "2.0");
+ ast = new FCSQLQueryProcessor(query);
}
else if (queryLanguage.equalsIgnoreCase("annis")) {
ast = new AnnisQueryProcessor(query);
@@ -157,14 +163,7 @@
}
}
else if (ql.equalsIgnoreCase("fcsql")) {
- if (version == null) {
- ast = new FCSQLQueryProcessor(query);
-// ast.addError(StatusCodes.MISSING_VERSION,
-// "SRU Version is missing!");
- }
- else {
- ast = new FCSQLQueryProcessor(query, version);
- }
+ ast = new FCSQLQueryProcessor(query);
}
else if (ql.equalsIgnoreCase("annis")) {
ast = new AnnisQueryProcessor(query);