deprecation path for 'frame'
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java
index 02fa6f0..2de2d18 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java
@@ -151,6 +151,40 @@
group.put("frames", Arrays.asList(allowedFrames));
group.put("sharedClasses", Arrays.asList(sharedClasses));
group.put("operands", new ArrayList<Object>());
+ // DEPRECATED 'frame'
+ String frame = "";
+ if (allowedFrames.length==0 && sharedClasses[0]=="includes") {
+ frame = "contains";
+ } else if (allowedFrames.length==0 && sharedClasses[0]=="intersects") {
+ frame = "overlaps";
+ } else if (allowedFrames[0]=="startswith" && sharedClasses[0]=="includes") {
+ frame = "startswith";
+ } else if (allowedFrames[0]=="endswith" && sharedClasses[0]=="includes") {
+ frame = "endswith";
+ } else if (allowedFrames[0]=="matches" && sharedClasses[0]=="includes" && sharedClasses.length==1) {
+ frame = "endswith";
+ } else if (allowedFrames[0]=="matches" && sharedClasses[0]=="includes" && sharedClasses[1]=="unequals") {
+ frame = "matches";
+ } else if (allowedFrames[0]=="matches" && sharedClasses[0]=="equals") {
+ frame = "matches";
+ } else if (allowedFrames[0]=="contains" && sharedClasses[0]=="includes") {
+ frame = "contains";
+ } else if (allowedFrames[0]=="startswith" && sharedClasses[0]=="intersects") {
+ frame = "overlapsLeft";
+ } else if (allowedFrames[0]=="endswith" && sharedClasses[0]=="intersects") {
+ frame = "overlapsRight";
+ } else if (allowedFrames[0]=="matches" && sharedClasses[0]=="intersects") {
+ frame = "matches";
+ } else if (allowedFrames[0]=="matches" && sharedClasses[0]=="unequals") {
+ frame = "matches";
+ } else if (allowedFrames[0]=="matches" && sharedClasses[0]=="equals") {
+ frame = "matches";
+ } else if (allowedFrames[0]=="contains" && sharedClasses[0]=="intersects") {
+ frame = "contains";
+ }
+ group.put("frame", frame);
+ announcements.add("Deprecated 2014-09-22: 'frame' only to be supported until 3 months from deprecation date. " +
+ "Position frames are now expressed through 'frames' and 'sharedClasses'");
return group;
}
@@ -255,6 +289,22 @@
return classGroup;
}
+ /**
+ * Ensures that a distance or quantification value does not exceed the allowed maximum value.
+ * @param number
+ * @return The input number if it is below the allowed maximum value, else the maximum value.
+ */
+ protected int cropToMaxValue(int number) {
+ if (number > MAXIMUM_DISTANCE) {
+ number = MAXIMUM_DISTANCE;
+ String warning = String.format("You specified a distance between two segments that is greater than " +
+ "the allowed max value of %d. Your query will be re-interpreted using a distance of %d.", MAXIMUM_DISTANCE, MAXIMUM_DISTANCE);
+ warnings.add(warning);
+ log.warn("User warning: "+warning);
+ }
+ return number;
+ }
+
/**
* Returns the category (or 'label') of the root of a (sub-) ParseTree (ANTLR 3).
*
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
index 0a940de..22cfac2 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
@@ -698,19 +698,20 @@
* For testing
*/
String[] queries = new String[] {
- "cat=\"NP\" & cat=\"VP\" & #1 $ #2 ",
- "Haus",
- "lemma=\"Haus\"",
- "Katze=\"Hund\"",
- "cnx/c=\"NP\"",
- "cat=\"NP\"",
- "node & node & #1 .+ #2",
- " #1 > #2 & cnx/cat=\"VP\" & cnx/cat=\"NP\"",
- "\"Mann\" & node & #2 >[cat=\"NP\"] #1",
- "node & node & #2 ->coref[val=\"true\"] #1",
- "cat=\"NP\" & cat=\"VP\" & cat=\"PP\" & #1 $ #2 > #3",
- "tok=\"Mann\" & tok=\"geht\" & #1 .* #2",
- "\"Sonne\""
+// "cat=\"NP\" & cat=\"VP\" & #1 $ #2 ",
+// "Haus",
+// "lemma=\"Haus\"",
+// "Katze=\"Hund\"",
+// "cnx/c=\"NP\"",
+// "cat=\"NP\"",
+// "node & node & #1 .+ #2",
+// " #1 > #2 & cnx/cat=\"VP\" & cnx/cat=\"NP\"",
+// "\"Mann\" & node & #2 >[cat=\"NP\"] #1",
+// "node & node & #2 ->coref[val=\"true\"] #1",
+// "cat=\"NP\" & cat=\"VP\" & cat=\"PP\" & #1 $ #2 > #3",
+// "tok=\"Mann\" & tok=\"geht\" & #1 .* #2",
+// "\"Sonne\"",
+ "\"so\" & \"nicht\" & #1 .1,6 #2"
};
// AqlTree.verbose=true;
for (String q : queries) {
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 2e8c44d..702f007 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
@@ -51,9 +51,12 @@
*/
int classCounter = 1;
boolean negate = false;
-// int wrapFirstOpInClass = -1;
-// int wrapSecondOpInClass = -1;
-
+
+ /**
+ * Allows for the definition of objects to be wrapped around the arguments of an operation.
+ * Each record in the table holds the parent node of the argument, the number of the argument
+ * and an object in whose operands list the argument shall be wrapped.
+ */
Table<Tree,Integer,LinkedHashMap<String,Object>> operandWrap = HashBasedTable.create();
/**
@@ -685,19 +688,33 @@
openNodeCats.pop();
}
+ private void processSpanDistance(String meas, int min, int max) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * Registers an entry in the {@link #operandWrap} table in order to allow an operator's arguments
+ * (or only one of them) to be wrapped in a class group.
+ * @param node The operator node (parent node of the ARG1/ARG2 node)
+ * @param arg The argument number (1 or 2)
+ * @param cls The class id.
+ */
private void wrapOperandInClass(Tree node, int arg, int cls) {
LinkedHashMap<String,Object> clsGroup = makeSpanClass(cls);
wrapOperand(node,arg,clsGroup);
}
+ /**
+ * Registers an entry in the {@link #operandWrap} table in order to allow an operator's arguments
+ * (or only one of them) to be wrapped in an arbitrary object, e.g. a reference group.
+ * @param node The operator node (parent node of the ARG1/ARG2 node)
+ * @param arg The argument number (1 or 2)
+ * @param container The object in whose operand list the argument shall be wrapped.
+ */
private void wrapOperand(Tree node, int arg, LinkedHashMap<String, Object> container) {
operandWrap.put(node, arg, container);
}
-
- private void processSpanDistance(String meas, int parseInt, int parseInt2) {
- // TODO Auto-generated method stub
-
- }
private Object translateMorph(String layer) {
// todo: not very nicely solved! Does this require extension somehow? if not, why not use simple string comparison?!
@@ -769,8 +786,7 @@
if (rangenode != null) {
String range = rangenode.getChild(0).toStringTree().toLowerCase();
if (range.equals("all")) {
-// wrapOperandInClass(node,2,classCounter);
- LinkedHashMap<String,Object> ref = makeResetReference();
+ LinkedHashMap<String,Object> ref = makeResetReference(); // reset all defined classes
wrapOperand(node,2,ref);
}
}
@@ -1039,11 +1055,11 @@
// "Sonne /+w4 Mond",
// "#BED(der Mann , sa,-pa)",
// "Sonne /+w1:4 Mond /-w1:7 Sterne",
- "wegen #IN('FE,ALL,%,MIN') <s>",
- "#NHIT(gehen /w1:10 voran)"
-
+// "wegen #IN('FE,ALL,%,MIN') <s>",
+// "#NHIT(gehen /w1:10 voran)"
+// "MORPH(V PRES IND)",
// "wegen #OV(F) <s>"
-
+ "Sonne /s0 Mond"
};
CosmasTree.verbose=true;
for (String q : queries) {
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 c29a69d..5d84526 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
@@ -32,7 +32,7 @@
*/
public PoliqarpPlusTree(String query) throws QueryException {
process(query);
- System.out.println(">>> " + requestMap.get("query") + " <<<");
+ System.out.println(">>> " + requestMap + " <<<");
log.info(">>> " + requestMap.get("query") + " <<<");
}
@@ -90,7 +90,8 @@
quantGroup.put("boundary", makeBoundary(minmax[0], minmax[1]));
if (minmax[0] != null) quantGroup.put("min", minmax[0]);
if (minmax[1] != null) quantGroup.put("max", minmax[1]);
- announcements.add("Deprecated 2014-07-24: 'min' and 'max' to be supported until 3 months from deprecation date.");
+ announcements.add("Deprecated 2014-07-24: 'min' and 'max' to be " +
+ "supported until 3 months from deprecation date.");
putIntoSuperObject(quantGroup);
objectStack.push(quantGroup);
stackedObjects++;
@@ -107,16 +108,20 @@
ArrayList<Object> distances = new ArrayList<Object>();
distances.add(distance);
sequence.put("distances", distances);
- visited.add(distanceNode.getChild(0));
+ visited.add(distanceNode.getChild(0)); // don't re-visit the emptyTokenSequence node
}
putIntoSuperObject(sequence);
objectStack.push(sequence);
stackedObjects++;
}
+ /*
+ * empty tokens at beginning/end of sequence
+ */
if (nodeCat.equals("emptyTokenSequence")) {
Integer[] minmax = parseEmptySegments(node);
- LinkedHashMap<String,Object> object;
+ // object will be either a repetition group or a single empty token
+ LinkedHashMap<String,Object> object;
LinkedHashMap<String,Object> emptyToken = makeToken();
if (minmax[0] != 1 || minmax[1] == null || minmax[1] != 1) {
object = makeRepetition(minmax[0], minmax[1]);
@@ -153,7 +158,8 @@
term.put("match", "match:"+matches);
ParseTree flagNode = getFirstChildWithCat(node, "flag");
if (flagNode != null) {
- String flag = getNodeCat(flagNode.getChild(0)).substring(1); //substring removes leading slash '/'
+ // substring removes leading slash '/'
+ String flag = getNodeCat(flagNode.getChild(0)).substring(1);
if (flag.contains("i")) term.put("caseInsensitive", true);
else if (flag.contains("I")) term.put("caseInsensitive", false);
if (flag.contains("x")) {
@@ -167,7 +173,8 @@
token.put("wrap", term);
} else {
// child is 'term' or 'termGroup' -> process in extra method
- LinkedHashMap<String,Object> termOrTermGroup = parseTermOrTermGroup(node.getChild(1), negated);
+ LinkedHashMap<String,Object> termOrTermGroup =
+ parseTermOrTermGroup(node.getChild(1), negated);
token.put("wrap", termOrTermGroup);
}
putIntoSuperObject(token);
@@ -208,11 +215,13 @@
else if (termOp.equals("!=")) span.put("match", "match:ne");
}
if (termNode != null) {
- LinkedHashMap<String,Object> termOrTermGroup = parseTermOrTermGroup(termNode, negated, "span");
+ LinkedHashMap<String,Object> termOrTermGroup =
+ parseTermOrTermGroup(termNode, negated, "span");
span.put("attr", termOrTermGroup);
}
if (termGroupNode != null) {
- LinkedHashMap<String,Object> termOrTermGroup = parseTermOrTermGroup(termGroupNode, negated, "span");
+ LinkedHashMap<String,Object> termOrTermGroup =
+ parseTermOrTermGroup(termGroupNode, negated, "span");
span.put("attr", termOrTermGroup);
}
putIntoSuperObject(span);
@@ -268,8 +277,10 @@
try {
classId = Integer.parseInt(ref);
} catch (NumberFormatException e) {
- log.error("The specified class reference in the focus/split-Operator is not a number: " + ref);
- throw new QueryException("The specified class reference in the focus/split-Operator is not a number: " + ref);
+ String msg = "The specified class reference in the " +
+ "focus/split-Operator is not a number: " + ref;
+ log.error(msg);
+ throw new QueryException(msg);
}
// only allow class id up to 255
if (classId > 255) {
@@ -297,7 +308,8 @@
int classRef = Integer.parseInt(ref);
classRefs.add(classRef);
} catch (NumberFormatException e) {
- String err = "The specified class reference in the shrink/split-Operator is not a number.";
+ String err = "The specified class reference in the " +
+ "shrink/split-Operator is not a number.";
errorMsgs.add(err);
throw new QueryException(err);
}
@@ -312,8 +324,9 @@
// Default is focus(), if deviating catch here
if (type.equals("split")) referenceGroup.put("operation", "operation:split");
if (type.equals("submatch") || type.equals("shrink")) {
- String warning = "Deprecated 2014-07-24: "+type + "() as a match reducer to a specific class is deprecated in " +
- "favor of focus() and will only be supported for 3 months after deprecation date.";
+ String warning = "Deprecated 2014-07-24: "+type + "() as a match reducer " +
+ "to a specific class is deprecated in favor of focus() and will " +
+ "only be supported for 3 months after deprecation date.";
log.warn(warning);
requestMap.put("warning", warning);
}
@@ -355,7 +368,8 @@
if (nodeCat.equals("within") && !getNodeCat(node.getParent()).equals("position")) {
ParseTree domainNode = node.getChild(2);
String domain = getNodeCat(domainNode);
- LinkedHashMap<String, Object> curObject = (LinkedHashMap<String, Object>) objectStack.getFirst();
+ LinkedHashMap<String, Object> curObject =
+ (LinkedHashMap<String, Object>) objectStack.getFirst();
curObject.put("within", domain);
visited.add(node.getChild(0));
visited.add(node.getChild(1));
@@ -426,7 +440,7 @@
}
private LinkedHashMap<String,Object> parseFrame(ParseTree node) {
- String operator = node.toStringTree(parser);
+ String operator = node.toStringTree(parser).toLowerCase();
String[] frames = new String[]{""};
String[] sharedClasses = new String[]{"includes"};
switch (operator) {
@@ -615,21 +629,6 @@
return new Integer[]{min, max};
}
- /**
- * Ensures that a distance or quantification value does not exceed the allowed maximum value.
- * @param number
- * @return The input number if it is below the allowed maximum value, else the maximum value.
- */
- private int cropToMaxValue(int number) {
- if (number > MAXIMUM_DISTANCE) {
- number = MAXIMUM_DISTANCE;
- String warning = String.format("You specified a distance between two segments that is greater than " +
- "the allowed max value of %d. Your query will be re-interpreted using a distance of %d.", MAXIMUM_DISTANCE, MAXIMUM_DISTANCE);
- warnings.add(warning);
- log.warn("User warning: "+warning);
- }
- return number;
- }
private ParserRuleContext parsePoliqarpQuery(String p) throws QueryException {
checkUnbalancedPars(p);
@@ -665,50 +664,4 @@
// Return the generated tree
return tree;
}
-
- public static void main(String[] args) {
- /*
- * For testing
- */
- String[] queries = new String[]{
-// "[base=foo][base=foo]",
-// "Der \"Baum\"/x",
-// "contains(<vp>,[][base=foo])",
-// "[hallo=welt]*",
-// "schland/x",
-// "focus([orth=Der]{[orth=Mann]})",
-// "shrink([orth=Der]{[orth=Mann]})",
-// "[mate/m=number:sg]",
-// "z.B./x",
-// "\".*?Mann.\"",
-// "\".*?Mann.*?\"",
-// "[orth=\".*?l(au|ie)fen.*?*\"]",
-// "[orth=Mann][][orth=Mann]",
-// "startswith(<s>, [][base=Mann])",
-// "[base=der][]{1,102}[base=Mann]",
-// "[base=geht][base=der][]*[base=Mann]",
-// "<cnx/c=vp (class=header&id=7)>",
-// "<cnx/c=vp class=header&id=a>",
-// "[][]*[base=Mann]",
-// "focus(2&3|4:contains({2:<s>},[base=mann]))",
-// "relatesTo(cnx/c:<s>,<np>)",
-// "dominates(cnx/c*:<np>,[base=Baum])",
-// "submatch(2:<np>{2:<s>})",
-// "focus(3:{1:[orth=der]}{3:[]}{2:[orth=Mann]})",
- "[base=geht][base=der][]*contains(<s>,<np>)"
- };
-// PoliqarpPlusTree.verbose=true;
- for (String q : queries) {
- try {
- System.out.println(q);
- @SuppressWarnings("unused")
- PoliqarpPlusTree pt = new PoliqarpPlusTree(q);
- System.out.println();
-
- } catch (Exception npe) {
- npe.printStackTrace();
- System.out.println("null\n");
- }
- }
- }
}
diff --git a/src/test/java/CosmasTreeTest.java b/src/test/java/CosmasTreeTest.java
index eb6e2b8..7bd6d2c 100644
--- a/src/test/java/CosmasTreeTest.java
+++ b/src/test/java/CosmasTreeTest.java
@@ -285,7 +285,7 @@
"{@type=korap:group, operation=operation:class, class=0, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
"]}" +
- "]}," +
+ "], frame=overlaps}," +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, " +
"operands=[" +
@@ -316,7 +316,7 @@
"{@type=korap:group, operation=operation:class, class=0, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
"]}" +
- "]}," +
+ "], frame=overlaps}," +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, " +
"operands=[" +
@@ -347,7 +347,7 @@
"{@type=korap:group, operation=operation:class, class=0, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Mond, layer=orth, match=match:eq}}" +
"]}" +
- "]}," +
+ "], frame=overlaps}," +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, " +
"operands=[" +
@@ -441,7 +441,7 @@
String mondsterneClassesOv =
"{@type=korap:group, operation=operation:position, frames=[], sharedClasses=[intersects], operands=[" +
mondsterneClasses +
- "]}";
+ "], frame=overlaps}";
// String mondsterneAll =
// "{@type=korap:group, operation=operation:or, operands=[" +
// mondsterneOv + "," + mondsterneClassesSeq +
@@ -461,7 +461,7 @@
"{@type=korap:group, operation=operation:class, class=0, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Sonne, layer=orth, match=match:eq}}" +
"]}" +
- "]}," +
+ "], frame=overlaps}," +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, " +
"operands=[" +
@@ -734,7 +734,7 @@
"{@type=korap:group, operation=operation:class, class=0, operands=[" +
kommt +
"]}" +
- "]}," +
+ "], frame=overlaps}," +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:group, operation=operation:class, class=0, operands=[" +
@@ -763,7 +763,7 @@
"{@type=korap:group, operation=operation:class, class=0, operands=[" +
beg1+
"]}" +
- "]}," +
+ "], frame=overlaps}," +
"{@type=korap:reference, operation=operation:focus, classRef=[0], operands=[" +
"{@type=korap:group, operation=operation:sequence, operands=[" +
"{@type=korap:group, operation=operation:class, class=0, operands=[" +
@@ -1026,7 +1026,7 @@
"{@type=korap:group, operation=operation:class, class=1, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=der, layer=orth, match=match:eq}}" +
"]}" +
- "]}" +
+ "], frame=startswith}" +
"]}";
ct = new CosmasTree(query);
map = ct.getRequestMap().get("query").toString();
@@ -1043,7 +1043,7 @@
"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
"]}" +
"]}" +
- "]}" +
+ "], frame=endswith}" +
"]}";
ct = new CosmasTree(query);
map = ct.getRequestMap().get("query").toString();
@@ -1061,7 +1061,7 @@
"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
"]}" +
"]}" +
- "]}," +
+ "], frame=startswith}," +
"{@type=korap:group, operation=operation:position, frames=[startswith], sharedClasses=[includes], operands=[" +
"{@type=korap:span, key=p}," +
"{@type=korap:group, operation=operation:class, class=2, operands=[" +
@@ -1070,7 +1070,7 @@
"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
"]}" +
"]}" +
- "], exclude=true}" +
+ "], frame=startswith, exclude=true}" +
"], distances=[" +
"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0}" +
"]}" +
@@ -1091,7 +1091,7 @@
"{@type=korap:group, operation=operation:class, class=1, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Der, layer=orth, match=match:eq}}" +
"]}" +
- "]}" +
+ "], frame=startswith}" +
"]}";
ct = new CosmasTree(query);
map = ct.getRequestMap().get("query").toString();
@@ -1106,19 +1106,19 @@
"{@type=korap:group, operation=operation:class, class=1, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
"]}" +
- "]}," +
+ "], frame=startswith}," +
"{@type=korap:group, operation=operation:position, frames=[startswith], sharedClasses=[includes], operands=[" +
"{@type=korap:span, key=p}," +
"{@type=korap:group, operation=operation:class, class=2, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
"]}" +
- "], exclude=true}," +
+ "], frame=startswith, exclude=true}," +
"{@type=korap:group, operation=operation:position, frames=[endswith], sharedClasses=[includes], operands=[" +
"{@type=korap:span, key=t}," +
"{@type=korap:group, operation=operation:class, class=3, operands=[" +
"{@type=korap:token, wrap={@type=korap:term, key=Mann, layer=orth, match=match:eq}}" +
- "]}" +
- "]}" +
+ "]}" +
+ "], frame=endswith}" +
"], distances=[" +
"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=0, max=0}, min=0, max=0}" +
"]}" +
diff --git a/src/test/java/PoliqarpPlusTreeTest.java b/src/test/java/PoliqarpPlusTreeTest.java
index 6cbd2a2..4cac667 100644
--- a/src/test/java/PoliqarpPlusTreeTest.java
+++ b/src/test/java/PoliqarpPlusTreeTest.java
@@ -389,7 +389,7 @@
"{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[includes], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:span, key=np}" +
- "]}" +
+ "], frame=contains}" +
"], inOrder=true, distances=[" +
"{@type=korap:distance, key=w, boundary={@type=korap:boundary, min=1}, min=1}" +
"]}" +
@@ -409,7 +409,7 @@
"{@type=korap:token}," +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" +
"]}" +
- "]}";
+ "], frame=startswith}";
ppt = new PoliqarpPlusTree("startswith(<s>, [][base=Mann])");
map = ppt.getRequestMap().get("query").toString();
assertEquals(et1.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -472,7 +472,7 @@
"{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[includes], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:span, key=np}" +
- "]}," +
+ "], frame=contains}," +
"{@type=korap:group, operation=operation:repetition, operands=[" +
"{@type=korap:token}" +
"], boundary={@type=korap:boundary, min=2, max=2}, min=2, max=2}" +
@@ -912,14 +912,14 @@
String pos1 = "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[includes], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:span, key=np}" +
- "]}";
+ "], frame=contains}";
assertTrue(equalsQueryContent(pos1, "contains(<s>,<np>)"));
// contains(<s>,[base=Mann])
String pos2 = "{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[includes], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:token, wrap= {@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" +
- "]}";
+ "], frame=contains}";
assertTrue(equalsQueryContent(pos2, "contains(<s>,[base=Mann])"));
// contains(<s>,[orth=der][orth=Mann])
@@ -929,7 +929,7 @@
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=der, match=match:eq}}," +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Mann, match=match:eq}}" +
"]}" +
- "]}";
+ "], frame=contains}";
ppt = new PoliqarpPlusTree("contains(<s>,[orth=der][orth=Mann])");
map = ppt.getRequestMap().get("query").toString();
assertEquals(pos3.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -941,7 +941,7 @@
"{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[includes], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:token, wrap={@type=korap:term, layer=lemma, key=Mann, match=match:eq}}" +
- "]}" +
+ "], frame=contains}" +
"]}";
ppt = new PoliqarpPlusTree("[base=Auto]contains(<s>,[base=Mann])");
map = ppt.getRequestMap().get("query").toString();
@@ -955,7 +955,7 @@
"operands=[{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}" +
"], boundary={@type=korap:boundary, min=0}, min=0" +
"}" +
- "]}";
+ "], frame=contains}";
ppt = new PoliqarpPlusTree("contains(<s>,[pos=N]*)");
map = ppt.getRequestMap().get("query").toString();
assertEquals(pos5.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -970,7 +970,7 @@
"operands=[{@type=korap:token, wrap={@type=korap:term, layer=pos, key=N, match=match:eq}}" +
"], boundary={@type=korap:boundary, min=0}, min=0" +
"}" +
- "]}" +
+ "], frame=contains}" +
"]}";
ppt = new PoliqarpPlusTree("[base=Auto]contains(<s>,[pos=N]*)");
map = ppt.getRequestMap().get("query").toString();
@@ -986,8 +986,8 @@
"{@type=korap:group, operation=operation:position, frames=[startswith],sharedClasses=[includes], operands=[" +
"{@type=korap:span, key=np}," +
"{@type=korap:token, wrap={@type=korap:term, layer=orth, key=Der, match=match:eq}}" +
- "]}" +
- "]}";
+ "], frame=startswith}" +
+ "], frame=contains}";
ppt = new PoliqarpPlusTree("contains(<s>, startswith(<np>,[orth=Der]))");
map = ppt.getRequestMap().get("query").toString();
assertEquals(npos1.replaceAll(" ", ""), map.replaceAll(" ", ""));
@@ -1051,7 +1051,7 @@
"{@type=korap:group, operation=operation:class, class=1, operands=[" +
"{@type=korap:span, key=np}" +
"]}" +
- "]}" +
+ "], frame=startswith}" +
"]}";
ppt = new PoliqarpPlusTree("focus(1:startswith(<s>,{1:<np>}))");
map = ppt.getRequestMap().get("query").toString();
@@ -1075,7 +1075,7 @@
"]}" +
"]}" +
"]}" +
- "]}" +
+ "], frame=startswith}" +
"]}";
ppt = new PoliqarpPlusTree("focus(3:startswith(<s>,{3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) ");
map = ppt.getRequestMap().get("query").toString();
@@ -1099,7 +1099,7 @@
"]}" +
"]}" +
"]}" +
- "]}" +
+ "], frame=startswith}" +
"]}";
ppt = new PoliqarpPlusTree("split(3:startswith(<s>,{3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) ");
map = ppt.getRequestMap().get("query").toString();
@@ -1123,7 +1123,7 @@
"]}" +
"]}" +
"]}" +
- "]}" +
+ "], frame=startswith}" +
"]}";
ppt = new PoliqarpPlusTree("split(2|3:startswith(<s>,{3:[base=der]{1:[mate/p=ADJA]{2:[tt/p=NN]}}})) ");
map = ppt.getRequestMap().get("query").toString();
@@ -1175,7 +1175,7 @@
"{@type=korap:group, operation=operation:position, frames=[],sharedClasses=[includes], operands=[" +
"{@type=korap:span, key=s}," +
"{@type=korap:token, wrap= {@type=korap:term, layer=lemma, key=Haus, match=match:eq}}" +
- "]}" +
+ "], frame=contains}" +
"], spanRef=[1,4]" +
"}";
ppt = new PoliqarpPlusTree(query);