switched to new notation, cosmas2 automatic build
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
index 2931ad4..bcd51de 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
@@ -133,7 +133,8 @@
}
System.out.println("Processing Cosmas");
- QueryUtils.prepareContext(requestMap);
+ requestMap.put("context", "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld");
+// QueryUtils.prepareContext(requestMap);
processNode(tree);
}
@@ -177,8 +178,8 @@
if (hasSequentiableSiblings) {
// Step I: create sequence
LinkedHashMap<String, Object> sequence = new LinkedHashMap<String, Object>();
- sequence.put("type", "group");
- sequence.put("operation", "sequence");
+ sequence.put("@type", "korap:group");
+ sequence.put("operation", "operation:"+ "sequence");
sequence.put("operands", new ArrayList<Object>());
// push sequence on object stack but don't increment stackedObjects counter since
// we've got to wait until the parent node is processed - therefore, add the parent
@@ -198,13 +199,13 @@
//Step I: get info
LinkedHashMap<String, Object> token = new LinkedHashMap<String, Object>();
- token.put("type", "token");
+ token.put("@type", "korap:token");
objectStack.push(token);
stackedObjects++;
LinkedHashMap<String, Object> fieldMap = new LinkedHashMap<String, Object>();
- token.put("key", fieldMap);
+ token.put("wrap", fieldMap);
- fieldMap.put("type", "term");
+ fieldMap.put("@type", "korap:term");
// make category-specific fieldMap entry
String attr = nodeCat.equals("OPWF") ? "orth" : "lemma";
String value = node.getChild(0).toStringTree().replaceAll("\"", "");
@@ -224,11 +225,11 @@
if (nodeCat.equals("OPMORPH")) {
//Step I: get info
LinkedHashMap<String, Object> token = new LinkedHashMap<String, Object>();
- token.put("type", "token");
+ token.put("@type", "korap:token");
LinkedHashMap<String, Object> fieldMap = new LinkedHashMap<String, Object>();
- token.put("key", fieldMap);
+ token.put("wrap", fieldMap);
- fieldMap.put("type", "term");
+ fieldMap.put("@type", "korap:term");
// fieldMap.put("key", "morph:"+node.getChild(0).toString().replace(" ", "_"));
fieldMap.put("key", node.getChild(0).toString().replace(" ", "_"));
// make category-specific fieldMap entry
@@ -244,34 +245,34 @@
// LinkedHashMap<String, Object> fieldMap = new LinkedHashMap<String, Object>();
// token.put("key", fieldMap);
//
-// fieldMap.put("type", "term");
+// fieldMap.put("@type", "korap:term");
// fieldMap.put("key", morphValues.get(0));
// // make category-specific fieldMap entry
// // negate field (see above)
// if (negate) {
-// fieldMap.put("operation", "!=");
+// fieldMap.put("operation", "operation:"+ "!=");
// } else {
-// fieldMap.put("operation", "=");
+// fieldMap.put("operation", "operation:"+ "=");
// }
// } else {
// LinkedHashMap<String, Object> conjGroup = new LinkedHashMap<String, Object>();
// token.put("key", conjGroup);
// ArrayList<Object> conjOperands = new ArrayList<Object>();
-// conjGroup.put("type", "group");
-// conjGroup.put("operation", "and");
+// conjGroup.put("@type", "korap:group");
+// conjGroup.put("operation", "operation:"+ "and");
// conjGroup.put("operands", conjOperands);
// for (String value : morphValues) {
// LinkedHashMap<String, Object> fieldMap = new LinkedHashMap<String, Object>();
// token.put("key", fieldMap);
//
-// fieldMap.put("type", "term");
+// fieldMap.put("@type", "korap:term");
// fieldMap.put("key", value);
// // make category-specific fieldMap entry
// // negate field (see above)
// if (negate) {
-// fieldMap.put("operation", "!=");
+// fieldMap.put("operation", "operation:"+ "!=");
// } else {
-// fieldMap.put("operation", "=");
+// fieldMap.put("operation", "operation:"+ "=");
// }
// }
// }
@@ -284,7 +285,7 @@
if (nodeCat.equals("OPELEM")) {
// Step I: create element
LinkedHashMap<String, Object> elem = new LinkedHashMap<String, Object>();
- elem.put("type", "span");
+ elem.put("@type", "korap:span");
elem.put("key", node.getChild(0).getChild(0).toStringTree().toLowerCase());
//Step II: decide where to put
putIntoSuperObject(elem);
@@ -293,7 +294,7 @@
if (nodeCat.equals("OPLABEL")) {
// Step I: create element
LinkedHashMap<String, Object> elem = new LinkedHashMap<String, Object>();
- elem.put("type", "span");
+ elem.put("@type", "korap:span");
elem.put("key", node.getChild(0).toStringTree().replaceAll("<|>", ""));
//Step II: decide where to put
putIntoSuperObject(elem);
@@ -302,11 +303,11 @@
if (nodeCat.equals("OPOR") || nodeCat.equals("OPAND") || nodeCat.equals("OPNOT")) {
// Step I: create group
LinkedHashMap<String, Object> disjunction = new LinkedHashMap<String, Object>();
- disjunction.put("type", "group");
+ disjunction.put("@type", "korap:group");
String relation = "or";
if (nodeCat.equals("OPAND")) relation = "and";
if (nodeCat.equals("OPNOT")) relation = "not";
- disjunction.put("operation", relation);
+ disjunction.put("operation", "operation:"+ relation);
disjunction.put("operands", new ArrayList<Object>());
objectStack.push(disjunction);
stackedObjects++;
@@ -322,8 +323,8 @@
Tree dist_list = prox_opts.getChild(1);
// Step I: create group
LinkedHashMap<String, Object> proxSequence = new LinkedHashMap<String, Object>();
- proxSequence.put("type", "group");
- proxSequence.put("operation", "sequence");
+ proxSequence.put("@type", "korap:group");
+ proxSequence.put("operation", "operation:"+ "sequence");
objectStack.push(proxSequence);
stackedObjects++;
// if (openNodeCats.get(1).equals("OPALL")) proxSequence.put("match", "all");
@@ -332,7 +333,7 @@
ArrayList<Object> constraints = new ArrayList<Object>();
boolean exclusion = ! typ.getChild(0).toStringTree().equals("PROX");
- String inOrder = "true";
+ boolean inOrder = true;
proxSequence.put("inOrder", inOrder);
proxSequence.put("distances", constraints);
@@ -352,11 +353,11 @@
direction = "plus";
invertedOperandsLists.add(operands);
} else if (direction.equals("both")) {
- inOrder="false";
+ inOrder=false;
}
LinkedHashMap<String, Object> distance = new LinkedHashMap<String, Object>();
- distance.put("type", "distance");
- distance.put("measure", meas);
+ distance.put("@type", "korap:distance");
+ distance.put("key", meas);
distance.put("min", Integer.parseInt(min));
distance.put("max", Integer.parseInt(max));
if (exclusion) {
@@ -370,8 +371,8 @@
else {
LinkedHashMap<String, Object> distanceGroup = new LinkedHashMap<String, Object>();
ArrayList<Object> groupOperands = new ArrayList<Object>();
- distanceGroup.put("type", "group");
- distanceGroup.put("operation", "and");
+ distanceGroup.put("@type", "korap:group");
+ distanceGroup.put("operation", "operation:"+ "and");
distanceGroup.put("operands", groupOperands);
constraints.add(distanceGroup);
for (int i=0; i<dist_list.getChildCount(); i++) {
@@ -383,18 +384,18 @@
min=max;
}
LinkedHashMap<String, Object> distance = new LinkedHashMap<String, Object>();
- distance.put("type", "distance");
- distance.put("measure", meas);
- distance.put("min", min);
- distance.put("max", max);
+ distance.put("@type", "korap:distance");
+ distance.put("key", meas);
+ distance.put("min", Integer.parseInt(min));
+ distance.put("max", Integer.parseInt(max));
if (exclusion) {
distance.put("exclude", exclusion);
}
groupOperands.add(distance);
if (direction.equals("plus")) {
- inOrder="true";
+ inOrder=true;
} else if (direction.equals("minus")) {
- inOrder="true";
+ inOrder=true;
invertedOperandsLists.add(operands);
}
}
@@ -408,17 +409,19 @@
if (nodeCat.equals("OPIN") || nodeCat.equals("OPOV")) {
// Step I: create group
LinkedHashMap<String, Object> submatchgroup = new LinkedHashMap<String, Object>();
- submatchgroup.put("type", "group");
- submatchgroup.put("operation", "submatch");
- submatchgroup.put("classRef", "1");
+ submatchgroup.put("@type", "korap:group");
+ submatchgroup.put("operation", "operation:"+ "submatch");
+ ArrayList<Integer> classRef = new ArrayList<Integer>();
+ classRef.add(1);
+ submatchgroup.put("classRef", classRef);
ArrayList<Object> submatchoperands = new ArrayList<Object>();
LinkedHashMap<String, Object> posgroup = new LinkedHashMap<String, Object>();
submatchgroup.put("operands", submatchoperands);
submatchoperands.add(posgroup);
- posgroup.put("type", "group");
+ posgroup.put("@type", "korap:group");
// String relation = nodeCat.equals("OPIN") ? "position" : "overlaps";
- posgroup.put("operation", "position");
+ posgroup.put("operation", "operation:"+ "position");
if (nodeCat.equals("OPIN")) {
parseOPINOptions(node, posgroup);
} else {
@@ -439,9 +442,9 @@
if (nodeCat.equals("ARG1") && (openNodeCats.get(1).equals("OPIN") || openNodeCats.get(1).equals("OPOV"))) {
// Step I: create group
LinkedHashMap<String, Object> classGroup = new LinkedHashMap<String, Object>();
- classGroup.put("type", "group");
- classGroup.put("operation", "class");
- classGroup.put("class", "1");
+ classGroup.put("@type", "korap:group");
+ classGroup.put("operation", "operation:"+ "class");
+ classGroup.put("class", 1);
classGroup.put("operands", new ArrayList<Object>());
objectStack.push(classGroup);
stackedObjects++;
@@ -453,13 +456,13 @@
if (nodeCat.equals("OPNHIT")) {
// proxGroupMatching = nodeCat.equals("OPALL") ? "all" : "exclude";
LinkedHashMap<String, Object> exclGroup = new LinkedHashMap<String, Object>();
- exclGroup.put("type", "group");
- exclGroup.put("operation", "shrink");
+ exclGroup.put("@type", "korap:group");
+ exclGroup.put("operation", "operation:"+ "shrink");
ArrayList<Integer> classRef = new ArrayList<Integer>();
classRef.add(1);
classRef.add(2);
exclGroup.put("classRef", classRef);
- exclGroup.put("classRefOp", "intersection");
+ exclGroup.put("classRefOp", "classRefOp:"+"intersection");
ArrayList<Object> operands = new ArrayList<Object>();
exclGroup.put("operands", operands);
objectStack.push(exclGroup);
@@ -470,8 +473,8 @@
if (nodeCat.equals("OPEND") || nodeCat.equals("OPBEG")) {
// Step I: create group
LinkedHashMap<String, Object> beggroup = new LinkedHashMap<String, Object>();
- beggroup.put("type", "group");
- beggroup.put("operation", "submatch");
+ beggroup.put("@type", "korap:group");
+ beggroup.put("operation", "operation:"+ "submatch");
ArrayList<Integer> spanRef = new ArrayList<Integer>();
if (nodeCat.equals("OPBEG")) {
spanRef.add(0); spanRef.add(1);
@@ -494,16 +497,16 @@
// Distinguish two cases. Normal case: query has just one condition, like #BED(XY, sa) ...
if (conditions.getChildCount()==1) {
LinkedHashMap<String, Object> posgroup = new LinkedHashMap<String, Object>();
- posgroup.put("type", "group");
- posgroup.put("operation", "position");
+ posgroup.put("@type", "korap:group");
+ posgroup.put("operation", "operation:"+ "position");
CosmasCondition c = new CosmasCondition(conditions.getChild(0));
- posgroup.put("frame", c.position);
- if (c.negated) posgroup.put("operation", "!=");
+ posgroup.put("frame", "frame:"+c.position);
+ if (c.negated) posgroup.put("operation", "operation:"+ "!=");
ArrayList<Object> operands = new ArrayList<Object>();
posgroup.put("operands", operands);
LinkedHashMap<String, Object> bedElem = new LinkedHashMap<String, Object>();
operands.add(bedElem);
- bedElem.put("type", "span");
+ bedElem.put("@type", "korap:span");
bedElem.put("key", c.elem);
objectStack.push(posgroup);
stackedObjects++;
@@ -515,8 +518,8 @@
// node has several conditions (like 'sa, -pa')
// -> create 'and' group and embed all position groups there
LinkedHashMap<String, Object> conjunct = new LinkedHashMap<String, Object>();
- conjunct.put("type", "group");
- conjunct.put("operation", "and");
+ conjunct.put("@type", "korap:group");
+ conjunct.put("operation", "operation:"+ "and");
ArrayList<Object> operands = new ArrayList<Object>();
conjunct.put("operands", operands);
ArrayList<ArrayList<Object>> distributedOperands = new ArrayList<ArrayList<Object>>();
@@ -528,16 +531,16 @@
operands.add(posGroup);
CosmasCondition c = new CosmasCondition(conditions.getChild(i));
- posGroup.put("type", "group");
- posGroup.put("operation", "position");
- posGroup.put("frame", c.position);
+ posGroup.put("@type", "korap:group");
+ posGroup.put("operation", "operation:"+ "position");
+ posGroup.put("frame", "frame:"+c.position);
if (c.negated) posGroup.put("exclude", "true");
ArrayList<Object> posOperands = new ArrayList<Object>();
distributedOperands.add(posOperands);
posGroup.put("operands", posOperands);
LinkedHashMap<String, Object> bedElem = new LinkedHashMap<String, Object>();
posOperands.add(bedElem);
- bedElem.put("type", "span");
+ bedElem.put("@type", "korap:span");
bedElem.put("key", c.elem);
@@ -610,7 +613,7 @@
} else {
position = "contains";
}
- posgroup.put("frame", position);
+ posgroup.put("frame", "frame:"+position);
position = openNodeCats.get(1).equals("OPIN") ? "contains" : "full";
if (rangenode != null) {
@@ -645,7 +648,7 @@
String value = posnode.getChild(0).toStringTree();
position = "-"+translateTextAreaArgument(value, "ov");
}
- posgroup.put("frame", "overlaps"+position);
+ posgroup.put("frame", "frame:"+"overlaps"+position);
if (exclnode != null) {
if (exclnode.getChild(0).toStringTree().equals("YES")) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
index 7fa8b5e..b2a195d 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
@@ -179,7 +179,8 @@
}
}
System.out.println("Processing PoliqarpPlus");
- QueryUtils.prepareContext(requestMap);
+ requestMap.put("context", "http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/context.jsonld");
+// QueryUtils.prepareContext(requestMap);
processNode(tree);
}
@@ -259,10 +260,10 @@
String[] minmax = parseEmptySegments(emptySegments);
Integer min = Integer.parseInt(minmax[0]);
Integer max = Integer.parseInt(minmax[1]);
- sequence.put("type", "group");
- sequence.put("operation", "sequence");
-// sequence.put("operation", "distance");
- sequence.put("inOrder", "true");
+ sequence.put("@type", "korap:group");
+ sequence.put("operation", "operation:"+"sequence");
+// sequence.put("operation", "operation:"+"distance");
+ sequence.put("inOrder", true);
ArrayList<Object> constraint = new ArrayList<Object>();
sequence.put("distances", constraint);
ArrayList<Object> sequenceOperands = new ArrayList<Object>();
@@ -271,13 +272,13 @@
stackedObjects++;
LinkedHashMap<String, Object> distMap = new LinkedHashMap<String, Object>();
constraint.add(distMap);
- distMap.put("type", "distance");
- distMap.put("measure", "w");
+ distMap.put("@type", "korap:distance");
+ distMap.put("key", "w");
distMap.put("min", min);
distMap.put("max", max);
} else {
- sequence.put("type", "group");
- sequence.put("operation", "sequence");
+ sequence.put("@type", "korap:group");
+ sequence.put("operation", "operation:"+"sequence");
ArrayList<Object> sequenceOperands = new ArrayList<Object>();
if (emptySegments != null) {
String[] minmax = parseEmptySegments(emptySegments);
@@ -296,14 +297,14 @@
if (QueryUtils.getNodeCat(node.getChild(0)).equals("cq_segment")
|| QueryUtils.getNodeCat(node.getChild(0)).equals("sq_segment")
|| QueryUtils.getNodeCat(node.getChild(0)).equals("element") ) {
- sequence.put("type", "token");
+ sequence.put("@type", "korap:token");
tokenStack.push(sequence);
stackedTokens++;
objectStack.push(sequence);
stackedObjects++;
// else, it's a group (with shrink()/spanclass/align... as child)
} else {
- sequence.put("type", "group");
+ sequence.put("@type", "korap:group");
}
}
// Step II: decide where to put this element
@@ -323,8 +324,8 @@
if (node.getParent().getChild(0).equals(node)) {
// if first child, create containing sequence and embed there
LinkedHashMap<String,Object> superSequence = new LinkedHashMap<String,Object>();
- superSequence.put("type", "group");
- superSequence.put("operation", "sequence");
+ superSequence.put("@type", "korap:group");
+ superSequence.put("operation", "operation:"+"sequence");
ArrayList<Object> operands = new ArrayList<Object>();
superSequence.put("operands", operands);
operands.add(sequence);
@@ -365,7 +366,7 @@
}
curToken = token;
// Step II: start filling object and add to containing sequence
- token.put("type", "token");
+ token.put("@type", "korap:token");
// add token to sequence only if it is not an only child (in that case, cq_segments has already added the info and is just waiting for the values from "field")
// take into account a possible 'occ' child
if (node.getParent().getChildCount()>1) {
@@ -390,7 +391,7 @@
if (nodeCat.equals("cq_seg_occ")) {
LinkedHashMap<String,Object> group = new LinkedHashMap<String,Object>();
curOccGroup = group;
- group.put("type", "group");
+ group.put("@type", "korap:group");
group.put("operands", new ArrayList<Object>());
objectStack.push(group);
stackedObjects++;
@@ -410,8 +411,8 @@
objectStack.push(disjunction);
stackedObjects++;
ArrayList<Object> disjOperands = new ArrayList<Object>();
- disjunction.put("type", "group");
- disjunction.put("operation", "or");
+ disjunction.put("@type", "korap:group");
+ disjunction.put("operation", "operation:"+"or");
disjunction.put("operands", disjOperands);
// decide where to put the disjunction
if (openNodeCats.get(1).equals("query")) {
@@ -455,7 +456,7 @@
String value = "";
ParseTree valNode = node.getChild(2);
String valType = QueryUtils.getNodeCat(valNode);
- fieldMap.put("type", "term");
+ fieldMap.put("@type", "korap:term");
if (valType.equals("simple_query")) {
value = valNode.getChild(0).getChild(0).toStringTree(poliqarpParser); //e.g. (simple_query (sq_segment foo))
} else if (valType.equals("re_query")) {
@@ -475,7 +476,7 @@
// Step II: decide where to put the field map (as the only value of a token or the meta filter or as a part of a group in case of coordinated fields)
if (fieldStack.isEmpty()) {
if (!inMeta) {
- tokenStack.getFirst().put("key", fieldMap);
+ tokenStack.getFirst().put("wrap", fieldMap);
} else {
((HashMap<String, Object>) requestMap.get("meta")).put("key", fieldMap);
}
@@ -495,7 +496,7 @@
if (nodeCat.equals("conj_field")) {
LinkedHashMap<String,Object> group = new LinkedHashMap<String,Object>();
ArrayList<Object> groupOperands = new ArrayList<Object>();
- group.put("type", "group");
+ group.put("@type", "korap:group");
group.put("operands", groupOperands);
fieldStack.push(groupOperands);
stackedFields++;
@@ -506,16 +507,16 @@
if (negField) {
relation = relation.equals("or") ? "and": "or";
}
- group.put("operation", relation);
+ group.put("operation", "operation:"+relation);
// Step II: decide where to put the group (directly under token or in top meta filter section or embed in super group)
if (openNodeCats.get(1).equals("cq_segment")) {
- tokenStack.getFirst().put("key", group);
+ tokenStack.getFirst().put("wrap", group);
} else if (openNodeCats.get(1).equals("meta_field_group")) {
((HashMap<String, Object>) requestMap.get("meta")).put("key", group);
} else if (openNodeCats.get(2).equals("conj_field")) {
fieldStack.get(1).add(group);
} else {
- tokenStack.getFirst().put("key", group);
+ tokenStack.getFirst().put("wrap", group);
}
// skip the operator
visited.add(node.getChild(1));
@@ -540,11 +541,11 @@
if (node.getText().equals("[]")) {
} else {
- token.put("type", "token");
+ token.put("@type", "korap:token");
String word = node.getChild(0).toStringTree(poliqarpParser);
LinkedHashMap<String,Object> tokenValues = new LinkedHashMap<String,Object>();
- token.put("key", tokenValues);
- tokenValues.put("type", "term");
+ token.put("wrap", tokenValues);
+ tokenValues.put("@type", "korap:term");
tokenValues.put("key", word);
tokenValues.put("layer", "orth");
tokenValues.put("match", "eq");
@@ -567,9 +568,9 @@
// if in field, regex was already added there
if (!openNodeCats.get(1).equals("field")) {
LinkedHashMap<String,Object> token = new LinkedHashMap<String,Object>();
- token.put("type", "token");
- token.put("key", reQuery);
- reQuery.put("type", "term");
+ token.put("@type", "korap:token");
+ token.put("wrap", reQuery);
+ reQuery.put("@type", "korap:term");
if (openNodeCats.get(1).equals("query")) {
requestMap.put("query", token);
@@ -591,7 +592,7 @@
stackedObjects++;
// Step I: get info
// fill group
- alignGroup.put("type", "group");
+ alignGroup.put("@type", "korap:group");
alignGroup.put("alignment", "left");
alignGroup.put("operands", new ArrayList<Object>());
// Step II: decide where to put the group
@@ -621,7 +622,7 @@
objectStack.push(elem);
stackedObjects++;
// Step II: fill object (token values) and put into containing sequence
- elem.put("type", "span");
+ elem.put("@type", "korap:span");
String value = node.getChild(1).toStringTree(poliqarpParser);
elem.put("key", value);
// add token to sequence only if it is not an only child (in that case, cq_segments has already added the info and is just waiting for the values from "field")
@@ -636,8 +637,8 @@
if (nodeCat.equals("spanclass")) {
LinkedHashMap<String,Object> span = new LinkedHashMap<String,Object>();
- span.put("type", "group");
- span.put("operation", "class");
+ span.put("@type", "korap:group");
+ span.put("operation", "operation:"+"class");
objectStack.push(span);
stackedObjects++;
ArrayList<Object> spanOperands = new ArrayList<Object>();
@@ -680,9 +681,9 @@
ArrayList<Object> posOperands = new ArrayList<Object>();
// Step I: get info
String relation = QueryUtils.getNodeCat(node.getChild(0));
- positionGroup.put("type", "group");
- positionGroup.put("operation", "position");
- positionGroup.put("frame", relation.toLowerCase());
+ positionGroup.put("@type", "korap:group");
+ positionGroup.put("operation", "operation:"+"position");
+ positionGroup.put("frame", "frame:"+relation.toLowerCase());
// positionGroup.put("@subtype", "incl");
positionGroup.put("operands", posOperands);
// Step II: decide where to put the group
@@ -704,7 +705,6 @@
stackedObjects++;
ArrayList<Object> shrinkOperands = new ArrayList<Object>();
// Step I: get info
- System.out.println("WAAAAAAAHHHHHHHHHHHHHHHHHHHHHH "+node.getChild(2).toStringTree(poliqarpParser));
ArrayList<Integer> classRefs = new ArrayList<Integer>();
String classRefOp = null;
if (QueryUtils.getNodeCat(node.getChild(2)).equals("spanclass_id")) {
@@ -730,13 +730,13 @@
} else {
classRefs.add(0);
}
- shrinkGroup.put("type", "group");
+ shrinkGroup.put("@type", "korap:group");
String type = node.getChild(0).toStringTree(poliqarpParser);
String operation = type.equals("shrink") ? "submatch" : "split";
- shrinkGroup.put("operation", operation);
+ shrinkGroup.put("operation", "operation:"+operation);
shrinkGroup.put("classRef", classRefs);
if (classRefOp != null) {
- shrinkGroup.put("classRefOp", classRefOp);
+ shrinkGroup.put("classRefOp", "classRefOp:"+classRefOp);
}
shrinkGroup.put("operands", shrinkOperands);
int i=1;
@@ -758,10 +758,10 @@
if (nodeCat.equals("occ")) {
ParseTree occChild = node.getChild(0);
String repetition = occChild.toStringTree(poliqarpParser);
- String[] minmax = parseRepetition(repetition);
- curOccGroup.put("operation", "repetition");
- curOccGroup.put("@min", minmax[0]);
- curOccGroup.put("@max", minmax[1]);
+ int[] minmax = parseRepetition(repetition);
+ curOccGroup.put("operation", "operation:"+"repetition");
+ curOccGroup.put("min", minmax[0]);
+ curOccGroup.put("max", minmax[1]);
visited.add(occChild);
}
@@ -769,14 +769,14 @@
if (nodeCat.equals("flag")) {
String flag = QueryUtils.getNodeCat(node.getChild(0)).substring(1); //substring removes leading slash '/'
// add to current token's value
- ((HashMap<String, Object>) curToken.get("key")).put("flag", flag);
+ ((HashMap<String, Object>) curToken.get("wrap")).put("flag", flag);
}
if (nodeCat.equals("meta")) {
inMeta=true;
LinkedHashMap<String,Object> metaFilter = new LinkedHashMap<String,Object>();
requestMap.put("meta", metaFilter);
- metaFilter.put("type", "meta");
+ metaFilter.put("@type", "korap:meta");
}
if (nodeCat.equals("within") && !QueryUtils.getNodeCat(node.getParent()).equals("position")) {
@@ -833,16 +833,17 @@
openNodeCats.pop();
}
- private String[] parseRepetition(String repetition) {
+ private int[] parseRepetition(String repetition) {
if (repetition.equals("*")) {
- return new String[] {"0", "100"};
+ return new int[] {0, 100};
} else if (repetition.equals("+")) {
- return new String[] {"1", "100"};
+ return new int[] {1, 100};
} else if (repetition.equals("?")) {
- return new String[] {"0", "1"};
+ return new int[] {0, 1};
} else {
repetition = repetition.substring(1, repetition.length()-1); // remove braces
- return repetition.split(",");
+ String[] splitted = repetition.split(",");
+ return new int[] {Integer.parseInt(splitted[0]), Integer.parseInt(splitted[1])};
}
}
@@ -888,7 +889,7 @@
@SuppressWarnings("unchecked")
private void createOccGroup(ParseTree node) {
LinkedHashMap<String,Object> occGroup = new LinkedHashMap<String,Object>();
- occGroup.put("type", "group");
+ occGroup.put("@type", "korap:group");
ArrayList<Object> groupOperands = new ArrayList<Object>();
occGroup.put("operands", groupOperands);
curOccGroup = occGroup;
diff --git a/src/test/java/CosmasTreeTest.java b/src/test/java/CosmasTreeTest.java
index 24306b5..1b28c5a 100644
--- a/src/test/java/CosmasTreeTest.java
+++ b/src/test/java/CosmasTreeTest.java
@@ -7,7 +7,7 @@
public class CosmasTreeTest {
- CosmasTree ppt;
+ CosmasTree ct;
String map;
String query;
@@ -19,20 +19,20 @@
private boolean equalsQueryContent(String res, String query) throws QueryException {
res = res.replaceAll(" ", "");
- ppt = new CosmasTree(query);
- String queryMap = ppt.getRequestMap().get("query").toString().replaceAll(" ", "");
+ ct = new CosmasTree(query);
+ String queryMap = ct.getRequestMap().get("query").toString().replaceAll(" ", "");
return res.equals(queryMap);
}
// @Test
public void testContext() throws QueryException {
- String contextString = "{korap = http://ids-mannheim.de/ns/KorAP/json-ld/v0.1/, " +
+ String contextString = "{korap = http://korap.ids-mannheim.de/ns/KorAP/json-ld/v0.1/, " +
"boundary = korap:boundary/,"+
"group = korap:group/,"+
"operation = {@id = group:operation/, @type = @id},"+
"class = {@id = group:class, @type = xsd:integer},"+
"operands = {@id = group:operands, @container = @list},"+
- "frame = {@id = group:frame/, @type = xsd:integer},"+
+ "frame = {@id = group:frame/, @type = @id},"+
"classRef = {@id = group:classRef, @type = xsd:integer},"+
"spanRef = {@id = group:spanRef, @type = xsd:integer},"+
"classRefOp = {@id = group:classRefOp, @type = @id},"+
@@ -40,11 +40,10 @@
"max = {@id = boundary:max, @type = xsd:integer},"+
"exclude = {@id = group:exclude, @type = xsd:boolean},"+
"distances = {@id = group:distances, @container = @list},"+
- "inOrder = {@id = group:inOrder, @type = xsd:boolean},"+
+ "inOrder = {@id = group:inOrder, @type = xsd:boolean}"+
"}";
- ppt = new CosmasTree("Test");
-// assertTrue(equalsContent(contextString, ppt.getRequestMap().get("@context")));
- assertEquals(contextString.replaceAll(" ", ""), ppt.getRequestMap().get("@context"));
+ ct = new CosmasTree("Test");
+ assertEquals(contextString.replaceAll(" ", ""), ct.getRequestMap().get("@context").toString().replaceAll(" ", ""));
}
@@ -52,23 +51,23 @@
public void testSingleToken() throws QueryException {
query="der";
String single1 =
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}";
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(single1.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="Mann";
String single2 =
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}";
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(single2.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="&Mann";
String single3 =
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}";
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(single3.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -81,9 +80,9 @@
public void testMORPH() throws QueryException {
query="#MORPH(V)";
String morph1 =
- "{type=token, key={type=term, key=V, match=eq}}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ "{@type=korap:token, wrap={@type=korap:term, key=V, match=eq}}";
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(morph1.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -91,35 +90,35 @@
public void testSequence() throws QueryException {
query="der Mann";
String seq1 =
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(seq1.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="der Mann schläft";
String seq2 =
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=schläft, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=schläft, layer=orth, match=eq}}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(seq2.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="der Mann schläft lang";
String seq3 =
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=schläft, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=lang, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=schläft, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=lang, layer=orth, match=eq}}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(seq3.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -127,41 +126,41 @@
public void testOPOR() throws QueryException {
query="Sonne oder Mond";
String disj1 =
- "{type=group, operation=or, operands=[" +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(disj1.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="(Sonne scheint) oder Mond";
String disj2 =
- "{type=group, operation=or, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=scheint, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=eq}}" +
"]}," +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(disj2.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="(Sonne scheint) oder (Mond scheint)";
String disj3 =
- "{type=group, operation=or, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=scheint, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=eq}}" +
"]}," +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=scheint, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=eq}}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(disj3.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -170,28 +169,28 @@
public void testOPORAND() throws QueryException {
query="(Sonne oder Mond) und scheint";
String orand1 =
- "{type=group, operation=and, operands=[" +
- "{type=group, operation=or, operands=[" +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:and, operands=[" +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}" +
"]}," +
- "{type=token, key={type=term, key=scheint, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=eq}}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(orand1.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="scheint und (Sonne oder Mond)";
String orand2 =
- "{type=group, operation=and, operands=[" +
- "{type=token, key={type=term, key=scheint, layer=orth, match=eq}}," +
- "{type=group, operation=or, operands=[" +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:and, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=scheint, layer=orth, match=eq}}," +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(orand2.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -199,85 +198,85 @@
public void testOPPROX() throws QueryException {
query="Sonne /+w1:4 Mond";
String prox1 =
- "{type=group, operation=sequence, inOrder=true, " +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
"distances=[" +
- "{type=distance, measure=w, min=1, max=4}" +
+ "{@type=korap:distance, key=w, min=1, max=4}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}" +
"]" +
"}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(prox1.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="Sonne /+w1:4,s0,p1:3 Mond";
String prox2 =
- "{type=group, operation=sequence, inOrder=true, " +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
"distances=[" +
- "{type=group, operation=and, operands=[" +
- "{type=distance, measure=w, min=1, max=4}," +
- "{type=distance, measure=s, min=0, max=0}," +
- "{type=distance, measure=p, min=1, max=3}" +
+ "{@type=korap:group, operation=operation:and, operands=[" +
+ "{@type=korap:distance, key=w, min=1, max=4}," +
+ "{@type=korap:distance, key=s, min=0, max=0}," +
+ "{@type=korap:distance, key=p, min=1, max=3}" +
"]}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}" +
"]" +
"}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(prox2.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="Sonne %+w1:4,s0,p1:3 Mond";
String prox3 =
- "{type=group, operation=sequence, inOrder=true, " +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
"distances=[" +
- "{type=group, operation=and, operands=[" +
- "{type=distance, measure=w, min=1, max=4, exclude=true}," +
- "{type=distance, measure=s, min=0, max=0, exclude=true}," +
- "{type=distance, measure=p, min=1, max=3, exclude=true}" +
+ "{@type=korap:group, operation=operation:and, operands=[" +
+ "{@type=korap:distance, key=w, min=1, max=4, exclude=true}," +
+ "{@type=korap:distance, key=s, min=0, max=0, exclude=true}," +
+ "{@type=korap:distance, key=p, min=1, max=3, exclude=true}" +
"]}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}" +
"]" +
"}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(prox3.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="Sonne /+w4 Mond";
String prox4 =
- "{type=group, operation=sequence, inOrder=true, " +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
"distances=[" +
- "{type=distance, measure=w, min=0, max=4}" +
+ "{@type=korap:distance, key=w, min=0, max=4}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}" +
"]" +
"}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(prox4.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="Sonne /-w4 Mond";
String prox5 =
- "{type=group, operation=sequence, inOrder=true, " +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
"distances=[" +
- "{type=distance, measure=w, min=0, max=4}" +
+ "{@type=korap:distance, key=w, min=0, max=4}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}" +
"]" +
"}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(prox5.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -285,24 +284,24 @@
public void testOPPROXNested() throws QueryException {
query="Sonne /-w4 Mond /+w2 Sterne";
String prox6 =
- "{type=group, operation=sequence, inOrder=true, " +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
"distances=[" +
- "{type=distance, measure=w, min=0, max=4}" +
+ "{@type=korap:distance, key=w, min=0, max=4}" +
"], " +
"operands=[" +
- "{type=group, operation=sequence, inOrder=true, " +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, " +
"distances=[" +
- "{type=distance, measure=w, min=0, max=2}" +
+ "{@type=korap:distance, key=w, min=0, max=2}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Sterne, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sterne, layer=orth, match=eq}}" +
"]}," +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}" +
"]" +
"}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(prox6.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -310,58 +309,58 @@
public void testOPIN() throws QueryException {
query="wegen #IN <s>";
String opin1 =
- "{type=group, operation=submatch, classRef=1, operands=[" +
- "{type=group, operation=position, frame=contains, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=token, key={type=term, key=wegen, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
+ "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(opin1.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="wegen #IN(L) <s>";
String opin2 =
- "{type=group, operation=submatch, classRef=1, operands=[" +
- "{type=group, operation=position, frame=startswith, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=token, key={type=term, key=wegen, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
+ "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(opin2.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="wegen #IN(%, L) <s>";
String opin3 =
- "{type=group, operation=submatch, classRef=1, operands=[" +
- "{type=group, operation=position, frame=startswith, exclude=true, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=token, key={type=term, key=wegen, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
+ "{@type=korap:group, operation=operation:position, frame=frame:startswith, exclude=true, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(opin3.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="wegen #IN('FE,ALL,%,MIN') <s>";
String opin4 =
- "{type=group, operation=submatch, classRef=1, operands=[" +
- "{type=group, operation=position, frame=matches, range=all, exclude=true, grouping=false, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=token, key={type=term, key=wegen, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
+ "{@type=korap:group, operation=operation:position, frame=frame:matches, range=all, exclude=true, grouping=false, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(opin4.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -369,30 +368,30 @@
public void testOPOV() throws QueryException {
query="wegen #OV <s>";
String opov1 =
- "{type=group, operation=submatch, classRef=1, operands=[" +
- "{type=group, operation=position, frame=overlaps, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=token, key={type=term, key=wegen, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
+ "{@type=korap:group, operation=operation:position, frame=frame:overlaps, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(opov1.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="wegen #OV(L) <s>";
String opov2 =
- "{type=group, operation=submatch, classRef=1, operands=[" +
- "{type=group, operation=position, frame=overlaps-left, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=token, key={type=term, key=wegen, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
+ "{@type=korap:group, operation=operation:position, frame=frame:overlaps-left, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=wegen, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(opov2.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -400,12 +399,12 @@
public void testOPNOT() throws QueryException {
query="Sonne nicht Mond";
String opnot1 =
- "{type=group, operation=not, operands=[" +
- "{type=token, key={type=term, key=Sonne, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mond, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:not, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=eq}}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(opnot1.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -417,52 +416,52 @@
// http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/thematische-bsp/bsp-satzlaenge.html
query="#BEG(der /w3:5 Mann)";
String beg1 =
- "{type=group, operation=submatch, @spanRef=[0,1], operands=[" +
- "{type=group, operation=sequence, inOrder=false, distances=[" +
- "{type=distance, measure=w, min=3, max=5}" +
+ "{@type=korap:group, operation=operation:submatch, @spanRef=[0,1], operands=[" +
+ "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" +
+ "{@type=korap:distance, key=w, min=3, max=5}" +
"]," +
"operands = [" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(beg1.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="#BEG(der /w3:5 Mann) /+w10 kommt"; // nesting #BEG() in a distance group
String beg2 =
- "{type=group, operation=sequence, inOrder=true, distances=[" +
- "{type=distance, measure=w, min=0, max=10}" +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
+ "{@type=korap:distance, key=w, min=0, max=10}" +
"], operands=[" +
- "{type=group, operation=submatch, @spanRef=[0,1], operands=[" +
- "{type=group, operation=sequence, inOrder=false, distances=[" +
- "{type=distance, measure=w, min=3, max=5}" +
+ "{@type=korap:group, operation=operation:submatch, @spanRef=[0,1], operands=[" +
+ "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" +
+ "{@type=korap:distance, key=w, min=3, max=5}" +
"]," +
"operands = [" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
"]}" +
"]}," +
- "{type=token, key={type=term, key=kommt, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=kommt, layer=orth, match=eq}}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(beg2.replaceAll(" ", ""), map.replaceAll(" ", ""));
query="#END(der /w3:5 Mann)";
String end1 =
- "{type=group, operation=submatch, @spanRef=[-1,1], operands=[" +
- "{type=group, operation=sequence, inOrder=false, distances=[" +
- "{type=distance, measure=w, min=3, max=5}" +
+ "{@type=korap:group, operation=operation:submatch, @spanRef=[-1,1], operands=[" +
+ "{@type=korap:group, operation=operation:sequence, inOrder=false, distances=[" +
+ "{@type=korap:distance, key=w, min=3, max=5}" +
"], " +
"operands = [" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(end1.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -471,9 +470,9 @@
public void testELEM() throws QueryException {
// http://www.ids-mannheim.de/cosmas2/web-app/hilfe/suchanfrage/eingabe-zeile/syntax/elem.html
query="#ELEM(S)";
- String elem1 = "{type=span, key=s}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ String elem1 = "{@type=korap:span, key=s}";
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(elem1.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -481,17 +480,17 @@
public void testOPALL() throws QueryException {
query="#ALL(gehen /w1:10 voran)";
String all1 =
- "{type=group, operation=sequence, inOrder=false, " +
+ "{@type=korap:group, operation=operation:sequence, inOrder=false, " +
"distances=[" +
- "{type=distance, measure=w, min=1, max=10}" +
+ "{@type=korap:distance, key=w, min=1, max=10}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=gehen, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=voran, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=eq}}" +
"]" +
"}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(all1.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -499,17 +498,17 @@
public void testOPNHIT() throws QueryException {
query="#NHIT(gehen /w1:10 voran)";
String nhit1 =
- "{type=group, operation=sequence, inOrder=false, " +
+ "{@type=korap:group, operation=operation:sequence, inOrder=false, " +
"distances=[" +
- "{type=distance, measure=w, min=1, max=10}" +
+ "{@type=korap:distance, key=w, min=1, max=10}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=gehen, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=voran, layer=orth, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=gehen, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=voran, layer=orth, match=eq}}" +
"]" +
"}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(nhit1.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
@@ -517,47 +516,47 @@
public void testOPBED() throws QueryException {
query = "#BED(der , sa)";
String bed1 =
- "{type=group, operation=position, frame=startswith, operands=[" +
- "{type=span, key=s}," +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(bed1.replaceAll(" ", ""), map.replaceAll(" ", ""));
query = "#BED(der Mann , +pe)";
String bed2 =
- "{type=group, operation=position, frame=endswith, operands=[" +
- "{type=span, key=p}," +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:position, frame=frame:endswith, operands=[" +
+ "{@type=korap:span, key=p}," +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(bed2.replaceAll(" ", ""), map.replaceAll(" ", ""));
query = "#BED(der Mann , sa,-pa)";
String bed3 =
- "{type=group, operation=and, operands=[" +
- "{type=group, operation=position, frame=startswith, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:and, operands=[" +
+ "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
"]}" +
"]}," +
- "{type=group, operation=position, frame=startswith, exclude=true, operands=[" +
- "{type=span, key=p}," +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:position, frame=frame:startswith, exclude=true, operands=[" +
+ "{@type=korap:span, key=p}," +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}";
- ppt = new CosmasTree(query);
- map = ppt.getRequestMap().get("query").toString();
+ ct = new CosmasTree(query);
+ map = ct.getRequestMap().get("query").toString();
assertEquals(bed3.replaceAll(" ", ""), map.replaceAll(" ", ""));
}
diff --git a/src/test/java/PoliqarpPlusTreeTest.java b/src/test/java/PoliqarpPlusTreeTest.java
index 1837a1b..5a69053 100644
--- a/src/test/java/PoliqarpPlusTreeTest.java
+++ b/src/test/java/PoliqarpPlusTreeTest.java
@@ -2,6 +2,7 @@
import org.junit.Test;
+import de.ids_mannheim.korap.query.serialize.CosmasTree;
import de.ids_mannheim.korap.query.serialize.PoliqarpPlusTree;
import de.ids_mannheim.korap.util.QueryException;
@@ -25,39 +26,53 @@
// @Test
public void testContext() throws QueryException {
- String contextString = "{korap=http://korap.ids-mannheim.de/ns/query, @language=de, operands={@id=korap:operands, @container=@list}, operation={@id=korap:relation, type=korap:relation#types}, class={@id=korap:class, type=xsd:integer}, query=korap:query, filter=korap:filter, meta=korap:meta}";
- ppt = new PoliqarpPlusTree("[base=test]");
-// assertTrue(equalsContent(contextString, ppt.getRequestMap().get("@context")));
- assertEquals(contextString, ppt.getRequestMap().get("@context"));
+ String contextString = "{korap = http://korap.ids-mannheim.de/ns/KorAP/json-ld/v0.1/, " +
+ "boundary = korap:boundary/,"+
+ "group = korap:group/,"+
+ "operation = {@id = group:operation/, @type = @id},"+
+ "class = {@id = group:class, @type = xsd:integer},"+
+ "operands = {@id = group:operands, @container = @list},"+
+ "frame = {@id = group:frame/, @type = @id},"+
+ "classRef = {@id = group:classRef, @type = xsd:integer},"+
+ "spanRef = {@id = group:spanRef, @type = xsd:integer},"+
+ "classRefOp = {@id = group:classRefOp, @type = @id},"+
+ "min = {@id = boundary:min, @type = xsd:integer},"+
+ "max = {@id = boundary:max, @type = xsd:integer},"+
+ "exclude = {@id = group:exclude, @type = xsd:boolean},"+
+ "distances = {@id = group:distances, @container = @list},"+
+ "inOrder = {@id = group:inOrder, @type = xsd:boolean}"+
+ "}";
+ ppt = new PoliqarpPlusTree("Test");
+ assertEquals(contextString.replaceAll(" ", ""), ppt.getRequestMap().get("@context").toString().replaceAll(" ", ""));
}
@Test
public void testSingleTokens() throws QueryException {
// [base=Mann]
- String token1 = "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}";
+ String token1 = "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}";
assertTrue(equalsQueryContent(token1, "[base=Mann]"));
// [orth!=Frau]
- String token2 = "{type=token, key={type=term, key=Frau, layer=orth, match=ne}}";
+ String token2 = "{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=ne}}";
assertTrue(equalsQueryContent(token2, "[orth!=Frau]"));
// [!p=NN]
- String token3 = "{type=token, key={type=term, key=NN, layer=p, match=ne}}";
+ String token3 = "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=ne}}";
assertTrue(equalsQueryContent(token3, "[!p=NN]"));
// [!p!=NN]
- String token4 = "{type=token, key={type=term, key=NN, layer=p, match=eq}}";
+ String token4 = "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=eq}}";
assertTrue(equalsQueryContent(token4, "[!p!=NN]"));
}
@Test
public void testElements() throws QueryException {
// <s>
- String elem1 = "{type=span, key=s}";
+ String elem1 = "{@type=korap:span, key=s}";
assertTrue(equalsQueryContent(elem1, "<s>"));
// <vp>
- String elem2 = "{type=span, key=vp}";
+ String elem2 = "{@type=korap:span, key=vp}";
assertTrue(equalsQueryContent(elem2, "<vp>"));
}
@@ -65,12 +80,12 @@
public void testEmptyTokens() throws QueryException {
// [base=der][][base=Mann]
String et1 =
- "{type=group, operation=sequence, inOrder=true, distances=[" +
- "{type=distance, measure=w, min=1, max=1}" +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
+ "{@type=korap:distance, key=w, min=1, max=1}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("[base=der][][base=Mann]");
map = ppt.getRequestMap().get("query").toString();
@@ -78,12 +93,12 @@
// [base=der][][][base=Mann]
String et2 =
- "{type=group, operation=sequence, inOrder=true, distances=[" +
- "{type=distance, measure=w, min=2, max=2}" +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
+ "{@type=korap:distance, key=w, min=2, max=2}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("[base=der][][][base=Mann]");
map = ppt.getRequestMap().get("query").toString();
@@ -91,12 +106,12 @@
// [base=der][][]?[base=Mann]
String et3 =
- "{type=group, operation=sequence, inOrder=true, distances=[" +
- "{type=distance, measure=w, min=1, max=2}" +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
+ "{@type=korap:distance, key=w, min=1, max=2}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("[base=der][][]?[base=Mann]");
map = ppt.getRequestMap().get("query").toString();
@@ -105,10 +120,10 @@
// startswith(<s>, [][base=Mann]
String et4 =
- "{type=group, operation=position, frame=startswith, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=sequence, offset-min=1, offset-max=1, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:sequence, offset-min=1, offset-max=1, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
"]}" +
"]}";
ppt = new PoliqarpPlusTree("startswith(<s>, [][base=Mann])");
@@ -117,17 +132,17 @@
// [base=der][]{2,5}[base=Mann][]?[][base=Frau] nested distances=
String et5 =
- "{type=group, operation=sequence, inOrder=true, distances=[" +
- "{type=distance, measure=w, min=2, max=5}" +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
+ "{@type=korap:distance, key=w, min=2, max=5}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
- "{type=group, operation=sequence, inOrder=true, distances=[" +
- "{type=distance, measure=w, min=1, max=2}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+ "{@type=korap:group, operation=operation:sequence, inOrder=true, distances=[" +
+ "{@type=korap:distance, key=w, min=1, max=2}" +
"], " +
"operands=[" +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=Frau, layer=lemma, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=lemma, match=eq}}" +
"]}" +
"]}";
ppt = new PoliqarpPlusTree("[base=der][]{2,5}[base=Mann][]?[][base=Frau]");
@@ -140,14 +155,14 @@
public void testCoordinatedFields() throws QueryException {
// [base=Mann&(cas=N|cas=A)]
String cof1 =
- "{type=token, key=" +
- "{type=group, operands=[" +
- "{type=term, key=Mann, layer=lemma, match=eq}," +
- "{type=group, operands=[" +
- "{type=term, key=N, layer=cas, match=eq}," +
- "{type=term, key=A, layer=cas, match=eq}" +
- "], operation=or}" +
- "], operation=and}" +
+ "{@type=korap:token, wrap=" +
+ "{@type=korap:group, operands=[" +
+ "{@type=korap:term, key=Mann, layer=lemma, match=eq}," +
+ "{@type=korap:group, operands=[" +
+ "{@type=korap:term, key=N, layer=cas, match=eq}," +
+ "{@type=korap:term, key=A, layer=cas, match=eq}" +
+ "], operation=operation:or}" +
+ "], operation=operation:and}" +
"}";
ppt = new PoliqarpPlusTree("[base=Mann&(cas=N|cas=A)]");
map = ppt.getRequestMap().get("query").toString();
@@ -161,12 +176,12 @@
// [base=Mann&cas=N&gen=m]
String cof2 =
- "{type=token, key=" +
- "{type=group, operands=[" +
- "{type=term, key=Mann, layer=lemma, match=eq}," +
- "{type=term, key=N, layer=cas, match=eq}," +
- "{type=term, key=m, layer=gen, match=eq}" +
- "], operation=and}" +
+ "{@type=korap:token, wrap=" +
+ "{@type=korap:group, operands=[" +
+ "{@type=korap:term, key=Mann, layer=lemma, match=eq}," +
+ "{@type=korap:term, key=N, layer=cas, match=eq}," +
+ "{@type=korap:term, key=m, layer=gen, match=eq}" +
+ "], operation=operation:and}" +
"}";
ppt = new PoliqarpPlusTree("[base=Mann&cas=N&gen=m]");
map = ppt.getRequestMap().get("query").toString();
@@ -176,20 +191,20 @@
@Test
public void testOccurrence() throws QueryException {
// [base=foo]*
- String occ1 = "{type=group, operands=[" +
- "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
- "], operation=repetition, @min=0, @max=100}";
+ String occ1 = "{@type=korap:group, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+ "], operation=operation:repetition, min=0, max=100}";
ppt = new PoliqarpPlusTree("[base=foo]*");
map = ppt.getRequestMap().get("query").toString();
assertEquals(occ1.replaceAll(" ", ""), map.replaceAll(" ", ""));
// [base=foo]*[base=bar]
String occ2 =
- "{type=group, operation=sequence, operands=[" +
- "{type=group, operands=[" +
- "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
- "], operation=repetition, @min=0, @max=100 }," +
- "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:group, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+ "], operation=operation:repetition, min=0, max=100 }," +
+ "{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("[base=foo]*[base=bar]");
map = ppt.getRequestMap().get("query").toString();
@@ -197,11 +212,11 @@
// [base=bar][base=foo]*
String occ3 =
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
- "{type=group, operands=[" +
- "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
- "], operation=repetition, @min=0, @max=100 }" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+ "{@type=korap:group, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+ "], operation=operation:repetition, min=0, max=100 }" +
"]}";
ppt = new PoliqarpPlusTree("[base=bar][base=foo]*");
map = ppt.getRequestMap().get("query").toString();
@@ -209,26 +224,26 @@
// ([base=bar][base=foo])*
String occ4 =
- "{type=group, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
"]}" +
- "], operation=repetition, @min=0, @max=100 }" ;
+ "], operation=operation:repetition, min=0, max=100 }" ;
ppt = new PoliqarpPlusTree("([base=bar][base=foo])*");
map = ppt.getRequestMap().get("query").toString();
assertEquals(occ4.replaceAll(" ", ""), map.replaceAll(" ", ""));
// <s>([base=bar][base=foo])*
String occ5 =
- "{type=group, operation=sequence, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
"]}" +
- "], operation=repetition, @min=0, @max=100 }" +
+ "], operation=operation:repetition, min=0, max=100 }" +
"]}" ;
ppt = new PoliqarpPlusTree("<s>([base=bar][base=foo])*");
map = ppt.getRequestMap().get("query").toString();
@@ -236,15 +251,15 @@
// <s><np>([base=bar][base=foo])*
String occ6 =
- "{type=group, operation=sequence, operands=[" +
- "{type=span, key=s}," +
- "{type=span, key=np}," +
- "{type=group, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:span, key=np}," +
+ "{@type=korap:group, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
"]}" +
- "], operation=repetition, @min=0, @max=100 }" +
+ "], operation=operation:repetition, min=0, max=100 }" +
"]}" ;
ppt = new PoliqarpPlusTree("<s><np>([base=bar][base=foo])*");
map = ppt.getRequestMap().get("query").toString();
@@ -254,16 +269,16 @@
// comment: embedded sequence shouldn't really be here, but does not really hurt, either. (?)
// really hard to get this behaviour out of the PQPlus grammar...
String occ7 =
- "{type=group, operation=sequence, operands=[" +
- "{type=span, key=s}," +
- "{type=span, key=np}," +
- "{type=group, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:span, key=np}," +
+ "{@type=korap:group, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
"]}" +
- "], operation=repetition, @min=0, @max=100 }," +
- "{type=token, key={type=term, key=NN, layer=p, match=eq}}" +
+ "], operation=operation:repetition, min=0, max=100 }," +
+ "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=eq}}" +
"]}" ;
ppt = new PoliqarpPlusTree("<s><np>([base=bar][base=foo])*[p=NN]");
map = ppt.getRequestMap().get("query").toString();
@@ -271,39 +286,39 @@
// ([base=bar][base=foo])*[p=NN]
String occ8 =
- "{type=group, operation=sequence, operands=[" +
- "{type=group, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=bar, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:group, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=bar, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
"]}" +
- "], operation=repetition, @min=0, @max=100 }," +
- "{type=token, key={type=term, key=NN, layer=p, match=eq}}" +
+ "], operation=operation:repetition, min=0, max=100 }," +
+ "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=eq}}" +
"]}" ;
ppt = new PoliqarpPlusTree("([base=bar][base=foo])*[p=NN]");
map = ppt.getRequestMap().get("query").toString();
assertEquals(occ8.replaceAll(" ", ""), map.replaceAll(" ", ""));
// [base=foo]+
- String occ9 = "{type=group, operands=[" +
- "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
- "], operation=repetition, @min=1, @max=100}";
+ String occ9 = "{@type=korap:group, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+ "], operation=operation:repetition, min=1, max=100}";
ppt = new PoliqarpPlusTree("[base=foo]+");
map = ppt.getRequestMap().get("query").toString();
assertEquals(occ9.replaceAll(" ", ""), map.replaceAll(" ", ""));
// [base=foo]?
- String occ10 = "{type=group, operands=[" +
- "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
- "], operation=repetition, @min=0, @max=1}";
+ String occ10 = "{@type=korap:group, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+ "], operation=operation:repetition, min=0, max=1}";
ppt = new PoliqarpPlusTree("[base=foo]?");
map = ppt.getRequestMap().get("query").toString();
assertEquals(occ10.replaceAll(" ", ""), map.replaceAll(" ", ""));
// [base=foo]{2,5}
- String occ11 = "{type=group, operands=[" +
- "{type=token, key={type=term, key=foo, layer=lemma, match=eq}}" +
- "], operation=repetition, @min=2, @max=5}";
+ String occ11 = "{@type=korap:group, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=eq}}" +
+ "], operation=operation:repetition, min=2, max=5}";
ppt = new PoliqarpPlusTree("[base=foo]{2,5}");
map = ppt.getRequestMap().get("query").toString();
assertEquals(occ11.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -312,17 +327,17 @@
@Test
public void testTokenSequence() throws QueryException {
// [base=Mann][orth=Frau]
- String seq1 = "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " +
- "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" +
+ String seq1 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}, " +
+ "{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=eq}}" +
"]}";
assertTrue(equalsQueryContent(seq1, "[base=Mann][orth=Frau]"));
// [base=Mann][orth=Frau][p=NN]
- String seq2 = "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " +
- "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}, " +
- "{type=token, key={type=term, key=NN,layer=p, match=eq}}" +
+ String seq2 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}, " +
+ "{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=eq}}, " +
+ "{@type=korap:token, wrap={@type=korap:term, key=NN,layer=p, match=eq}}" +
"]}";
assertTrue(equalsQueryContent(seq2, "[base=Mann][orth=Frau][p=NN]"));
}
@@ -331,12 +346,12 @@
public void testDisjSegments() throws QueryException {
// ([base=der]|[base=das])[base=Schild]
String disj1 =
- "{type=group, operation=sequence, operands=[" +
- "{type=group, operation=or, operands=[" +
- "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=das, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=das, layer=lemma, match=eq}}" +
"]}," +
- "{type=token, key={type=term, key=Schild, layer=lemma, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Schild, layer=lemma, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("([base=der]|[base=das])[base=Schild]");
map = ppt.getRequestMap().get("query").toString();
@@ -344,11 +359,11 @@
// [base=Schild]([base=der]|[base=das])
String disj2 =
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Schild, layer=lemma, match=eq}}," +
- "{type=group, operation=or, operands=[" +
- "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=das, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Schild, layer=lemma, match=eq}}," +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=das, layer=lemma, match=eq}}" +
"]}" +
"]}";
ppt = new PoliqarpPlusTree("[base=Schild]([base=der]|[base=das])");
@@ -359,24 +374,24 @@
@Test
public void testTokenElemSequence() throws QueryException {
// [base=Mann]<vp>
- String seq1 = "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " +
- "{type=span, key=vp}" +
+ String seq1 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}, " +
+ "{@type=korap:span, key=vp}" +
"]}";
assertTrue(equalsQueryContent(seq1, "[base=Mann]<vp>"));
// <vp>[base=Mann]
- String seq2 = "{type=group, operation=sequence, operands=[" +
- "{type=span, key=vp}, "+
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}} " +
+ String seq2 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:span, key=vp}, "+
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}} " +
"]}";
assertTrue(equalsQueryContent(seq2, "<vp>[base=Mann]"));
// <vp>[base=Mann]<pp>
- String seq3 = "{type=group, operation=sequence, operands=[" +
- "{type=span, key=vp}, "+
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}, " +
- "{type=span, key=pp} "+
+ String seq3 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:span, key=vp}, "+
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}, " +
+ "{@type=korap:span, key=pp} "+
"]}";
assertTrue(equalsQueryContent(seq3, "<vp>[base=Mann]<pp>"));
}
@@ -384,17 +399,17 @@
@Test
public void testElemSequence() throws QueryException {
// <np><vp>
- String seq1 = "{type=group, operation=sequence, operands=[" +
- "{type=span, key=np}," +
- "{type=span, key=vp}" +
+ String seq1 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:span, key=np}," +
+ "{@type=korap:span, key=vp}" +
"]}";
assertTrue(equalsQueryContent(seq1, "<np><vp>"));
// <np><vp><pp>
- String seq2 = "{type=group, operation=sequence, operands=[" +
- "{type=span, key=np}," +
- "{type=span, key=vp}," +
- "{type=span, key=pp}" +
+ String seq2 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:span, key=np}," +
+ "{@type=korap:span, key=vp}," +
+ "{@type=korap:span, key=pp}" +
"]}";
assertTrue(equalsQueryContent(seq2, "<np><vp><pp>"));
}
@@ -402,55 +417,55 @@
@Test
public void testClasses() throws QueryException {
// {[base=Mann]}
- String cls1 = "{type=group, operation=class, class=0, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+ String cls1 = "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("{[base=Mann]}");
map = ppt.getRequestMap().get("query").toString();
assertEquals(cls1.replaceAll(" ", ""), map.replaceAll(" ", ""));
// {[base=Mann][orth=Frau]}
- String cls2 = "{type=group, operation=class, class=0, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" +
+ String cls2 = "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=eq}}" +
"]}" +
"]}";
assertTrue(equalsQueryContent(cls2, "{[base=Mann][orth=Frau]}"));
// [p=NN]{[base=Mann][orth=Frau]}
- String cls3 = "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=NN, layer=p, match=eq}}," +
- "{type=group, operation=class, class=0, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" +
+ String cls3 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=eq}}," +
+ "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}";
assertTrue(equalsQueryContent(cls3, "[p=NN]{[base=Mann][orth=Frau]}"));
// {[base=Mann][orth=Frau]}[p=NN]
- String cls4 = "{type=group, operation=sequence, operands=[" +
- "{type=group, operation=class, class=0, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=Frau, layer=orth, match=eq}}" +
+ String cls4 = "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Frau, layer=orth, match=eq}}" +
"]}" +
"]}," +
- "{type=token, key={type=term, key=NN, layer=p, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("{[base=Mann][orth=Frau]}[p=NN]");
map = ppt.getRequestMap().get("query").toString();
assertEquals(cls4.replaceAll(" ", ""), map.replaceAll(" ", ""));
// {2:{1:[tt/p=ADJA]}[mate/p=NN]}"
- String cls5 = "{type=group, operation=class, class=2, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=token, key={type=term, key=ADJA, layer=p, foundry=tt, match=eq}}" +
+ String cls5 = "{@type=korap:group, operation=operation:class, class=2, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=ADJA, layer=p, foundry=tt, match=eq}}" +
"]}," +
- "{type=token, key={type=term, key=NN, layer=p, foundry=mate, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, foundry=mate, match=eq}}" +
"]}" +
"]}";
ppt = new PoliqarpPlusTree("{2: {1:[tt/p=ADJA]}[mate/p=NN]}");
@@ -461,25 +476,25 @@
@Test
public void testPositions() throws QueryException {
// contains(<s>,<np>)
- String pos1 = "{type=group, operation=position, frame=contains, operands=[" +
- "{type=span, key=s}," +
- "{type=span, key=np}" +
+ String pos1 = "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:span, key=np}" +
"]}";
assertTrue(equalsQueryContent(pos1, "contains(<s>,<np>)"));
// contains(<s>,[base=Mann])
- String pos2 = "{type=group, operation=position, frame=contains, operands=[" +
- "{type=span, key=s}," +
- "{type=token, key= {type=term, key=Mann, layer=lemma, match=eq}}" +
+ String pos2 = "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:token, wrap= {@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
"]}";
assertTrue(equalsQueryContent(pos2, "contains(<s>,[base=Mann])"));
// contains(<s>,[orth=der][orth=Mann])
- String pos3 = "{type=group, operation=position, frame=contains, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+ String pos3 = "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
"]}" +
"]}";
ppt = new PoliqarpPlusTree("contains(<s>,[orth=der][orth=Mann])");
@@ -488,11 +503,11 @@
// [base=Auto]contains(<s>,[base=Mann])
String pos4 =
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Auto, layer=lemma, match=eq}}," +
- "{type=group, operation=position, frame=contains, operands=[" +
- "{type=span, key=s}," +
- "{type=token, key={type=term, key=Mann, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Auto, layer=lemma, match=eq}}," +
+ "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=lemma, match=eq}}" +
"]}" +
"]}";
ppt = new PoliqarpPlusTree("[base=Auto]contains(<s>,[base=Mann])");
@@ -504,11 +519,11 @@
public void testNestedPositions() throws QueryException {
// contains(<s>,startswith(<np>,[orth=Der]))
String npos1 =
- "{type=group, operation=position, frame=contains, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=position, frame=startswith, operands=[" +
- "{type=span, key=np}," +
- "{type=token, key={type=term, key=Der, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:position, frame=frame:contains, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+ "{@type=korap:span, key=np}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}" +
"]}" +
"]}";
ppt = new PoliqarpPlusTree("contains(<s>, startswith(<np>,[orth=Der]))");
@@ -520,11 +535,11 @@
public void testShrinkSplit() throws QueryException {
// shrink([orth=Der]{[orth=Mann]})
String shr1 =
- "{type=group, operation=submatch, classRef=[0], operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Der, layer=orth, match=eq}}," +
- "{type=group, operation=class, class=0, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:submatch, classRef=[0], operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}," +
+ "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}";
@@ -534,13 +549,13 @@
// shrink([orth=Der]{[orth=Mann][orth=geht]})
String shr2 =
- "{type=group, operation=submatch, classRef=[0], operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Der, layer=orth, match=eq}}," +
- "{type=group, operation=class, class=0, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=geht, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:submatch, classRef=[0], operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}," +
+ "{@type=korap:group, operation=operation:class, class=0, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=geht, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}" +
@@ -551,13 +566,13 @@
// shrink(1:[orth=Der]{1:[orth=Mann][orth=geht]})
String shr3 =
- "{type=group, operation=submatch, classRef=[1], operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Der, layer=orth, match=eq}}," +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=geht, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}," +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=geht, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}" +
@@ -568,11 +583,11 @@
// shrink(1:startswith(<s>,{1:<np>}))
String shr4 =
- "{type=group, operation=submatch, classRef=[1], operands=[" +
- "{type=group, operation=position, frame=startswith, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=span, key=np}" +
+ "{@type=korap:group, operation=operation:submatch, classRef=[1], operands=[" +
+ "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:span, key=np}" +
"]}" +
"]}" +
"]}";
@@ -582,17 +597,17 @@
// shrink(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}}))
String shr5 =
- "{type=group, operation=submatch, classRef=[3], operands=[" +
- "{type=group, operation=position, frame=startswith, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=class, class=3, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
- "{type=group, operation=class, class=2, operands=[" +
- "{type=token, key={type=term, key=NN, layer=p, foundry=tt, match=eq}}" +
+ "{@type=korap:group, operation=operation:submatch, classRef=[3], operands=[" +
+ "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:class, class=3, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
+ "{@type=korap:group, operation=operation:class, class=2, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, foundry=tt, match=eq}}" +
"]}" +
"]}" +
"]}" +
@@ -606,17 +621,17 @@
// split(3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}}))
String shr6 =
- "{type=group, operation=split, classRef=[3], operands=[" +
- "{type=group, operation=position, frame=startswith, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=class, class=3, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
- "{type=group, operation=class, class=2, operands=[" +
- "{type=token, key={type=term, key=NN, layer=p, foundry=tt, match=eq}}" +
+ "{@type=korap:group, operation=operation:split, classRef=[3], operands=[" +
+ "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:class, class=3, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
+ "{@type=korap:group, operation=operation:class, class=2, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, foundry=tt, match=eq}}" +
"]}" +
"]}" +
"]}" +
@@ -630,17 +645,17 @@
// split(2|3: startswith(<s>, {3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}}))
String shr7 =
- "{type=group, operation=split, classRef=[2, 3], classRefOp=intersection, operands=[" +
- "{type=group, operation=position, frame=startswith, operands=[" +
- "{type=span, key=s}," +
- "{type=group, operation=class, class=3, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=lemma, match=eq}}," +
- "{type=group, operation=class, class=1, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
- "{type=group, operation=class, class=2, operands=[" +
- "{type=token, key={type=term, key=NN, layer=p, foundry=tt, match=eq}}" +
+ "{@type=korap:group, operation=operation:split, classRef=[2, 3], classRefOp=classRefOp:intersection, operands=[" +
+ "{@type=korap:group, operation=operation:position, frame=frame:startswith, operands=[" +
+ "{@type=korap:span, key=s}," +
+ "{@type=korap:group, operation=operation:class, class=3, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=lemma, match=eq}}," +
+ "{@type=korap:group, operation=operation:class, class=1, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=ADJA, layer=p, foundry=mate, match=eq}}," +
+ "{@type=korap:group, operation=operation:class, class=2, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=NN, layer=p, foundry=tt, match=eq}}" +
"]}" +
"]}" +
"]}" +
@@ -657,7 +672,7 @@
@Test
public void testFoundries() throws QueryException {
// [tt/base=Mann]
- String layer1 = "{type=token, key={type=term, key=Mann, layer=base, foundry=tt, match=eq}}";
+ String layer1 = "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=base, foundry=tt, match=eq}}";
ppt = new PoliqarpPlusTree("[tt/base=Mann]");
map = ppt.getRequestMap().get("query").toString();
assertEquals(layer1.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -668,10 +683,10 @@
public void testAlign() throws QueryException {
// [orth=der]^[orth=Mann]
String align1 =
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=group, alignment=left, operands=[" +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:group, alignment=left, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
"]}" +
"]}";
ppt = new PoliqarpPlusTree("[orth=der]^[orth=Mann]");
@@ -681,12 +696,12 @@
// [orth=der]^[orth=große][orth=Mann]
String query = "[orth=der]^[orth=große][orth=Mann]";
String align1b =
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=der, layer=orth, match=eq}}," +
- "{type=group, alignment=left, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=große, layer=orth, match=eq}}," +
- "{type=token, key={type=term, key=Mann, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=eq}}," +
+ "{@type=korap:group, alignment=left, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=große, layer=orth, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=eq}}" +
"]}" +
"]}" +
"]}";
@@ -696,14 +711,14 @@
// "([base=a]^[base=b])|[base=c]",
String align2 =
- "{type=group, operation=or, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=a, layer=lemma, match=eq}}," +
- "{type=group, alignment=left, operands=[" +
- "{type=token, key={type=term, key=b, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=a, layer=lemma, match=eq}}," +
+ "{@type=korap:group, alignment=left, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=b, layer=lemma, match=eq}}" +
"]}" +
"]}," +
- "{type=token, key={type=term, key=c, layer=lemma, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=c, layer=lemma, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("([base=a]^[base=b])|[base=c]");
map = ppt.getRequestMap().get("query").toString();
@@ -711,17 +726,17 @@
// "([base=a]^[base=b][base=c])|[base=d]",
String align3 =
- "{type=group, operation=or, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=a, layer=lemma, match=eq}}," +
- "{type=group, alignment=left, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=b, layer=lemma, match=eq}}," +
- "{type=token, key={type=term, key=c, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=a, layer=lemma, match=eq}}," +
+ "{@type=korap:group, alignment=left, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=b, layer=lemma, match=eq}}," +
+ "{@type=korap:token, wrap={@type=korap:term, key=c, layer=lemma, match=eq}}" +
"]}" +
"]}" +
"]}," +
- "{type=token, key={type=term, key=d, layer=lemma, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=d, layer=lemma, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("([base=a]^[base=b][base=c])|[base=d]");
map = ppt.getRequestMap().get("query").toString();
@@ -729,19 +744,19 @@
// "([base=a]^[base=b]^[base=c])|[base=d]",
String align4 =
- "{type=group, operation=or, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=a, layer=lemma, match=eq}}," +
- "{type=group, alignment=left, operands=[" +
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=b, layer=lemma, match=eq}}," +
- "{type=group, alignment=left, operands=[" +
- "{type=token, key={type=term, key=c, layer=lemma, match=eq}}" +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=a, layer=lemma, match=eq}}," +
+ "{@type=korap:group, alignment=left, operands=[" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=b, layer=lemma, match=eq}}," +
+ "{@type=korap:group, alignment=left, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=c, layer=lemma, match=eq}}" +
"]}" +
"]}" +
"]}" +
"]}," +
- "{type=token, key={type=term, key=d, layer=lemma, match=eq}}" +
+ "{@type=korap:token, wrap={@type=korap:term, key=d, layer=lemma, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("([base=a]^[base=b]^[base=c])|[base=d]");
map = ppt.getRequestMap().get("query").toString();
@@ -754,16 +769,16 @@
public void testSimpleQueries() throws QueryException {
// Baum
String simple1 =
- "{type=token, key={type=term, key=Baum, layer=orth, match=eq}}";
+ "{@type=korap:token, wrap={@type=korap:term, key=Baum, layer=orth, match=eq}}";
ppt = new PoliqarpPlusTree("Baum");
map = ppt.getRequestMap().get("query").toString();
assertEquals(simple1.replaceAll(" ", ""), map.replaceAll(" ", ""));
// Der Baum
String simple2 =
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Der, layer=orth, match=eq}}, " +
- "{type=token, key={type=term, key=Baum, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}, " +
+ "{@type=korap:token, wrap={@type=korap:term, key=Baum, layer=orth, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("Der Baum");
map = ppt.getRequestMap().get("query").toString();
@@ -771,10 +786,10 @@
// Der große Baum
String simple3 =
- "{type=group, operation=sequence, operands=[" +
- "{type=token, key={type=term, key=Der, layer=orth, match=eq}}, " +
- "{type=token, key={type=term, key=große, layer=orth, match=eq}}, " +
- "{type=token, key={type=term, key=Baum, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=eq}}, " +
+ "{@type=korap:token, wrap={@type=korap:term, key=große, layer=orth, match=eq}}, " +
+ "{@type=korap:token, wrap={@type=korap:term, key=Baum, layer=orth, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("Der große Baum");
map = ppt.getRequestMap().get("query").toString();
@@ -782,9 +797,9 @@
// Baum | Stein
String simple4 =
- "{type=group, operation=or, operands=[" +
- "{type=token, key={type=term, key=Baum, layer=orth, match=eq}}, " +
- "{type=token, key={type=term, key=Stein, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Baum, layer=orth, match=eq}}, " +
+ "{@type=korap:token, wrap={@type=korap:term, key=Stein, layer=orth, match=eq}}" +
"]}";
ppt = new PoliqarpPlusTree("Baum | Stein");
map = ppt.getRequestMap().get("query").toString();
@@ -793,12 +808,12 @@
// Baum | Stein Haus
String query = "(Baum | Stein) Haus";
String simple5 =
- "{type=group, operation=sequence, operands=[" +
- "{type=group, operation=or, operands=[" +
- "{type=token, key={type=term, key=Baum, layer=orth, match=eq}}, " +
- "{type=token, key={type=term, key=Stein, layer=orth, match=eq}}" +
+ "{@type=korap:group, operation=operation:sequence, operands=[" +
+ "{@type=korap:group, operation=operation:or, operands=[" +
+ "{@type=korap:token, wrap={@type=korap:term, key=Baum, layer=orth, match=eq}}, " +
+ "{@type=korap:token, wrap={@type=korap:term, key=Stein, layer=orth, match=eq}}" +
"]}," +
- "{type=token, key={type=term, key=Haus, layer=orth, match=eq}} " +
+ "{@type=korap:token, wrap={@type=korap:term, key=Haus, layer=orth, match=eq}} " +
"]}";
ppt = new PoliqarpPlusTree(query);
map = ppt.getRequestMap().get("query").toString();