resoure service error
diff --git a/src/main/java/de/ids_mannheim/korap/config/AdminSetup.java b/src/main/java/de/ids_mannheim/korap/config/AdminSetup.java
new file mode 100644
index 0000000..5c0a276
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/config/AdminSetup.java
@@ -0,0 +1,64 @@
+package de.ids_mannheim.korap.config;
+
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.interfaces.EncryptionIface;
+
+import java.io.*;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Created by hanl on 30.05.16.
+ */
+public class AdminSetup {
+
+ private final String token_hash;
+
+ private static AdminSetup setup;
+
+
+ private AdminSetup (String token_hash) {
+ this.token_hash = token_hash;
+ }
+
+
+ public static AdminSetup getInstance () {
+ if (setup == null)
+ setup = init();
+ return setup;
+ }
+
+
+ public String getHash () {
+ return this.token_hash;
+ }
+
+
+ private static AdminSetup init () {
+ EncryptionIface iface = BeansFactory.getKustvaktContext()
+ .getEncryption();
+ String token = iface.createToken();
+ File store = new File("./admin_token");
+ try {
+ String hash = iface.secureHash(token);
+ AdminSetup setup = new AdminSetup(hash);
+ FileOutputStream out = new FileOutputStream(store);
+ out.write(token.getBytes());
+
+ out.close();
+
+ store.setReadable(true, true);
+ store.setWritable(true, true);
+ store.setExecutable(false);
+ System.out
+ .println("_______________________________________________");
+ System.out.println("Token created. Please make note of it!");
+ System.out.println("Token: " + token);
+ System.out
+ .println("_______________________________________________");
+ return setup;
+ }
+ catch (Exception e) {
+ throw new RuntimeException("setup failed! ", e);
+ }
+ }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
index 5352435..a657c87 100644
--- a/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
@@ -69,6 +69,7 @@
// fixme: should move to base config?!
private EncryptionIface.Encryption encryption;
private byte[] sharedSecret;
+ @Deprecated
private String adminToken;
private int longTokenTTL;
private int tokenTTL;
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java b/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java
index a477d31..3de9412 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java
@@ -5,8 +5,10 @@
import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
import de.ids_mannheim.korap.interfaces.db.ResourceOperationIface;
import de.ids_mannheim.korap.resources.Document;
+import de.ids_mannheim.korap.resources.KustvaktResource;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.utils.BooleanUtils;
+import de.ids_mannheim.korap.utils.StringUtils;
import edu.emory.mathcs.backport.java.util.Collections;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
@@ -19,12 +21,12 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
+import java.util.Set;
/**
* @author hanl
* @date 05/11/2014
*/
-// todo: testing!
// todo: error handling
public class DocumentDao implements ResourceOperationIface<Document> {
@@ -69,13 +71,15 @@
}
- // document id, consisting of corpus sigle, substring key and document number
+ // todo: search for partial matches if entire document is disabled
+ // document id, consisting of corpus sigle, substring key and text number
@Override
public Document findbyId (String id, User user) throws KustvaktException {
MapSqlParameterSource s = new MapSqlParameterSource();
s.addValue("id", id);
- // strftime('%s', created) as created
- String sql = "select id, persistent_id, disabled, created from doc_store where persistent_id=:id;";
+ s.addValue("docSigle", StringUtils.getDocSigle(id));
+
+ String sql = "select id, persistent_id, disabled, created from doc_store where persistent_id=:id or persistent_id like :docSigle;";
try {
return this.jdbcTemplate.queryForObject(sql, s,
new RowMapper<Document>() {
@@ -99,6 +103,39 @@
return null;
}
catch (DataAccessException e) {
+ throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
+ }
+ }
+
+
+ @Override
+ public List<Document> findbyPartialId (String id, User user)
+ throws KustvaktException {
+ MapSqlParameterSource s = new MapSqlParameterSource();
+ s.addValue("id", id + "%");
+
+ String sql = "select id, persistent_id, disabled, created from doc_store where persistent_id like :id;";
+ try {
+ return this.jdbcTemplate.query(sql, s, new RowMapper<Document>() {
+ @Override
+ public Document mapRow (ResultSet rs, int rowNum)
+ throws SQLException {
+ Document doc = null;
+ if (!rs.isClosed()) {
+ doc = new Document(rs.getString("persistent_id"));
+ doc.setId(rs.getInt("id"));
+ doc.setCreated(rs.getLong("created"));
+ doc.setDisabled(rs.getBoolean("disabled"));
+ }
+
+ return doc;
+ }
+ });
+ }
+ catch (EmptyResultDataAccessException em) {
+ return null;
+ }
+ catch (DataAccessException e) {
e.printStackTrace();
throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
}
@@ -136,13 +173,14 @@
}
+ //todo: remove and introduce partial match search of persistent id!
+ @Deprecated
public List<Document> findbyCorpus (String corpus, int offset, int index)
throws KustvaktException {
MapSqlParameterSource source = new MapSqlParameterSource();
source.addValue("corpus", corpus + "%");
source.addValue("offset", (offset * index));
source.addValue("limit", offset);
- //strftime('%s', created) as
final String sql = "select id, persistent_id, disabled, created from doc_store where (persistent_id like :corpus) limit :offset, :limit";
try {
return this.jdbcTemplate.query(sql, source,
@@ -174,6 +212,7 @@
}
+ @Deprecated
public List<String> findbyCorpus (String corpus, boolean disabled)
throws KustvaktException {
MapSqlParameterSource s = new MapSqlParameterSource();
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java b/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
index aeeb58a..41b1c72 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
@@ -151,6 +151,13 @@
@Override
+ public <T1 extends KustvaktResource> List<T1> findbyPartialId (String id,
+ User user) throws KustvaktException {
+ return null;
+ }
+
+
+ @Override
public int storeResource (T resource, User user) throws KustvaktException {
MapSqlParameterSource source = new MapSqlParameterSource();
KeyHolder holder = new GeneratedKeyHolder();
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
index 7007fb8..7bd092d 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
@@ -23,20 +23,21 @@
* @throws java.security.NoSuchAlgorithmException
* @throws java.io.UnsupportedEncodingException
*/
- public String produceSecureHash (String input, String salt)
+ public String secureHash (String input, String salt)
throws NoSuchAlgorithmException, UnsupportedEncodingException,
KustvaktException;
- public String produceSecureHash (String input)
- throws NoSuchAlgorithmException, UnsupportedEncodingException,
- KustvaktException;
+ public String secureHash (String input) throws NoSuchAlgorithmException,
+ UnsupportedEncodingException, KustvaktException;
- public String hash (String text, String salt) throws Exception;
+ //@Deprecated
+ //public String hash (String text, String salt) throws Exception;
- public String hash (String text) throws Exception;
+ //@Deprecated
+ //public String hash (String text) throws Exception;
/**
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java
index f13e254..43124a0 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java
@@ -8,6 +8,7 @@
import java.util.Collection;
import java.util.List;
+import java.util.Set;
// todo: for transaction to work this should go into core module!?!
// todo: user instance only required for auditing pointcut operations
@@ -22,6 +23,11 @@
throws KustvaktException;
+ // todo: regex should be considered here to consider determination of partial id offset information
+ <T extends KustvaktResource> List<T> findbyPartialId (String id, User user)
+ throws KustvaktException;
+
+
List<T> getResources (Collection<Object> ids, User user)
throws KustvaktException;
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
index 96d5c52..3d56eff 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
@@ -28,7 +28,7 @@
@Override
- public String produceSecureHash (String input, String salt)
+ public String secureHash (String input, String salt)
throws NoSuchAlgorithmException, UnsupportedEncodingException,
KustvaktException {
return null;
@@ -36,21 +36,8 @@
@Override
- public String produceSecureHash (String input)
- throws NoSuchAlgorithmException, UnsupportedEncodingException,
- KustvaktException {
- return null;
- }
-
-
- @Override
- public String hash (String text, String salt) throws Exception {
- return null;
- }
-
-
- @Override
- public String hash (String value) {
+ public String secureHash (String input) throws NoSuchAlgorithmException,
+ UnsupportedEncodingException, KustvaktException {
return null;
}
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
index f45437e..057583e 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
@@ -78,13 +78,13 @@
}
- public String produceSecureHash (String input) {
- return produceSecureHash(input, "");
+ public String secureHash (String input) {
+ return secureHash(input, "");
}
@Override
- public String produceSecureHash (String input, String salt) {
+ public String secureHash (String input, String salt) {
String hashString = "";
switch (config.getEncryption()) {
case ESAPICYPHER:
@@ -124,6 +124,7 @@
}
+
public String hash (String text, String salt) throws Exception {
byte[] bytes;
@@ -143,7 +144,6 @@
}
- @Override
public String hash (String input) {
String hashString = "";
MessageDigest md;
@@ -244,7 +244,7 @@
String pw = "";
switch (config.getEncryption()) {
case ESAPICYPHER:
- pw = produceSecureHash(plain, salt);
+ pw = secureHash(plain, salt);
break;
case BCRYPT:
try {
@@ -265,7 +265,7 @@
public boolean checkHash (String plain, String hash) {
switch (config.getEncryption()) {
case ESAPICYPHER:
- return produceSecureHash(plain).equals(hash);
+ return secureHash(plain).equals(hash);
case BCRYPT:
try {
return BCrypt.checkpw(plain, hash);
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/DocMatchRewrite.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/DocMatchRewrite.java
index fc47c8b..649f58d 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/DocMatchRewrite.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/DocMatchRewrite.java
@@ -35,9 +35,10 @@
}
+ //todo: benchmark: see if retrieval and and get docs for all ids at once is better --> outside this rewrite handler
@Override
public JsonNode rewriteResult (KoralNode node) throws KustvaktException {
- Document doc = null;
+ Document doc;
if (this.docDao == null)
throw new RuntimeException("Document dao must be set!");
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java
index 3ede387..468fa9e 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java
@@ -139,7 +139,6 @@
}
-
public void clear () {
this.node_processors.clear();
this.query_processors.clear();
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Document.java b/src/main/java/de/ids_mannheim/korap/resources/Document.java
index c603011..c30e7d1 100644
--- a/src/main/java/de/ids_mannheim/korap/resources/Document.java
+++ b/src/main/java/de/ids_mannheim/korap/resources/Document.java
@@ -1,5 +1,7 @@
package de.ids_mannheim.korap.resources;
+import bsh.StringUtil;
+import de.ids_mannheim.korap.utils.StringUtils;
import lombok.Getter;
import lombok.Setter;
@@ -14,30 +16,31 @@
private String corpus;
private boolean disabled;
+ private String docSigle;
- public Document (String persistentID) {
+ public Document (String textSigle) {
+ this.setPersistentID(textSigle);
+ this.docSigle = StringUtils.getDocSigle(textSigle);
+ this.corpus = StringUtils.getCorpusSigle(textSigle);
+ }
+
+
+ public Document (String docSigle, String textSigle) {
this.setId(-1);
- this.setPersistentID(persistentID);
- this.corpus = getCorpusID();
+ this.setPersistentID(textSigle);
+ this.docSigle = docSigle;
+ this.corpus = StringUtils.getCorpusSigle(textSigle);
this.setDisabled(true);
}
- public Document (String persistentID, boolean disabled) {
- this(persistentID);
+ public Document (String docsigle, String textSigle, boolean disabled) {
+ this(docsigle, textSigle);
this.setDisabled(disabled);
}
- private String getCorpusID () {
- //WPD_SSS.07367
- if (this.getPersistentID() != null)
- return this.getPersistentID().split("_")[0];
- return null;
- }
-
-
public boolean isText () {
return this.getPersistentID().contains(".");
}
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java b/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java
index 69ef5bf..977f797 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java
@@ -11,6 +11,7 @@
import de.ids_mannheim.korap.user.TokenContext;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.utils.NamingUtils;
+import de.ids_mannheim.korap.utils.StringUtils;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;
@@ -46,7 +47,7 @@
Element ein = invalided.get(authToken);
if (e == null && ein == null) {
try {
- authToken = NamingUtils.stripTokenType(authToken);
+ authToken = StringUtils.stripTokenType(authToken);
context = signedToken.getTokenContext(authToken);
context.setTokenType(Attributes.API_AUTHENTICATION);
}
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java b/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java
index ccad916..8c1ad22 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java
@@ -12,6 +12,7 @@
import de.ids_mannheim.korap.user.TokenContext;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.utils.NamingUtils;
+import de.ids_mannheim.korap.utils.StringUtils;
import org.apache.commons.codec.binary.Base64;
import org.apache.oltu.oauth2.common.utils.OAuthUtils;
@@ -25,17 +26,6 @@
public static String[] decode (String token) {
return OAuthUtils.decodeClientAuthenticationHeader(token);
-
- // String t = StringUtils.getTokenType(token);
- // if (t != null && t.toUpperCase()
- // .equals(Attributes.BASIC_AUTHENTICATION.toUpperCase())) {
- // token = StringUtils.stripTokenType(token);
- // String[] sp = new String(Base64.decodeBase64(token)).split(":", 2);
- // sp[0].replaceAll(" ", "");
- // sp[1].replaceAll(" ", "");
- // return sp;
- // }
- // return null;
}
@@ -68,7 +58,7 @@
c.setTokenType(Attributes.BASIC_AUTHENTICATION);
// todo: for production mode, set true
c.setSecureRequired(false);
- c.setToken(NamingUtils.stripTokenType(authToken));
+ c.setToken(StringUtils.stripTokenType(authToken));
// fixme: you can make queries, but user sensitive data is off limits?!
c.addContextParameter(Attributes.SCOPES,
Scopes.Scope.search.toString());
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
index 5c98f8f..f7387c4 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
@@ -14,6 +14,7 @@
import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
import de.ids_mannheim.korap.user.*;
import de.ids_mannheim.korap.utils.NamingUtils;
+import de.ids_mannheim.korap.utils.StringUtils;
import de.ids_mannheim.korap.utils.TimeUtils;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
@@ -79,7 +80,7 @@
jlog.info("getting session status of token type '{}'",
token.split(" ")[0]);
AuthenticationIface provider = getProvider(
- NamingUtils.getTokenType(token), null);
+ StringUtils.getTokenType(token), null);
if (provider == null)
// throw exception for missing type paramter
@@ -398,7 +399,7 @@
StatusCodes.PASSWORD_RESET_FAILED);
try {
- user.setPassword(crypto.produceSecureHash(newPassword));
+ user.setPassword(crypto.secureHash(newPassword));
}
catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
// throw new KorAPException(StatusCodes.ILLEGAL_ARGUMENT,
@@ -431,7 +432,7 @@
}
try {
- safePass = crypto.produceSecureHash(safePass);
+ safePass = crypto.secureHash(safePass);
}
catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
jlog.error("Encoding/Algorithm Error", e);
@@ -514,7 +515,7 @@
(String) safeMap.get(Attributes.PASSWORD), Attributes.PASSWORD);
String hash;
try {
- hash = crypto.produceSecureHash(safePass);
+ hash = crypto.secureHash(safePass);
}
catch (UnsupportedEncodingException | NoSuchAlgorithmException e) {
jlog.error("Encryption error", e);
@@ -789,7 +790,7 @@
private String cache_key (String input) throws KustvaktException {
try {
- return crypto.hash(KEY + "@" + input);
+ return crypto.secureHash(KEY + "@" + input);
}
catch (Exception e) {
jlog.error("illegal cache key input '{}'", input);
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java b/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java
index e8de6c7..9515c93 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java
@@ -12,6 +12,7 @@
import de.ids_mannheim.korap.user.TokenContext;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.utils.NamingUtils;
+import de.ids_mannheim.korap.utils.StringUtils;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;
import org.springframework.cache.annotation.CacheEvict;
@@ -41,7 +42,7 @@
@Override
public TokenContext getUserStatus (String authToken)
throws KustvaktException {
- authToken = NamingUtils.stripTokenType(authToken);
+ authToken = StringUtils.stripTokenType(authToken);
return this.database.getContext(authToken);
}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/KoralCollectionQueryBuilder.java b/src/main/java/de/ids_mannheim/korap/utils/KoralCollectionQueryBuilder.java
index 86ac337..4744e07 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/KoralCollectionQueryBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/KoralCollectionQueryBuilder.java
@@ -92,7 +92,10 @@
}
- public Object rebaseCollection () {
+ public Object rebaseCollection (JsonNode node) {
+ if (node != null)
+ return mergeWith(node);
+
if (this.builder.length() == 0 && this.base == null)
return null;
@@ -125,18 +128,26 @@
public JsonNode mergeWith (JsonNode node) {
if (this.base != null) {
- // check that collection non empty
if (node != null) {
JsonNode tobase = node.at("/collection");
JsonNode base = this.base.deepCopy();
- JsonNode result = JsonBuilder.buildDocGroup("and",
- base.at("/collection"), tobase);
+ JsonNode result = base.at("/collection");
+
+ if (result.isMissingNode() && !tobase.isMissingNode())
+ result = tobase;
+ else if (result.isMissingNode() && tobase.isMissingNode())
+ return base;
+ else {
+ result = JsonBuilder.buildDocGroup(
+ this.mergeOperator != null ? this.mergeOperator
+ .toLowerCase() : "and", result, tobase);
+ }
((ObjectNode) base).put("collection", result);
return base;
}
- return null;
+ return this.base;
}
- return null;
+ throw new RuntimeException("no query found to merge with!");
}
@@ -160,7 +171,12 @@
public String toJSON () {
- return JsonUtils.toJSON(rebaseCollection());
+ return JsonUtils.toJSON(rebaseCollection(null));
+ }
+
+
+ public String mergeToJSON (JsonNode node) {
+ return JsonUtils.toJSON(rebaseCollection(node));
}
@@ -170,22 +186,6 @@
}
- @Deprecated
- private KoralCollectionQueryBuilder appendToBaseGroup (JsonNode node) {
- if (base.at("/collection/@type").asText().equals("koral:docGroup")) {
- ArrayNode group = (ArrayNode) base.at("/collection/operands");
- if (node instanceof ArrayNode)
- group.addAll((ArrayNode) node);
- else
- group.add(node);
- }
- else
- throw new IllegalArgumentException("No group found to add to!");
- // fixme: if base is a doc only, this function is not supported. requirement is a koral:docGroup, since
- // combination operator is unknown otherwise
- return this;
- }
-
private static class JsonBuilder {
public static ObjectNode buildDoc (String key, String value) {
diff --git a/src/main/java/de/ids_mannheim/korap/utils/NamingUtils.java b/src/main/java/de/ids_mannheim/korap/utils/NamingUtils.java
index 52f8663..beafb32 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/NamingUtils.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/NamingUtils.java
@@ -10,62 +10,10 @@
*/
public class NamingUtils {
- private static final String SLASH = "/";
private NamingUtils () {}
- public static Collection<String> joinStringSet (Collection<String> source,
- String other) {
- Set<String> set = new HashSet<>(source);
- set.add(other);
- return set;
- }
-
-
- public static Collection<UUID> joinUUIDSet (Collection<UUID> source,
- UUID other) {
- Set<UUID> set = new HashSet<>(source);
- set.add(other);
- return set;
- }
-
-
- public static String joinResources (String first, String second) {
- String res;
- if (first != null && !first.isEmpty())
- res = first + SLASH + second;
- else
- res = second;
- return res.replaceAll("\\s", "");
- }
-
-
- public static String[] splitAnnotations (String joined) {
- String[] spl = joined.split(SLASH);
- if (spl.length == 2)
- return spl;
- else
- return null;
- }
-
-
- public static String stripTokenType (String token) {
- int idx = token.lastIndexOf(" ");
- if (idx == -1)
- return token;
- return token.substring(idx).replaceAll("\\s", "");
- }
-
-
- public static String getTokenType (String token) {
- if (token.contains(" "))
- return token.substring(0, token.lastIndexOf(" "))
- .replaceAll("\\s", "").toLowerCase();
- else
- return null;
- }
-
}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java b/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java
index e5ab428..f942250 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java
@@ -11,6 +11,7 @@
.getLogger(StringUtils.class);
private static final String SEP = ";";
+ private static final String SLASH = "/";
public static Collection<UUID> stringToUUIDList (String s) {
@@ -136,4 +137,72 @@
return StringEscapeUtils.unescapeHtml(value);
}
+
+ public static String getDocSigle (String textSigle) {
+ if (textSigle != null)
+ return textSigle.split("\\.")[0];
+ return null;
+ }
+
+
+ public static String getCorpusSigle (String textSigle) {
+ //WPD_SSS.07367
+ if (textSigle != null)
+ return textSigle.split("_")[0];
+ return null;
+ }
+
+
+ public static Collection<String> joinStringSet (Collection<String> source,
+ String other) {
+ Set<String> set = new HashSet<>(source);
+ set.add(other);
+ return set;
+ }
+
+
+ public static Collection<UUID> joinUUIDSet (Collection<UUID> source,
+ UUID other) {
+ Set<UUID> set = new HashSet<>(source);
+ set.add(other);
+ return set;
+ }
+
+
+ public static String joinResources (String first, String second) {
+ String res;
+ if (first != null && !first.isEmpty())
+ res = first + SLASH + second;
+ else
+ res = second;
+ return res.replaceAll("\\s", "");
+ }
+
+
+ public static String[] splitAnnotations (String joined) {
+ String[] spl = joined.split(SLASH);
+ if (spl.length == 2)
+ return spl;
+ else
+ return null;
+ }
+
+
+ public static String stripTokenType (String token) {
+ int idx = token.lastIndexOf(" ");
+ if (idx == -1)
+ return token;
+ return token.substring(idx).replaceAll("\\s", "");
+ }
+
+
+ public static String getTokenType (String token) {
+ if (token.contains(" "))
+ return token.substring(0, token.lastIndexOf(" "))
+ .replaceAll("\\s", "").toLowerCase();
+ else
+ return null;
+ }
+
+
}
diff --git a/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java b/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
index 4bc7055..70207fe 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
@@ -73,7 +73,7 @@
throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT);
try {
- pass = crypto.produceSecureHash(pass);
+ pass = crypto.secureHash(pass);
}
catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
throw new KustvaktException(StatusCodes.REQUEST_INVALID);
@@ -93,7 +93,7 @@
throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT);
try {
- pass = crypto.produceSecureHash(pass);
+ pass = crypto.secureHash(pass);
}
catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
throw new KustvaktException(StatusCodes.REQUEST_INVALID);
diff --git a/src/main/java/de/ids_mannheim/korap/web/filter/AdminFilter.java b/src/main/java/de/ids_mannheim/korap/web/filter/AdminFilter.java
index 29763fa..c06c3fe 100644
--- a/src/main/java/de/ids_mannheim/korap/web/filter/AdminFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/web/filter/AdminFilter.java
@@ -4,12 +4,14 @@
import com.sun.jersey.spi.container.ContainerRequestFilter;
import com.sun.jersey.spi.container.ContainerResponseFilter;
import com.sun.jersey.spi.container.ResourceFilter;
+import de.ids_mannheim.korap.config.AdminSetup;
import de.ids_mannheim.korap.config.BeansFactory;
+import de.ids_mannheim.korap.interfaces.EncryptionIface;
import de.ids_mannheim.korap.user.TokenContext;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.utils.NamingUtils;
import de.ids_mannheim.korap.utils.StringUtils;
-import de.ids_mannheim.korap.web.utils.KorAPContext;
+import de.ids_mannheim.korap.web.utils.KustvaktContext;
import de.ids_mannheim.korap.web.utils.KustvaktResponseHandler;
import javax.ws.rs.ext.Provider;
@@ -21,7 +23,6 @@
@Provider
public class AdminFilter implements ContainerRequestFilter, ResourceFilter {
- // check over ssl!
@Override
public ContainerRequest filter (ContainerRequest cr) {
// todo:
@@ -31,18 +32,24 @@
String authentication = cr
.getHeaderValue(ContainerRequest.AUTHORIZATION);
- if (authentication != null
- && authentication.endsWith(BeansFactory.getKustvaktContext()
- .getConfiguration().getAdminToken())) {
- TokenContext c = new TokenContext();
- c.setUsername(User.ADMINISTRATOR_NAME);
- c.setTokenType(NamingUtils.getTokenType(authentication));
- c.setToken(NamingUtils.stripTokenType(authentication));
- cr.setSecurityContext(new KorAPContext(c));
+ //if (authentication != null
+ // && authentication.endsWith(BeansFactory.getKustvaktContext()
+ // .getConfiguration().getAdminToken())) {
+ if (authentication != null && cr.isSecure()) {
+ String token = StringUtils.stripTokenType(authentication);
+ EncryptionIface crypto = BeansFactory.getKustvaktContext()
+ .getEncryption();
+
+ if (crypto.checkHash(token, AdminSetup.getInstance().getHash())) {
+ TokenContext c = new TokenContext();
+ c.setUsername(User.ADMINISTRATOR_NAME);
+ c.setTokenType(StringUtils.getTokenType(authentication));
+ c.setToken(StringUtils.stripTokenType(authentication));
+ cr.setSecurityContext(new KustvaktContext(c));
+ }
}
else
throw KustvaktResponseHandler.throwAuthenticationException();
-
return cr;
}
diff --git a/src/main/java/de/ids_mannheim/korap/web/filter/AuthFilter.java b/src/main/java/de/ids_mannheim/korap/web/filter/AuthFilter.java
index df3157b..194d76d 100644
--- a/src/main/java/de/ids_mannheim/korap/web/filter/AuthFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/web/filter/AuthFilter.java
@@ -8,7 +8,7 @@
import de.ids_mannheim.korap.exceptions.KustvaktException;
import de.ids_mannheim.korap.interfaces.AuthenticationManagerIface;
import de.ids_mannheim.korap.user.TokenContext;
-import de.ids_mannheim.korap.web.utils.KorAPContext;
+import de.ids_mannheim.korap.web.utils.KustvaktContext;
import de.ids_mannheim.korap.web.utils.KustvaktResponseHandler;
import javax.ws.rs.ext.Provider;
@@ -50,7 +50,7 @@
&& context.isValid()
&& ((context.isSecureRequired() && request.isSecure()) | !context
.isSecureRequired()))
- request.setSecurityContext(new KorAPContext(context));
+ request.setSecurityContext(new KustvaktContext(context));
else
throw KustvaktResponseHandler.throwAuthenticationException();
}
diff --git a/src/main/java/de/ids_mannheim/korap/web/filter/DefaultFilter.java b/src/main/java/de/ids_mannheim/korap/web/filter/DefaultFilter.java
index 107c5e1..708a649 100644
--- a/src/main/java/de/ids_mannheim/korap/web/filter/DefaultFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/web/filter/DefaultFilter.java
@@ -8,7 +8,7 @@
import de.ids_mannheim.korap.user.TokenContext;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.utils.TimeUtils;
-import de.ids_mannheim.korap.web.utils.KorAPContext;
+import de.ids_mannheim.korap.web.utils.KustvaktContext;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
@@ -42,8 +42,8 @@
// do nothing
}
if (pr == null)
- request.setSecurityContext(new KorAPContext(createShorterToken(
- host, ua)));
+ request.setSecurityContext(new KustvaktContext(
+ createShorterToken(host, ua)));
}
return request;
diff --git a/src/main/java/de/ids_mannheim/korap/web/filter/DemoFilter.java b/src/main/java/de/ids_mannheim/korap/web/filter/DemoFilter.java
index ff77428..2a06655 100644
--- a/src/main/java/de/ids_mannheim/korap/web/filter/DemoFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/web/filter/DemoFilter.java
@@ -7,7 +7,7 @@
import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
import de.ids_mannheim.korap.config.Attributes;
import de.ids_mannheim.korap.user.TokenContext;
-import de.ids_mannheim.korap.web.utils.KorAPContext;
+import de.ids_mannheim.korap.web.utils.KustvaktContext;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.ext.Provider;
@@ -41,7 +41,7 @@
context.setToken(token);
context.setTokenType(Attributes.BASIC_AUTHENTICATION);
context.setUsername("demo");
- return new KorAPContext(context);
+ return new KustvaktContext(context);
}
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java b/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java
index be4593f..ecb1133 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java
@@ -29,11 +29,12 @@
.toUser(KustvaktConfiguration.KUSTVAKT_USER);
KoralCollectionQueryBuilder bui = new KoralCollectionQueryBuilder();
- bui.with("creationDate since 1775");
+ bui.with("creationDate since 1775 & corpusSigle=GOE");
VirtualCollection c1 = new VirtualCollection();
c1.setName("Weimarer Werke");
- c1.addField(Attributes.QUERY, bui.toJSON());
+
+ c1.setFields(bui.toJSON());
c1.setDescription("Goethe-Werke in Weimar (seit 1775)");
@@ -42,7 +43,7 @@
VirtualCollection c2 = new VirtualCollection();
c2.setName("Aphorismen");
- c2.addField(Attributes.QUERY, bui.toJSON());
+ c2.setFields(bui.toJSON());
c2.setDescription("Aphorismentexte Goethes");
bui = new KoralCollectionQueryBuilder();
@@ -50,7 +51,7 @@
VirtualCollection c3 = new VirtualCollection();
c3.setName("Werther");
- c3.addField(Attributes.QUERY, bui.toJSON());
+ c3.setFields(bui.toJSON());
c3.setDescription("Goethe - Die Leiden des jungen Werther");
PolicyBuilder b = new PolicyBuilder(user);
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/AdminService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/AdminService.java
index 08fd322..21ac9b8 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/AdminService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/AdminService.java
@@ -26,6 +26,7 @@
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
@@ -42,7 +43,7 @@
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public class AdminService {
- private static Logger jlog = KustvaktLogger.getLogger(AdminService.class);
+ private static Logger jlog = LoggerFactory.getLogger(AdminService.class);
// todo: map in timeutils
private static DateTimeFormatter dtf = DateTimeFormat
.forPattern("dd/MM/yyyy");
@@ -136,9 +137,9 @@
}
- //fixme: documentservice?!
@POST
@Path("doc/{id}/add")
+ @Deprecated
public Response addDocument (@PathParam("id") String id) {
Document document = new Document(id);
try {
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/DocumentService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/DocumentService.java
index e1648d2..83dee9c 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/DocumentService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/DocumentService.java
@@ -11,6 +11,7 @@
import de.ids_mannheim.korap.web.filter.AdminFilter;
import de.ids_mannheim.korap.web.utils.KustvaktResponseHandler;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
@@ -26,8 +27,7 @@
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public class DocumentService {
- private static Logger jlog = KustvaktLogger
- .getLogger(DocumentService.class);
+ private static Logger jlog = LoggerFactory.getLogger(DocumentService.class);
private DocumentDao documentDao;
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
index 9b04a14..0c54bd8 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
@@ -63,7 +63,6 @@
this.config = BeansFactory.getKustvaktContext().getConfiguration();
this.resourceHandler = new ResourceHandler();
this.searchKrill = new SearchKrill(config.getIndexDir());
-
UriBuilder builder = UriBuilder.fromUri("http://10.0.10.13").port(9997);
this.graphDBhandler = new ClientsHandler(builder.build());
@@ -120,7 +119,7 @@
@Context Locale locale, @PathParam("type") String type,
@PathParam("id") String id, @PathParam("child") String child) {
return getResource(context, locale, type,
- NamingUtils.joinResources(id, child));
+ StringUtils.joinResources(id, child));
}
@@ -275,6 +274,7 @@
}
+ // ref query parameter removed!
@TRACE
@Path("search")
public Response buildQuery (@Context Locale locale,
@@ -284,20 +284,21 @@
@QueryParam("cutoff") Boolean cutoff,
@QueryParam("count") Integer pageLength,
@QueryParam("offset") Integer pageIndex,
- @QueryParam("page") Integer startPage,
- @QueryParam("ref") String reference, @QueryParam("cq") String cq) {
+ @QueryParam("page") Integer startPage, @QueryParam("cq") String cq) {
TokenContext ctx = (TokenContext) securityContext.getUserPrincipal();
QuerySerializer ss;
- User user;
- try {
- user = controller.getUser(ctx.getUsername());
- }
- catch (KustvaktException e) {
- throw KustvaktResponseHandler.throwit(e);
- }
+ //User user;
+ //try {
+ // user = controller.getUser(ctx.getUsername());
+ //}
+ //catch (KustvaktException e) {
+ // throw KustvaktResponseHandler.throwit(e);
+ //}
ss = new QuerySerializer().setQuery(q, ql, v);
+ if (cq != null)
+ ss.setCollection(cq);
MetaQueryBuilder meta = new MetaQueryBuilder();
if (pageIndex != null)
@@ -310,10 +311,10 @@
meta.setSpanContext(context);
meta.addEntry("cutOff", cutoff);
- ss.setMeta(meta);
-
- String query = this.processor.processQuery(ss.toJSON(), user);
- return Response.ok(query).build();
+ ss.setMeta(meta.raw());
+ //fixme: parsing should be done only in search functions!
+ //String query = this.processor.processQuery(ss.toJSON(), user);
+ return Response.ok(ss.toJSON()).build();
}
@@ -331,10 +332,10 @@
* @return
*/
- //todo: does cq have any sensible worth here?
+ //todo: does cq have any sensible worth here? --> would say no! --> is useful in non type/id scenarios
@TRACE
@Path("{type}/{id}/search")
- public Response buildQuery (@Context Locale locale,
+ public Response buildQueryWithId (@Context Locale locale,
@Context SecurityContext securityContext,
@QueryParam("q") String q, @QueryParam("ql") String ql,
@QueryParam("v") String v, @QueryParam("context") String context,
@@ -342,8 +343,7 @@
@QueryParam("count") Integer pageLength,
@QueryParam("offset") Integer pageIndex,
@QueryParam("page") Integer startPage,
- @PathParam("type") String type, @PathParam("id") String id,
- @QueryParam("cq") String cq) {
+ @PathParam("type") String type, @PathParam("id") String id) {
TokenContext ctx = (TokenContext) securityContext.getUserPrincipal();
type = StringUtils.normalize(type);
id = StringUtils.decodeHTML(id);
@@ -363,40 +363,38 @@
meta.addEntry("cutOff", cutoff);
ss.setMeta(meta.raw());
- if (cq != null)
- ss.setCollection(cq);
KoralCollectionQueryBuilder cquery = new KoralCollectionQueryBuilder();
cquery.setBaseQuery(ss.toJSON());
+ String query = "";
+ KustvaktResource resource;
try {
User user = controller.getUser(ctx.getUsername());
- //todo: instead of throwing exception, build notification and rewrites into result query
- KustvaktResource resource;
if (StringUtils.isInteger(id))
resource = this.resourceHandler.findbyIntId(
Integer.valueOf(id), user);
else
resource = this.resourceHandler.findbyStrId(id, user,
ResourceFactory.getResourceClass(type));
-
- // todo: test this
- if (resource instanceof VirtualCollection)
- cquery.mergeWith(resource.getData());
- else if (resource instanceof Corpus)
- cquery.with(Attributes.CORPUS_SIGLE
- + resource.getPersistentID());
-
}
catch (KustvaktException e) {
- jlog.error("Exception encountered!", e);
- //throw KustvaktResponseHandler.throwit(e);
+ //todo: instead of throwing exception, build notification and rewrites into result query
+ jlog.error("Exception encountered!");
+ throw KustvaktResponseHandler.throwit(e);
}
-
- // todo: policy parsing before return
- return Response.ok(ss.toJSON()).build();
+ if (resource != null) {
+ if (resource instanceof VirtualCollection)
+ query = cquery.and().mergeToJSON(resource.getData());
+ else if (resource instanceof Corpus) {
+ cquery.and().with(
+ Attributes.CORPUS_SIGLE + resource.getPersistentID());
+ query = cquery.toJSON();
+ }
+ }
+ return Response.ok(query).build();
}
@@ -410,7 +408,7 @@
// todo: should be possible to add the meta part to the query serialization
try {
User user = controller.getUser(ctx.getUsername());
- jsonld = this.processor.processQuery(jsonld, user);
+ //jsonld = this.processor.processQuery(jsonld, user);
}
catch (KustvaktException e) {
throw KustvaktResponseHandler.throwit(e);
@@ -418,6 +416,7 @@
jlog.info("Serialized search: {}", jsonld);
String result = searchKrill.search(jsonld);
+ // todo: logging
KustvaktLogger.QUERY_LOGGER.trace("The result set: {}", result);
return Response.ok(result).build();
}
@@ -436,10 +435,8 @@
@QueryParam("cq") String cq, @QueryParam("engine") String engine) {
TokenContext context = (TokenContext) securityContext
.getUserPrincipal();
- KoralCollectionQueryBuilder cquery = new KoralCollectionQueryBuilder();
KustvaktConfiguration.BACKENDS eng = this.config.chooseBackend(engine);
User user;
- // todo: not added to query!!
try {
user = controller.getUser(context.getUsername());
}
@@ -451,10 +448,8 @@
QuerySerializer serializer = new QuerySerializer();
serializer.setQuery(q, ql, v);
- // todo: parse for security reasons
- // todo: remove cq parameter
- // if (cq != null)
- // serializer.setCollection(cq);
+ if (cq != null)
+ serializer.setCollection(cq);
MetaQueryBuilder meta = new MetaQueryBuilder();
meta.addEntry("startIndex", pageIndex);
@@ -468,8 +463,8 @@
// meta.addEntry("itemsPerResource", 1);
serializer.setMeta(meta.raw());
- //fixme: policy rewrite!
String query = this.processor.processQuery(serializer.toJSON(), user);
+ //String query = serializer.toJSON();
jlog.info("the serialized query {}", query);
@@ -489,7 +484,7 @@
}
}
else
- result = searchKrill.search(query);
+ result = searchKrill.search(serializer.toJSON());
KustvaktLogger.QUERY_LOGGER.trace("The result set: {}", result);
return Response.ok(result).build();
}
@@ -567,7 +562,7 @@
meta.addEntry("cutoff", cutoff);
// should only apply to CQL queries
// meta.addEntry("itemsPerResource", 1);
- s.setMeta(meta);
+ s.setMeta(meta.raw());
query = s.toJSON();
// PolicyParser parser = new PolicyParser(user);
@@ -633,11 +628,11 @@
@GET
@Path("{type}/{id}/{child}/stats")
- public Response getStatisticsbyName (@Context SecurityContext context,
+ public Response getStatisticsbyIdChild (@Context SecurityContext context,
@Context Locale locale, @PathParam("type") String type,
@PathParam("id") String id, @PathParam("child") String child) {
return getStatisticsbyId(context, locale, type,
- NamingUtils.joinResources(id, child));
+ StringUtils.joinResources(id, child));
}
@@ -928,7 +923,7 @@
@Context Locale locale, @PathParam("type") String type,
@PathParam("id") String id, @PathParam("child") String child) {
return deleteResource(context, locale, type,
- NamingUtils.joinResources(id, child));
+ StringUtils.joinResources(id, child));
}
@@ -998,7 +993,7 @@
if (!manager.isAllowed())
continue;
- String[] sep = NamingUtils.splitAnnotations(spl);
+ String[] sep = StringUtils.splitAnnotations(spl);
if (spl != null) {
f_list.add(sep[0]);
l_list.add(sep[1]);
@@ -1035,7 +1030,7 @@
foundries = new HashSet<>();
layers = new HashSet<>();
for (Layer r : resources) {
- String[] spl = NamingUtils.splitAnnotations(r.getName());
+ String[] spl = StringUtils.splitAnnotations(r.getName());
if (spl != null) {
foundries.add(spl[0]);
layers.add(spl[1]);
@@ -1061,7 +1056,7 @@
// todo:?!
@POST
- @Path("match/{id}/save")
+ @Path("match/{id}")
@Deprecated
public Response save (@PathParam("{id}") String id,
@QueryParam("d") String description,
@@ -1093,8 +1088,8 @@
}
- @POST
- @Path("match/{id}/delete")
+ @DELETE
+ @Path("match/{id}")
@Deprecated
public Response remove (@PathParam("{id}") String id,
@Context SecurityContext context) {
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java b/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
index b55cb45..7c3b346 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
@@ -98,7 +98,7 @@
meta.addEntry("count", pageLength);
meta.setSpanContext(context);
meta.addEntry("cutOff", cutoff);
- ss.setMeta(meta);
+ ss.setMeta(meta.raw());
if (cq != null)
ss.setCollection(cq);
return Response.ok(processor.processQuery(ss.toJSON(), null)).build();
@@ -138,7 +138,7 @@
pageInteger, pageLength, ctx, cutoff);
if (fields != null && !fields.isEmpty())
meta.addEntry("fields", fields);
- serializer.setMeta(meta);
+ serializer.setMeta(meta.raw());
if (cq != null)
serializer.setCollection(cq);
@@ -212,7 +212,7 @@
// should only apply to CQL queries
// meta.addEntry("itemsPerResource", 1);
QuerySerializer s = new QuerySerializer().setQuery(query, ql, v)
- .setMeta(meta);
+ .setMeta(meta.raw());
query = processor.processQuery(s.toJSON(), null);
}
String result;
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/KorAPContext.java b/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktContext.java
similarity index 86%
rename from src/main/java/de/ids_mannheim/korap/web/utils/KorAPContext.java
rename to src/main/java/de/ids_mannheim/korap/web/utils/KustvaktContext.java
index 2424d4b..f34cd43 100644
--- a/src/main/java/de/ids_mannheim/korap/web/utils/KorAPContext.java
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktContext.java
@@ -12,12 +12,12 @@
* wrapper for REST security context
*
*/
-public class KorAPContext implements SecurityContext {
+public class KustvaktContext implements SecurityContext {
private TokenContext user;
- public KorAPContext (final TokenContext user) {
+ public KustvaktContext (final TokenContext user) {
this.user = user;
}
diff --git a/src/main/resources/codes.kustvakt b/src/main/resources/codes.kustvakt
new file mode 100644
index 0000000..01fa0d8
--- /dev/null
+++ b/src/main/resources/codes.kustvakt
@@ -0,0 +1,2 @@
+[{code=100, message=}
+]
\ No newline at end of file
diff --git a/src/main/resources/db/sqlite/V1__Initial_version.sql b/src/main/resources/db/sqlite/V1__Initial_version.sql
index d109779..eaa32ff 100644
--- a/src/main/resources/db/sqlite/V1__Initial_version.sql
+++ b/src/main/resources/db/sqlite/V1__Initial_version.sql
@@ -86,6 +86,7 @@
CREATE TABLE IF NOT EXISTS doc_store (
id INTEGER PRIMARY KEY AUTOINCREMENT,
persistent_id VARCHAR(100) UNIQUE,
+doc_sigle VARCHAR(100),
created BIGINT NOT NULL DEFAULT CURRENT_TIMESTAMP,
disabled BOOLEAN DEFAULT TRUE
);
diff --git a/src/test/java/CollectionQueryBuilderTest.java b/src/test/java/CollectionQueryBuilderTest.java
index f895962..78739c7 100644
--- a/src/test/java/CollectionQueryBuilderTest.java
+++ b/src/test/java/CollectionQueryBuilderTest.java
@@ -1,5 +1,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import de.ids_mannheim.korap.query.serialize.QuerySerializer;
+import de.ids_mannheim.korap.resources.KustvaktResource;
+import de.ids_mannheim.korap.resources.VirtualCollection;
import de.ids_mannheim.korap.utils.KoralCollectionQueryBuilder;
import de.ids_mannheim.korap.utils.JsonUtils;
import org.junit.Ignore;
@@ -143,7 +145,7 @@
b.setBaseQuery(check.toJSON());
b.with("textClass=freizeit");
- JsonNode res = (JsonNode) b.rebaseCollection();
+ JsonNode res = (JsonNode) b.rebaseCollection(null);
assertNotNull(res);
assertEquals("koral:docGroup", res.at("/collection/@type").asText());
assertEquals("operation:and", res.at("/collection/operation").asText());
@@ -176,7 +178,7 @@
c.setBaseQuery(b.toJSON());
c.with("corpusSigle=BRZ13");
- JsonNode base = (JsonNode) c.rebaseCollection();
+ JsonNode base = (JsonNode) c.rebaseCollection(null);
assertNotNull(base);
assertEquals(base.at("/collection/@type").asText(), "koral:docGroup");
assertEquals(base.at("/collection/operands/1/@type").asText(),
@@ -201,7 +203,7 @@
KoralCollectionQueryBuilder test = new KoralCollectionQueryBuilder();
test.with("textClass=wissenschaft | textClass=politik");
- JsonNode node = (JsonNode) test.rebaseCollection();
+ JsonNode node = (JsonNode) test.rebaseCollection(null);
node = b.mergeWith(node);
assertNotNull(node);
assertEquals("koral:docGroup", node.at("/collection/@type").asText());
@@ -227,7 +229,7 @@
KoralCollectionQueryBuilder test = new KoralCollectionQueryBuilder();
test.setBaseQuery(check.toJSON());
test.or().with("textClass=wissenschaft | textClass=politik");
- JsonNode node = (JsonNode) test.rebaseCollection();
+ JsonNode node = (JsonNode) test.rebaseCollection(null);
assertNotNull(node);
assertEquals("koral:docGroup", node.at("/collection/@type").asText());
assertEquals("operation:or", node.at("/collection/operation").asText());
@@ -246,7 +248,7 @@
KoralCollectionQueryBuilder test = new KoralCollectionQueryBuilder();
test.setBaseQuery(check.toJSON());
test.and().with("textClass=wissenschaft | textClass=politik");
- JsonNode node = (JsonNode) test.rebaseCollection();
+ JsonNode node = (JsonNode) test.rebaseCollection(null);
assertNotNull(node);
assertEquals("koral:docGroup", node.at("/collection/@type").asText());
assertEquals("operation:and", node.at("/collection/operation").asText());
@@ -265,7 +267,7 @@
KoralCollectionQueryBuilder test = new KoralCollectionQueryBuilder();
test.setBaseQuery(check.toJSON());
test.with("textClass=wissenschaft | textClass=politik");
- JsonNode node = (JsonNode) test.rebaseCollection();
+ JsonNode node = (JsonNode) test.rebaseCollection(null);
assertNotNull(node);
assertEquals("koral:docGroup", node.at("/collection/@type").asText());
assertEquals("operation:and", node.at("/collection/operation").asText());
@@ -274,25 +276,92 @@
@Test
- @Ignore
- public void testMergeOperator () {
- String coll = "corpusSigle=WPD";
- String query = "[base=Haus]";
- QuerySerializer check = new QuerySerializer();
- check.setQuery(query, "poliqarp");
- check.setCollection(coll);
+ public void testCollectionMergeWithFromResource () {
+ KoralCollectionQueryBuilder builder = new KoralCollectionQueryBuilder();
+ builder.with("textClass=politik & corpusSigle=WPD");
+ KustvaktResource resource = new VirtualCollection();
+ resource.setName("collection_1");
+ String json = builder.toJSON();
+ resource.setFields(json);
- KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
- b.setBaseQuery(check.toJSON());
+ assertEquals(json, resource.getStringData());
+ builder = new KoralCollectionQueryBuilder();
+ builder.setBaseQuery(resource.getData());
+ builder.or().with("pubPlace=Mannheim");
+ }
- KoralCollectionQueryBuilder test = new KoralCollectionQueryBuilder();
- test.with("textClass=wissenschaft | textClass=politik");
- JsonNode node = (JsonNode) test.rebaseCollection();
- node = b.mergeWith(node);
+
+ @Test
+ public void testCollectionMergeFromQuerySerializer () {
+ QuerySerializer s = new QuerySerializer();
+ s.setQuery("[base=Haus]", "poliqarp");
+ KoralCollectionQueryBuilder total = new KoralCollectionQueryBuilder();
+ total.setBaseQuery(s.toJSON());
+
+
+ KoralCollectionQueryBuilder builder = new KoralCollectionQueryBuilder();
+ builder.with("textClass=politik & corpusSigle=WPD");
+ KustvaktResource resource = new VirtualCollection();
+ resource.setName("collection_1");
+ String json = builder.toJSON();
+ resource.setFields(json);
+ // operator is irrelevant here
+ JsonNode node = total.or().mergeWith(resource.getData());
assertNotNull(node);
assertEquals("koral:docGroup", node.at("/collection/@type").asText());
assertEquals("operation:and", node.at("/collection/operation").asText());
- assertEquals(2, node.at("/collection/operands").size());
+ assertEquals("textClass", node.at("/collection/operands/0/key")
+ .asText());
+ assertEquals("corpusSigle", node.at("/collection/operands/1/key")
+ .asText());
}
+
+ @Test
+ public void testBaseCollectionNull () {
+ // base is missing collection segment
+ QuerySerializer s = new QuerySerializer();
+ s.setQuery("[base=Haus]", "poliqarp");
+
+ KoralCollectionQueryBuilder total = new KoralCollectionQueryBuilder();
+ total.setBaseQuery(s.toJSON());
+
+ KoralCollectionQueryBuilder builder = new KoralCollectionQueryBuilder();
+ builder.with("textClass=politik & corpusSigle=WPD");
+ JsonNode node = total.and().mergeWith(
+ (JsonNode) builder.rebaseCollection(null));
+
+ assertNotNull(node);
+ assertEquals("koral:docGroup", node.at("/collection/@type").asText());
+ assertEquals("operation:and", node.at("/collection/operation").asText());
+ assertEquals("koral:doc", node.at("/collection/operands/0/@type")
+ .asText());
+ assertEquals("koral:doc", node.at("/collection/operands/1/@type")
+ .asText());
+ assertEquals("textClass", node.at("/collection/operands/0/key")
+ .asText());
+ assertEquals("corpusSigle", node.at("/collection/operands/1/key")
+ .asText());
+ }
+
+
+ @Test
+ public void testMergeCollectionNull () {
+ // merge json is missing collection segment
+ QuerySerializer s = new QuerySerializer();
+ s.setQuery("[base=Haus]", "poliqarp");
+ s.setCollection("textClass=wissenschaft");
+
+ KoralCollectionQueryBuilder total = new KoralCollectionQueryBuilder();
+ total.setBaseQuery(s.toJSON());
+
+ KoralCollectionQueryBuilder builder = new KoralCollectionQueryBuilder();
+ JsonNode node = total.and().mergeWith(
+ (JsonNode) builder.rebaseCollection(null));
+ assertNotNull(node);
+ assertEquals("koral:doc", node.at("/collection/@type").asText());
+ assertEquals("textClass", node.at("/collection/key").asText());
+ }
+
+
}
diff --git a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
index c11b7e3..5070bfe 100644
--- a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
@@ -1,11 +1,21 @@
package de.ids_mannheim.korap.config;
import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.interfaces.EncryptionIface;
import de.ids_mannheim.korap.utils.ServiceInfo;
import de.ids_mannheim.korap.utils.TimeUtils;
import de.ids_mannheim.korap.web.service.BootableBeanInterface;
+import de.ids_mannheim.korap.web.service.full.AdminService;
+import org.apache.lucene.util.IOUtils;
+import org.codehaus.plexus.util.IOUtil;
+import org.junit.Assert;
import org.junit.Test;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -18,6 +28,22 @@
*/
public class ConfigTest extends BeanConfigTest {
+
+ @Test
+ public void testAdminHash () throws IOException, KustvaktException,
+ NoSuchAlgorithmException {
+ AdminSetup setup = AdminSetup.getInstance();
+ String hash = setup.getHash();
+ File f = new File("./admin_token");
+ FileInputStream stream = new FileInputStream(f);
+ String token = IOUtil.toString(stream);
+ assertNotEquals("", hash);
+ assertNotEquals("", token);
+ EncryptionIface crypto = helper().getContext().getEncryption();
+ assertTrue(crypto.checkHash(token, hash));
+ }
+
+
@Test
public void testServiceInfo () {
String version = ServiceInfo.getInfo().getVersion();
diff --git a/src/test/java/de/ids_mannheim/korap/config/StringUtilsTest.java b/src/test/java/de/ids_mannheim/korap/config/StringUtilsTest.java
new file mode 100644
index 0000000..c77184c
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/config/StringUtilsTest.java
@@ -0,0 +1,26 @@
+package de.ids_mannheim.korap.config;
+
+import de.ids_mannheim.korap.utils.StringUtils;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Created by hanl on 29.05.16.
+ */
+public class StringUtilsTest {
+
+ @Test
+ public void testTextIToDoc () {
+ String textSigle = "WPD_AAA.02439";
+ String docSigle = "WPD_AAA";
+ assertEquals(docSigle, StringUtils.getDocSigle(textSigle));
+ assertEquals(docSigle, StringUtils.getDocSigle(docSigle));
+ }
+
+
+ @Test
+ public void testSQLRegexBuild () {
+
+ }
+}
diff --git a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
index 2c36b66..b51e0b3 100644
--- a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
+++ b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
@@ -124,7 +124,7 @@
try {
String hash = ((EncryptionIface) getBean(ContextHolder.KUSTVAKT_ENCRYPTION))
- .produceSecureHash(password);
+ .secureHash(password);
m.put(Attributes.PASSWORD, hash);
}
catch (NoSuchAlgorithmException | UnsupportedEncodingException
diff --git a/src/test/java/de/ids_mannheim/korap/config/TestVariables.java b/src/test/java/de/ids_mannheim/korap/config/TestVariables.java
new file mode 100644
index 0000000..1e157a5
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/config/TestVariables.java
@@ -0,0 +1,473 @@
+package de.ids_mannheim.korap.config;
+
+/**
+ * Created by hanl on 30.05.16.
+ */
+public class TestVariables {
+
+ public static final String SIMPLE_ADD_QUERY = "[pos=ADJA]";
+
+ public static final String RESULT = "{\n"
+ + "\t\"@context\": \"http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld\",\n"
+ + "\t\"meta\": {\n"
+ + "\t\t\"count\": 25,\n"
+ + "\t\t\"startIndex\": 0,\n"
+ + "\t\t\"timeout\": 120000,\n"
+ + "\t\t\"context\": {\n"
+ + "\t\t\t\"left\": [\"token\", 6],\n"
+ + "\t\t\t\"right\": [\"token\", 6]\n"
+ + "\t\t},\n"
+ + "\t\t\"fields\": [\"pubDate\", \"subTitle\", \"author\", \"pubPlace\", \"title\", \"textSigle\", \"UID\", \"ID\", \"layerInfos\", \"corpusSigle\", \"docSigle\", \"corpusID\", \"textClass\"],\n"
+ + "\t\t\"version\": \"0.55.5\",\n"
+ + "\t\t\"benchmark\": \"0.117436617 s\",\n"
+ + "\t\t\"totalResults\": 31,\n"
+ + "\t\t\"serialQuery\": \"tokens:s:das\",\n"
+ + "\t\t\"itemsPerPage\": 25\n"
+ + "\t},\n"
+ + "\t\"query\": {\n"
+ + "\t\t\"@type\": \"koral:token\",\n"
+ + "\t\t\"wrap\": {\n"
+ + "\t\t\t\"@type\": \"koral:term\",\n"
+ + "\t\t\t\"key\": \"das\",\n"
+ + "\t\t\t\"layer\": \"orth\",\n"
+ + "\t\t\t\"match\": \"match:eq\",\n"
+ + "\t\t\t\"foundry\": \"opennlp\",\n"
+ + "\t\t\t\"rewrites\": [{\n"
+ + "\t\t\t\t\"@type\": \"koral:rewrite\",\n"
+ + "\t\t\t\t\"src\": \"Kustvakt\",\n"
+ + "\t\t\t\t\"operation\": \"operation:injection\",\n"
+ + "\t\t\t\t\"scope\": \"foundry\"\n"
+ + "\t\t\t}]\n"
+ + "\t\t},\n"
+ + "\t\t\"idn\": \"das_0\",\n"
+ + "\t\t\"rewrites\": [{\n"
+ + "\t\t\t\"@type\": \"koral:rewrite\",\n"
+ + "\t\t\t\"src\": \"Kustvakt\",\n"
+ + "\t\t\t\"operation\": \"operation:injection\",\n"
+ + "\t\t\t\"scope\": \"idn\"\n"
+ + "\t\t}]\n"
+ + "\t},\n"
+ + "\t\"collection\": {\n"
+ + "\t\t\"@type\": \"koral:docGroup\",\n"
+ + "\t\t\"operation\": \"operation:or\",\n"
+ + "\t\t\"operands\": [{\n"
+ + "\t\t\t\"@type\": \"koral:doc\",\n"
+ + "\t\t\t\"key\": \"corpusSigle\",\n"
+ + "\t\t\t\"value\": \"GOE\",\n"
+ + "\t\t\t\"match\": \"match:eq\"\n"
+ + "\t\t}, {\n"
+ + "\t\t\t\"@type\": \"koral:doc\",\n"
+ + "\t\t\t\"key\": \"corpusSigle\",\n"
+ + "\t\t\t\"value\": \"WPD\",\n"
+ + "\t\t\t\"match\": \"match:eq\"\n"
+ + "\t\t}],\n"
+ + "\t\t\"rewrites\": [{\n"
+ + "\t\t\t\"@type\": \"koral:rewrite\",\n"
+ + "\t\t\t\"src\": \"Kustvakt\",\n"
+ + "\t\t\t\"operation\": \"operation:insertion\",\n"
+ + "\t\t\t\"scope\": \"corpusSigle\"\n"
+ + "\t\t}]\n"
+ + "\t},\n"
+ + "\t\"matches\": [{\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00004\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A (Logik)\",\n"
+ + "\t\t\"author\": \"Zenogantner; ElRaki; 1\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>z.B. mit dem Wort Barbara" bezeichnet, </span><mark>das</mark><span class=\\\"context-right\\\"> dreimal den Buchstaben a enthält, aber<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00004-p195-196\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"kultur musik freizeit-unterhaltung reisen\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.02439\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"Aegukka\",\n"
+ + "\t\t\"author\": \"ThorstenS; 2\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>wörtlich "Das Lied der Liebe für </span><mark>das</mark><span class=\\\"context-right\\\"> Land", oder "Das patriotische Lied". Es<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.02439-p22-23\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"kultur musik freizeit-unterhaltung reisen\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.02439\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"Aegukka\",\n"
+ + "\t\t\"author\": \"ThorstenS; 2\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Besatzungszeit von 1910 bis 1945 wurde </span><mark>das</mark><span class=\\\"context-right\\\"> Lied verboten. Im Ausland lebende Koreaner<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.02439-p74-75\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"kultur musik freizeit-unterhaltung reisen\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.02439\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"Aegukka\",\n"
+ + "\t\t\"author\": \"ThorstenS; 2\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>3. Deutsche Übersetzung 1. Strophe Bis </span><mark>das</mark><span class=\\\"context-right\\\"> Meer des Ostens ausdörrt und der<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.02439-p298-299\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Ausnahme von Fremdwörtern und Namen ist </span><mark>das</mark><span class=\\\"context-right\\\"> A der einzige Buchstabe im Deutschen<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p41-42\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>flache Stellung niedergedrückt wird. Stellt man </span><mark>das</mark><span class=\\\"context-right\\\"> Verhältnis der drei Hauptvokale a, i<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p107-108\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>kommt i als der hellste an </span><mark>das</mark><span class=\\\"context-right\\\"> obere, u als der dumpfeste an<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p127-128\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>obere, u als der dumpfeste an </span><mark>das</mark><span class=\\\"context-right\\\"> untere Ende, a als der mittlere<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p134-135\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>im 9. Jahrhundert v. Chr. war </span><mark>das</mark><span class=\\\"context-right\\\"> Schriftzeichen bereits stark stilisiert, die Hörner<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p271-272\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>im Alphabet inne. Als die Griechen </span><mark>das</mark><span class=\\\"context-right\\\"> Phönizische Alphabet übernamen, drehten sie das<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p313-314\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>das Phönizische Alphabet übernamen, drehten sie </span><mark>das</mark><span class=\\\"context-right\\\"> Zeichen um 90 Grad und machten<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p319-320\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>um 90 Grad und machten daraus </span><mark>das</mark><span class=\\\"context-right\\\"> Alpha. Da das Griechische reich an<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p327-328\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>und machten daraus das Alpha. Da </span><mark>das</mark><span class=\\\"context-right\\\"> Griechische reich an Vokalen war, verwendeten<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p330-331\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>reich an Vokalen war, verwendeten sie </span><mark>das</mark><span class=\\\"context-right\\\"> Zeichen für den Lautwert a. Die<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p338-339\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>den Lautwert a. Die Etrusker übernahmen </span><mark>das</mark><span class=\\\"context-right\\\"> frühgriechische Alpha und ließen es größtenteils<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p347-348\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>von rechts nach links) versahen sie </span><mark>das</mark><span class=\\\"context-right\\\"> Zeichen mit einem Abschwung nach links<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p365-366\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Abschwung nach links. Als die Römer </span><mark>das</mark><span class=\\\"context-right\\\"> lateinische Alphabet schufen, verwendeten sie das<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p375-376\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>das lateinische Alphabet schufen, verwendeten sie </span><mark>das</mark><span class=\\\"context-right\\\"> A aus dem etruskischen Alphabet, der<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p381-382\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>in der Biologie steht A für </span><mark>das</mark><span class=\\\"context-right\\\"> Nukleosid Adenosin steht A die Base<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p404-405\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Wert 10, siehe auch Hexadezimalsystem. steht </span><mark>das</mark><span class=\\\"context-right\\\"> Symbol ∀ (ein auf den Kopf gestelltes<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p526-527\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>für die Vorsilbe Atto ist A </span><mark>das</mark><span class=\\\"context-right\\\"> Einheitensymbol der elektrischen Stromstärke Ampere in<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p624-625\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Anordnung (Rechtswesen), Agent (Börse), Aufzeichung (Rechtsw.), </span><mark>das</mark><span class=\\\"context-right\\\"> Flächenmaß Acre und Ausgabe A ist<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p757-758\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Band). in Redewendungen für den Anfang (</span><mark>das</mark><span class=\\\"context-right\\\"> A und O, von A bis<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p777-778\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Z). a ist die Abkürzung für </span><mark>das</mark><span class=\\\"context-right\\\"> Flächenmaß Ar in der Kaufmannssprache bedeutet<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p790-791\",\n"
+ + "\t\t\"UID\": 0,\n"
+ + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}, {\n"
+ + "\t\t\"field\": \"tokens\",\n"
+ + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
+ + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
+ + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
+ + "\t\t\"docSigle\": \"WPD_AAA\",\n"
+ + "\t\t\"corpusSigle\": \"WPD\",\n"
+ + "\t\t\"title\": \"A\",\n"
+ + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
+ + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
+ + "\t\t\"startMore\": true,\n"
+ + "\t\t\"endMore\": true,\n"
+ + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>ad zu) ‚[das Stück] zu...‘ für </span><mark>das</mark><span class=\\\"context-right\\\"> Französische à „nach“, z. B. in<span class=\\\"more\\\"></span></span>\",\n"
+ + "\t\t\"matchID\": \"match-WPD_AAA.00001-p805-806\",\n"
+ + "\t\t\"UID\": 0,\n" + "\t\t\"pubDate\": \"2005-03-28\"\n"
+ + "\t}]\n" + "}";
+
+
+}
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
index b3387c6..8061071 100644
--- a/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
@@ -9,6 +9,8 @@
import java.util.List;
+import static org.junit.Assert.*;
+
/**
* @author hanl
* @date 12/11/2015
@@ -33,79 +35,83 @@
@Test
- public void testGet () {
+ public void testGet () throws KustvaktException {
Document doc = new Document("BRZ13_APR.00002");
doc.setDisabled(true);
- try {
- dao.storeResource(doc, null);
- Document doc1 = dao.findbyId(doc.getPersistentID(), null);
- assert doc1 != null && doc.isDisabled();
- }
- catch (KustvaktException e) {
- e.printStackTrace();
- }
+ dao.storeResource(doc, null);
+ Document doc1 = dao.findbyId(doc.getPersistentID(), null);
+ assertNotNull(doc1);
+ assertTrue(doc.isDisabled());
}
@Test
- public void testRemove () {
+ public void testRemove () throws KustvaktException {
Document doc = new Document("BRZ13_APR.00003");
doc.setDisabled(true);
- try {
- dao.storeResource(doc, null);
- Document doc1 = dao.findbyId(doc.getPersistentID(), null);
- assert dao.deleteResource(doc.getPersistentID(), null) == 1;
- doc1 = dao.findbyId(doc.getPersistentID(), null);
- assert doc1 == null;
- }
- catch (KustvaktException e) {
- e.printStackTrace();
-
- }
+ dao.storeResource(doc, null);
+ Document doc1 = dao.findbyId(doc.getPersistentID(), null);
+ assertEquals(1, dao.deleteResource(doc.getPersistentID(), null));
+ doc1 = dao.findbyId(doc.getPersistentID(), null);
+ Assert.assertNull(doc1);
}
@Test
- public void testEmptyFind () {
- List<String> dc = null;
- try {
- dc = dao.findbyCorpus("WPD", true);
- }
- catch (KustvaktException e) {
- e.printStackTrace();
- }
-
- Assert.assertNotNull(dc);
- Assert.assertEquals("should be empty", 0, dc.size());
+ public void testEmptyFind () throws KustvaktException {
+ List<String> dc = dao.findbyCorpus("WPD", true);
+ assertNotNull(dc);
+ assertEquals("should be empty", 0, dc.size());
}
@Test
- public void testFind () {
+ public void testFindText () throws KustvaktException {
int length = 10;
for (int i = 0; i < length; i++) {
Document doc = new Document("WPD_APR.0000" + i);
doc.setDisabled(true);
- try {
- dao.storeResource(doc, null);
- }
- catch (KustvaktException e) {
- e.printStackTrace();
- break;
- }
+ dao.storeResource(doc, null);
}
+ List<String> dc = dao.findbyCorpus("WPD", true);
- List<String> dc = null;
- try {
- dc = dao.findbyCorpus("WPD", true);
- }
- catch (KustvaktException e) {
- e.printStackTrace();
- }
+ assertNotNull(dc);
+ assertNotSame("should not be empty", 0, dc.size());
+ assertEquals("not all found", length, dc.size());
+ }
- Assert.assertNotNull(dc);
- Assert.assertNotSame("should not be empty", 0, dc.size());
- Assert.assertEquals("not all found", length, dc.size());
+
+ @Test
+ public void testFindDocByText () throws KustvaktException {
+ Document doc = new Document("WPD_AAA", "WPD_AAA.02439");
+ doc.setDisabled(true);
+ dao.storeResource(doc, null);
+
+ Document dfind = dao.findbyId(doc.getPersistentID(), null);
+ assertNotNull(dfind);
+ assertEquals(doc.getPersistentID(), dfind.getPersistentID());
+ }
+
+
+ @Test
+ public void testFindDocByPartial () throws KustvaktException {
+ Document doc = new Document("WPD_AAA.02439");
+ doc.setDisabled(true);
+ Document doc1 = new Document("WPD_AAA.02343");
+ dao.storeResource(doc, null);
+ dao.storeResource(doc1, null);
+
+ List<Document> dfind = dao.findbyPartialId(doc.getDocSigle(), null);
+ assertNotNull(dfind);
+ assertNotEquals(0, dfind.size());
+ assertEquals(2, dfind.size());
+ assertEquals(doc.getDocSigle(), dfind.get(0).getDocSigle());
+
+ dfind = dao.findbyPartialId(doc.getCorpus(), null);
+ assertNotNull(dfind);
+ assertNotEquals(0, dfind.size());
+ assertEquals(2, dfind.size());
+ assertEquals(doc.getDocSigle(), dfind.get(0).getDocSigle());
}
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
index 8e67a30..0e43b97 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
@@ -3,6 +3,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import de.ids_mannheim.korap.config.BeanConfigTest;
import de.ids_mannheim.korap.config.KustvaktConfiguration;
+import de.ids_mannheim.korap.config.TestVariables;
import de.ids_mannheim.korap.exceptions.KustvaktException;
import de.ids_mannheim.korap.query.serialize.QuerySerializer;
import de.ids_mannheim.korap.user.User;
@@ -21,8 +22,6 @@
*/
public class CollectionRewriteTest extends BeanConfigTest {
- private static String simple_add_query = "[pos=ADJA]";
-
private static KustvaktConfiguration config;
@@ -52,7 +51,7 @@
handler.insertBeans(helper().getContext());
handler.add(CollectionConstraint.class);
QuerySerializer s = new QuerySerializer();
- s.setQuery(simple_add_query, "poliqarp");
+ s.setQuery(TestVariables.SIMPLE_ADD_QUERY, "poliqarp");
s.setCollection("textClass=politik & corpusSigle=WPD");
String result = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.processQuery(result,
@@ -74,21 +73,17 @@
handler.insertBeans(helper().getContext());
handler.add(CollectionConstraint.class);
QuerySerializer s = new QuerySerializer();
- s.setQuery(simple_add_query, "poliqarp");
+ s.setQuery(TestVariables.SIMPLE_ADD_QUERY, "poliqarp");
s.setCollection("corpusSigle=BRZ13 & corpusSigle=WPD");
String result = s.toJSON();
- try {
- JsonNode node = JsonUtils.readTree(handler.processQuery(result,
- User.UserFactory.getUser("test_user")));
- System.out.println(node);
- assertNotNull(node);
- assertEquals(0, node.at("/collection/operands").size());
- assertEquals("koral:rewrite",
- node.at("/collection/rewrites/0/@type").asText());
- }
- catch (Exception e) {
- e.printStackTrace();
- }
+
+ JsonNode node = JsonUtils.readTree(handler.processQuery(result,
+ User.UserFactory.getUser("test_user")));
+ System.out.println(node);
+ assertNotNull(node);
+ assertEquals(0, node.at("/collection/operands").size());
+ assertEquals("koral:rewrite", node.at("/collection/rewrites/0/@type")
+ .asText());
}
@@ -98,7 +93,7 @@
handler.insertBeans(helper().getContext());
handler.add(CollectionConstraint.class);
QuerySerializer s = new QuerySerializer();
- s.setQuery(simple_add_query, "poliqarp");
+ s.setQuery(TestVariables.SIMPLE_ADD_QUERY, "poliqarp");
s.setCollection("(corpusSigle=BRZ13 & textClass=Wissenschaft) & corpusSigle=WPD");
String result = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.processQuery(result,
@@ -122,7 +117,7 @@
handler.add(CollectionConstraint.class);
handler.add(CollectionCleanRewrite.class);
QuerySerializer s = new QuerySerializer();
- s.setQuery(simple_add_query, "poliqarp");
+ s.setQuery(TestVariables.SIMPLE_ADD_QUERY, "poliqarp");
s.setCollection("(corpusSigle=BRZ13 & corpusSigle=WPD) & textClass=Wissenschaft & textClass=Sport");
String result = s.toJSON();
@@ -150,7 +145,7 @@
handler.add(CollectionConstraint.class);
handler.add(CollectionCleanRewrite.class);
QuerySerializer s = new QuerySerializer();
- s.setQuery(simple_add_query, "poliqarp");
+ s.setQuery(TestVariables.SIMPLE_ADD_QUERY, "poliqarp");
s.setCollection("(corpusSigle=BRZ13 & textClass=wissenschaft)");
String result = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.processQuery(result,
@@ -171,7 +166,7 @@
handler.add(CollectionConstraint.class);
handler.add(CollectionCleanRewrite.class);
QuerySerializer s = new QuerySerializer();
- s.setQuery(simple_add_query, "poliqarp");
+ s.setQuery(TestVariables.SIMPLE_ADD_QUERY, "poliqarp");
s.setCollection("(corpusSigle=BRZ13 & corpusSigle=WPD) & textClass=Wissenschaft");
String result = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.processQuery(result,
@@ -192,7 +187,7 @@
handler.add(CollectionConstraint.class);
handler.add(CollectionCleanRewrite.class);
QuerySerializer s = new QuerySerializer();
- s.setQuery(simple_add_query, "poliqarp");
+ s.setQuery(TestVariables.SIMPLE_ADD_QUERY, "poliqarp");
s.setCollection("(docID=random & textClass=Wissenschaft) & corpusSigle=WPD");
String org = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.processQuery(org,
@@ -217,7 +212,7 @@
handler.add(PublicCollection.class);
QuerySerializer s = new QuerySerializer();
- s.setQuery(simple_add_query, "poliqarp");
+ s.setQuery(TestVariables.SIMPLE_ADD_QUERY, "poliqarp");
String org = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.processQuery(org,
User.UserFactory.getUser("test_user")));
@@ -240,7 +235,7 @@
handler.add(PublicCollection.class);
QuerySerializer s = new QuerySerializer();
- s.setQuery(simple_add_query, "poliqarp");
+ s.setQuery(TestVariables.SIMPLE_ADD_QUERY, "poliqarp");
s.setCollection("(docSigle=WPD_AAA & textClass=wissenschaft)");
String org = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.processQuery(org,
@@ -262,7 +257,7 @@
handler.insertBeans(helper().getContext());
handler.add(CollectionConstraint.class);
QuerySerializer s = new QuerySerializer();
- s.setQuery(simple_add_query, "poliqarp");
+ s.setQuery(TestVariables.SIMPLE_ADD_QUERY, "poliqarp");
s.setCollection("(corpusSigle=BRZ14 & textClass=wissenschaft) | (corpusSigle=AZPR | textClass=freizeit)");
String org = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.processQuery(org,
@@ -289,7 +284,7 @@
// todo: use this collection query also to test clean up filter! after reduction of corpusSigle (wiss | freizeit)!
handler.add(CollectionCleanRewrite.class);
QuerySerializer s = new QuerySerializer();
- s.setQuery(simple_add_query, "poliqarp");
+ s.setQuery(TestVariables.SIMPLE_ADD_QUERY, "poliqarp");
s.setCollection("(corpusSigle=BRZ14 & textClass=wissenschaft) | (corpusSigle=AZPR | textClass=freizeit)");
String org = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.processQuery(org,
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/ResultRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/ResultRewriteTest.java
index 068a424..479927c 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/ResultRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/ResultRewriteTest.java
@@ -2,6 +2,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import de.ids_mannheim.korap.config.BeanConfigTest;
+import de.ids_mannheim.korap.config.TestVariables;
import de.ids_mannheim.korap.exceptions.KustvaktException;
import de.ids_mannheim.korap.handlers.DocumentDao;
import de.ids_mannheim.korap.resources.Document;
@@ -16,8 +17,6 @@
* @author hanl
* @date 12/11/2015
*/
-// todo: should differentiate between docsigle and textsigle
-// todo: logging!
public class ResultRewriteTest extends BeanConfigTest {
@Override
@@ -47,9 +46,9 @@
.getPersistenceClient());
Document d = dao.findbyId("BRZ13_APR.00014", null);
assertNull(d);
- String v = ha.processResult(RESULT, null);
- assertEquals("results do not match", JsonUtils.readTree(RESULT),
- JsonUtils.readTree(v));
+ String v = ha.processResult(TestVariables.RESULT, null);
+ assertEquals("results do not match",
+ JsonUtils.readTree(TestVariables.RESULT), JsonUtils.readTree(v));
}
@@ -67,485 +66,21 @@
assertEquals("Handler could not be added to rewrite handler instance!",
true, ha.add(DocMatchRewrite.class));
- JsonNode check = JsonUtils.readTree(RESULT);
+ JsonNode check = JsonUtils.readTree(TestVariables.RESULT);
assertNotNull(check);
int check_size = check.at("/matches").size();
- String v = ha.processResult(RESULT, null);
+ String v = ha.processResult(TestVariables.RESULT, null);
JsonNode node = JsonUtils.readTree(v);
assertNotNull(node);
int size = node.at("/matches").size();
assertNotEquals("documents were not removed", check_size, size);
- assertEquals(22, size);
+ assertEquals("result does not contain required matches", 22, size);
dao.deleteResource(doc.getPersistentID(), null);
Document d = dao.findbyId(doc.getPersistentID(), null);
- assertNull(d);
+ assertNull("document should not exist anymore!", d);
}
-
-
- private static final String RESULT = "{\n"
- + "\t\"@context\": \"http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld\",\n"
- + "\t\"meta\": {\n"
- + "\t\t\"count\": 25,\n"
- + "\t\t\"startIndex\": 0,\n"
- + "\t\t\"timeout\": 120000,\n"
- + "\t\t\"context\": {\n"
- + "\t\t\t\"left\": [\"token\", 6],\n"
- + "\t\t\t\"right\": [\"token\", 6]\n"
- + "\t\t},\n"
- + "\t\t\"fields\": [\"pubDate\", \"subTitle\", \"author\", \"pubPlace\", \"title\", \"textSigle\", \"UID\", \"ID\", \"layerInfos\", \"corpusSigle\", \"docSigle\", \"corpusID\", \"textClass\"],\n"
- + "\t\t\"version\": \"0.55.5\",\n"
- + "\t\t\"benchmark\": \"0.117436617 s\",\n"
- + "\t\t\"totalResults\": 31,\n"
- + "\t\t\"serialQuery\": \"tokens:s:das\",\n"
- + "\t\t\"itemsPerPage\": 25\n"
- + "\t},\n"
- + "\t\"query\": {\n"
- + "\t\t\"@type\": \"koral:token\",\n"
- + "\t\t\"wrap\": {\n"
- + "\t\t\t\"@type\": \"koral:term\",\n"
- + "\t\t\t\"key\": \"das\",\n"
- + "\t\t\t\"layer\": \"orth\",\n"
- + "\t\t\t\"match\": \"match:eq\",\n"
- + "\t\t\t\"foundry\": \"opennlp\",\n"
- + "\t\t\t\"rewrites\": [{\n"
- + "\t\t\t\t\"@type\": \"koral:rewrite\",\n"
- + "\t\t\t\t\"src\": \"Kustvakt\",\n"
- + "\t\t\t\t\"operation\": \"operation:injection\",\n"
- + "\t\t\t\t\"scope\": \"foundry\"\n"
- + "\t\t\t}]\n"
- + "\t\t},\n"
- + "\t\t\"idn\": \"das_0\",\n"
- + "\t\t\"rewrites\": [{\n"
- + "\t\t\t\"@type\": \"koral:rewrite\",\n"
- + "\t\t\t\"src\": \"Kustvakt\",\n"
- + "\t\t\t\"operation\": \"operation:injection\",\n"
- + "\t\t\t\"scope\": \"idn\"\n"
- + "\t\t}]\n"
- + "\t},\n"
- + "\t\"collection\": {\n"
- + "\t\t\"@type\": \"koral:docGroup\",\n"
- + "\t\t\"operation\": \"operation:or\",\n"
- + "\t\t\"operands\": [{\n"
- + "\t\t\t\"@type\": \"koral:doc\",\n"
- + "\t\t\t\"key\": \"corpusSigle\",\n"
- + "\t\t\t\"value\": \"GOE\",\n"
- + "\t\t\t\"match\": \"match:eq\"\n"
- + "\t\t}, {\n"
- + "\t\t\t\"@type\": \"koral:doc\",\n"
- + "\t\t\t\"key\": \"corpusSigle\",\n"
- + "\t\t\t\"value\": \"WPD\",\n"
- + "\t\t\t\"match\": \"match:eq\"\n"
- + "\t\t}],\n"
- + "\t\t\"rewrites\": [{\n"
- + "\t\t\t\"@type\": \"koral:rewrite\",\n"
- + "\t\t\t\"src\": \"Kustvakt\",\n"
- + "\t\t\t\"operation\": \"operation:insertion\",\n"
- + "\t\t\t\"scope\": \"corpusSigle\"\n"
- + "\t\t}]\n"
- + "\t},\n"
- + "\t\"matches\": [{\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00004\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A (Logik)\",\n"
- + "\t\t\"author\": \"Zenogantner; ElRaki; 1\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>z.B. mit dem Wort Barbara" bezeichnet, </span><mark>das</mark><span class=\\\"context-right\\\"> dreimal den Buchstaben a enthält, aber<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00004-p195-196\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"kultur musik freizeit-unterhaltung reisen\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.02439\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"Aegukka\",\n"
- + "\t\t\"author\": \"ThorstenS; 2\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>wörtlich "Das Lied der Liebe für </span><mark>das</mark><span class=\\\"context-right\\\"> Land", oder "Das patriotische Lied". Es<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.02439-p22-23\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"kultur musik freizeit-unterhaltung reisen\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.02439\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"Aegukka\",\n"
- + "\t\t\"author\": \"ThorstenS; 2\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Besatzungszeit von 1910 bis 1945 wurde </span><mark>das</mark><span class=\\\"context-right\\\"> Lied verboten. Im Ausland lebende Koreaner<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.02439-p74-75\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"kultur musik freizeit-unterhaltung reisen\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.02439\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"Aegukka\",\n"
- + "\t\t\"author\": \"ThorstenS; 2\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>3. Deutsche Übersetzung 1. Strophe Bis </span><mark>das</mark><span class=\\\"context-right\\\"> Meer des Ostens ausdörrt und der<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.02439-p298-299\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Ausnahme von Fremdwörtern und Namen ist </span><mark>das</mark><span class=\\\"context-right\\\"> A der einzige Buchstabe im Deutschen<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p41-42\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>flache Stellung niedergedrückt wird. Stellt man </span><mark>das</mark><span class=\\\"context-right\\\"> Verhältnis der drei Hauptvokale a, i<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p107-108\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>kommt i als der hellste an </span><mark>das</mark><span class=\\\"context-right\\\"> obere, u als der dumpfeste an<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p127-128\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>obere, u als der dumpfeste an </span><mark>das</mark><span class=\\\"context-right\\\"> untere Ende, a als der mittlere<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p134-135\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>im 9. Jahrhundert v. Chr. war </span><mark>das</mark><span class=\\\"context-right\\\"> Schriftzeichen bereits stark stilisiert, die Hörner<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p271-272\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>im Alphabet inne. Als die Griechen </span><mark>das</mark><span class=\\\"context-right\\\"> Phönizische Alphabet übernamen, drehten sie das<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p313-314\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>das Phönizische Alphabet übernamen, drehten sie </span><mark>das</mark><span class=\\\"context-right\\\"> Zeichen um 90 Grad und machten<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p319-320\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>um 90 Grad und machten daraus </span><mark>das</mark><span class=\\\"context-right\\\"> Alpha. Da das Griechische reich an<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p327-328\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>und machten daraus das Alpha. Da </span><mark>das</mark><span class=\\\"context-right\\\"> Griechische reich an Vokalen war, verwendeten<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p330-331\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>reich an Vokalen war, verwendeten sie </span><mark>das</mark><span class=\\\"context-right\\\"> Zeichen für den Lautwert a. Die<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p338-339\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>den Lautwert a. Die Etrusker übernahmen </span><mark>das</mark><span class=\\\"context-right\\\"> frühgriechische Alpha und ließen es größtenteils<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p347-348\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>von rechts nach links) versahen sie </span><mark>das</mark><span class=\\\"context-right\\\"> Zeichen mit einem Abschwung nach links<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p365-366\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Abschwung nach links. Als die Römer </span><mark>das</mark><span class=\\\"context-right\\\"> lateinische Alphabet schufen, verwendeten sie das<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p375-376\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>das lateinische Alphabet schufen, verwendeten sie </span><mark>das</mark><span class=\\\"context-right\\\"> A aus dem etruskischen Alphabet, der<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p381-382\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>in der Biologie steht A für </span><mark>das</mark><span class=\\\"context-right\\\"> Nukleosid Adenosin steht A die Base<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p404-405\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Wert 10, siehe auch Hexadezimalsystem. steht </span><mark>das</mark><span class=\\\"context-right\\\"> Symbol ∀ (ein auf den Kopf gestelltes<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p526-527\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>für die Vorsilbe Atto ist A </span><mark>das</mark><span class=\\\"context-right\\\"> Einheitensymbol der elektrischen Stromstärke Ampere in<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p624-625\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Anordnung (Rechtswesen), Agent (Börse), Aufzeichung (Rechtsw.), </span><mark>das</mark><span class=\\\"context-right\\\"> Flächenmaß Acre und Ausgabe A ist<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p757-758\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Band). in Redewendungen für den Anfang (</span><mark>das</mark><span class=\\\"context-right\\\"> A und O, von A bis<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p777-778\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Z). a ist die Abkürzung für </span><mark>das</mark><span class=\\\"context-right\\\"> Flächenmaß Ar in der Kaufmannssprache bedeutet<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p790-791\",\n"
- + "\t\t\"UID\": 0,\n"
- + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}, {\n"
- + "\t\t\"field\": \"tokens\",\n"
- + "\t\t\"textClass\": \"freizeit-unterhaltung reisen wissenschaft populaerwissenschaft\",\n"
- + "\t\t\"pubPlace\": \"URL:http://de.wikipedia.org\",\n"
- + "\t\t\"textSigle\": \"WPD_AAA.00001\",\n"
- + "\t\t\"docSigle\": \"WPD_AAA\",\n"
- + "\t\t\"corpusSigle\": \"WPD\",\n"
- + "\t\t\"title\": \"A\",\n"
- + "\t\t\"author\": \"Ruru; Jens.Ol; Aglarech; u.a.\",\n"
- + "\t\t\"layerInfos\": \"base/s=spans cnx/c=spans cnx/l=tokens cnx/m=tokens cnx/p=tokens cnx/s=spans cnx/syn=tokens corenlp/s=spans mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans xip/l=tokens xip/p=tokens xip/s=spans\",\n"
- + "\t\t\"startMore\": true,\n"
- + "\t\t\"endMore\": true,\n"
- + "\t\t\"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>ad zu) ‚[das Stück] zu...‘ für </span><mark>das</mark><span class=\\\"context-right\\\"> Französische à „nach“, z. B. in<span class=\\\"more\\\"></span></span>\",\n"
- + "\t\t\"matchID\": \"match-WPD_AAA.00001-p805-806\",\n"
- + "\t\t\"UID\": 0,\n" + "\t\t\"pubDate\": \"2005-03-28\"\n"
- + "\t}]\n" + "}";
-
}
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteBenchmarkTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteBenchmarkTest.java
new file mode 100644
index 0000000..29ddb89
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteBenchmarkTest.java
@@ -0,0 +1,102 @@
+package de.ids_mannheim.korap.resource.rewrite;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import de.ids_mannheim.korap.config.BeanConfigTest;
+import de.ids_mannheim.korap.config.TestVariables;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.handlers.DocumentDao;
+import de.ids_mannheim.korap.resources.Document;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import de.ids_mannheim.korap.utils.TimeUtils;
+import org.joda.time.DateTime;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by hanl on 30.05.16.
+ */
+public class RewriteBenchmarkTest extends BeanConfigTest {
+
+
+ @Test
+ public void testDocMatchRewriteByTextSigle () throws KustvaktException {
+ DocumentDao dao = new DocumentDao(helper().getContext()
+ .getPersistenceClient());
+
+ int i = 999;
+ for (int j = 100; j < i; j++) {
+ Document doc = new Document("WPD_AAA.02" + j);
+ doc.setDisabled(true);
+ dao.storeResource(doc, null);
+ }
+ RewriteHandler ha = new RewriteHandler();
+ ha.insertBeans(helper().getContext());
+ assertEquals("Handler could not be added to rewrite handler instance!",
+ true, ha.add(DocMatchRewrite.class));
+
+ DateTime now = TimeUtils.getNow();
+ String v = ha.processResult(TestVariables.RESULT, null);
+ long diff = TimeUtils.calcDiff(now, new DateTime());
+ assertTrue(diff < 600);
+ JsonNode node = JsonUtils.readTree(v);
+
+ JsonNode check = JsonUtils.readTree(TestVariables.RESULT);
+ assertNotNull(check);
+ int check_size = check.at("/matches").size();
+
+ assertNotNull(node);
+ int size = node.at("/matches").size();
+ assertNotEquals("documents were not removed", check_size, size);
+
+ dao.truncate();
+ }
+
+
+ @Test
+ public void testDocMatchRewriteByDocSigle () throws KustvaktException {
+ DocumentDao dao = new DocumentDao(helper().getContext()
+ .getPersistenceClient());
+
+ Document doc = new Document("WPD_AAA");
+ doc.setDisabled(true);
+ dao.storeResource(doc, null);
+
+ RewriteHandler ha = new RewriteHandler();
+ ha.insertBeans(helper().getContext());
+ assertEquals("Handler could not be added to rewrite handler instance!",
+ true, ha.add(DocMatchRewrite.class));
+
+ DateTime now = TimeUtils.getNow();
+ String v = ha.processResult(TestVariables.RESULT, null);
+ long diff = TimeUtils.calcDiff(now, new DateTime());
+ assertTrue(diff < 600);
+ JsonNode node = JsonUtils.readTree(v);
+
+ JsonNode check = JsonUtils.readTree(TestVariables.RESULT);
+ assertNotNull(check);
+ int check_size = check.at("/matches").size();
+
+ assertNotNull(node);
+ int size = node.at("/matches").size();
+ assertNotEquals("documents were not removed", check_size, size);
+ assertEquals(0, size);
+ dao.truncate();
+ }
+
+
+ @Test
+ public void testCollectionRewriteInject () {
+
+ }
+
+
+ @Test
+ public void testCollectionRewriteRemoval () {
+
+ }
+
+
+ @Override
+ public void initMethod () throws KustvaktException {}
+}
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
index 112282c..3cb528d 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
@@ -19,19 +19,6 @@
*/
public class RewriteHandlerTest extends BeanConfigTest {
- @Test
- public void initHandler () {
- try {
- RewriteHandler handler = new RewriteHandler();
- handler.insertBeans(helper().getContext());
- assertTrue(handler.add(FoundryInject.class));
- }
- catch (Exception e) {
- e.printStackTrace();
-
- }
- }
-
@Test
public void testRewriteTaskAdd () {
@@ -111,6 +98,7 @@
UserDataDbIface settingsdao = BeansFactory.getTypeFactory()
.getTypedBean(helper().getContext().getUserDataDaos(),
UserSettings.class);
+ assertNotNull(settingsdao);
UserSettings s = (UserSettings) settingsdao.get(helper().getUser());
s.setField(Attributes.DEFAULT_LEMMA_FOUNDRY, "tt_test");
settingsdao.update(s);
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
index b394d68..47771b1 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
@@ -51,6 +51,31 @@
}
+
+ @Test
+ public void testOpenIDLogin () {
+
+ }
+
+
+ @Test
+ public void testOpenIDLogout () {
+
+ }
+
+
+ // -- are these even right? auth - authorization
+ @Test
+ public void testOAuth2Login () {
+
+ }
+
+
+ @Test
+ public void testOAuth2Logout () {
+
+ }
+
//todo: test basicauth via secure connection
}
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
index 039593e..6896054 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
@@ -3,6 +3,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.sun.jersey.api.client.ClientResponse;
import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.query.serialize.QuerySerializer;
import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
import de.ids_mannheim.korap.config.Attributes;
import de.ids_mannheim.korap.utils.JsonUtils;
@@ -28,11 +29,11 @@
@Test
- public void testSearchSimple () {
+ public void testSearchSimpleAuthorized () {
ClientResponse response = resource()
.path(getAPIVersion())
.path("search")
- .queryParam("q", "[orth=das]")
+ .queryParam("q", "[orth=Haus]")
.queryParam("ql", "poliqarp")
.header(Attributes.AUTHORIZATION,
BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
@@ -42,13 +43,113 @@
JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
assertNotNull(node);
- System.out.println("NODE " + node);
assertNotEquals(0, node.path("matches").size());
}
@Test
- public void testCollectionGet () {
+ public void testSearchSimpleWithCQAuthorized () {
+ ClientResponse response = resource()
+ .path(getAPIVersion())
+ .path("search")
+ .queryParam("q", "[orth=das]")
+ .queryParam("ql", "poliqarp")
+ .queryParam("cq", "textClass=politik && corpusSigle=WPD")
+ .header(Attributes.AUTHORIZATION,
+ BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+ .get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+
+ JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+ assertNotNull(node);
+
+ }
+
+
+ @Test
+ public void testSearchSimpleDemo () {
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("search").queryParam("q", "[base=Haus]")
+ .queryParam("ql", "poliqarp").get(ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ System.out.println("NODE " + node);
+ assertNotNull(node);
+ assertNotEquals(0, node.path("matches").size());
+ }
+
+
+ @Test
+ public void testSearchSentenceMeta () {
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("search").queryParam("q", "[base=Haus]")
+ .queryParam("ql", "poliqarp").queryParam("context", "sentence")
+ .get(ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertNotEquals(0, node.path("matches").size());
+ assertEquals("base/s:s", node.at("/meta/context").asText());
+ assertNotEquals("${project.version}", "/meta/version");
+ }
+
+
+ @Test
+ public void testSearchSimpleCQL () {
+ QuerySerializer s = new QuerySerializer();
+ s.setQuery("[base=Haus]", "poliqarp");
+
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("search").post(ClientResponse.class, s.toJSON());
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
+ String ent = response.getEntity(String.class);
+
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertNotEquals(0, node.path("matches").size());
+ }
+
+
+ @Test
+ public void testSearchRawQuery () {
+ QuerySerializer s = new QuerySerializer();
+ s.setQuery("[base=Haus]", "poliqarp");
+ // s.setCollection("corpusSigle=WPD");
+
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("search").post(ClientResponse.class, s.toJSON());
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
+ String ent = response.getEntity(String.class);
+
+ System.out.println(ent);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertNotEquals(0, node.path("matches").size());
+ }
+
+
+ @Test
+ public void testCollectionsGetPublic () {
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("collection").get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+
+ JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+ assertNotNull(node);
+ assertNotEquals(0, node.size());
+ }
+
+
+ @Test
+ public void testCollectionsGet () {
ClientResponse response = resource()
.path(getAPIVersion())
.path("collection")
@@ -59,6 +160,33 @@
response.getStatus());
JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
+ assertNotNull(node);
+ assertNotEquals(0, node.size());
+ }
+
+
+ @Test
+ public void testCorporaGet () {
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("corpus").get(ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertNotEquals(0, node.size());
+ }
+
+
+ @Test
+ public void testFoundriesGet () {
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("foundry").get(ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
assertNotEquals(0, node.size());
}
@@ -100,6 +228,46 @@
@Test
+ public void testCollecionGet () {
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("collection").path("id").get(ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertNotEquals(0, node.size());
+
+ }
+
+
+ @Test
+ public void testCorpusGet () {
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("corpus").path("id").get(ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertNotEquals(0, node.size());
+ }
+
+
+ @Test
+ public void testFoundryGet () {
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("foundry").path("id").get(ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertNotEquals(0, node.size());
+ }
+
+
+ @Test
public void testResourceStore () {
}
@@ -112,22 +280,82 @@
@Test
- @Ignore
- public void testSerializationQueryInCollection () {
+ public void testSerializationQueryWithCorpusUnAuthorized () {
ClientResponse response = resource().path(getAPIVersion())
.path("corpus/WPD/search").queryParam("q", "[base=Haus]")
.queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
.method("TRACE", ClientResponse.class);
- assertEquals(response.getStatus(),
- ClientResponse.Status.OK.getStatusCode());
- System.out.println("RESPONSE 1 " + response);
+ assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
+ response.getStatus());
String ent = response.getEntity(String.class);
- System.out.println("Entity 1 " + ent);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertEquals(401, node.at("/errors/0/0").asInt());
}
@Test
- public void testSerializationQueryPublic () {
+ public void testSerializationQueryWithCorpus () {
+ ClientResponse response = resource()
+ .path(getAPIVersion())
+ .path("corpus/WPD/search")
+ .queryParam("q", "[base=Haus]")
+ .queryParam("ql", "poliqarp")
+ .queryParam("context", "base/s:s")
+ .header(Attributes.AUTHORIZATION,
+ BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+ .method("TRACE", ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ assertEquals("koral:doc", node.at("/collection/@type").asText());
+ }
+
+
+ @Test
+ public void testSerializationQueryWithCollection () {
+ ClientResponse response = resource()
+ .path(getAPIVersion())
+ .path("collection")
+ .header(Attributes.AUTHORIZATION,
+ BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+ .get(ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+
+ String id = node.at("/0/id").asText();
+ assertNotNull(id);
+ assertFalse(id.isEmpty());
+
+ response = resource()
+ .path(getAPIVersion())
+ .path("collection")
+ .path(id)
+ .path("search")
+ .queryParam("q", "[base=Haus]")
+ .queryParam("ql", "poliqarp")
+ .queryParam("context", "base/s:s")
+ .header(Attributes.AUTHORIZATION,
+ BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
+ .method("TRACE", ClientResponse.class);
+ assertEquals(ClientResponse.Status.OK.getStatusCode(),
+ response.getStatus());
+ ent = response.getEntity(String.class);
+ node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ System.out.println(node);
+ assertEquals("koral:doc", node.at("/collection/@type").asText());
+
+ }
+
+
+ @Test
+ public void testSerializationQueryPublicCorpora () {
ClientResponse response = resource().path(getAPIVersion())
.path("search").queryParam("q", "[base=Haus]")
.queryParam("ql", "poliqarp").queryParam("context", "sentence")
@@ -143,60 +371,41 @@
}
- @Test
- public void testQuery () {
- ClientResponse response = resource().path(getAPIVersion())
- .path("search").queryParam("q", "[base=Haus]")
- .queryParam("ql", "poliqarp").queryParam("context", "sentence")
- .get(ClientResponse.class);
- assertEquals(response.getStatus(),
- ClientResponse.Status.OK.getStatusCode());
- String ent = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(ent);
- assertNotNull(node);
- assertEquals("base/s:s", node.at("/meta/context").asText());
- assertNotEquals("${project.version}", "/meta/version");
- }
-
-
+ // use trace for this
@Test
@Ignore
public void testSerializationMeta () {
ClientResponse response = resource().path(getAPIVersion())
.path("search").queryParam("context", "sentence")
.queryParam("q", "[pos=ADJA]").queryParam("ql", "poliqarp")
- .get(ClientResponse.class);
+
+ .method("TRACE", ClientResponse.class);
assertEquals(response.getStatus(),
ClientResponse.Status.OK.getStatusCode());
}
@Test
- @Ignore
- public void testSerializationCollection () {
- ClientResponse response = resource().path(getAPIVersion()).path("")
- .get(ClientResponse.class);
- assertEquals(response.getStatus(),
- ClientResponse.Status.OK.getStatusCode());
- }
-
-
- @Test
- public void testMatchInfo () {
+ public void testMatchInfoGet () {
}
@Test
- public void testGetResources () {
- ClientResponse response = resource().path(getAPIVersion())
- .path("collection").get(ClientResponse.class);
- assertEquals(response.getStatus(),
- ClientResponse.Status.OK.getStatusCode());
- String ent = response.getEntity(String.class);
- JsonNode node = JsonUtils.readTree(ent);
- assertNotNull(node);
- assertNotEquals(0, node.size());
+ public void testMatchInfoSave () {
+
+ }
+
+
+ @Test
+ public void testMatchInfoDelete () {
+
+ }
+
+
+ @Test
+ public void testGetMatches () {
+
}