@@ -166,7 +166,7 @@ private Attribute buildRegexAttribute(String key, String value, boolean negated,
166
166
}
167
167
}
168
168
169
- private boolean checkMatch (Attribute attr , boolean ignoreCase , String nodeValue ) {
169
+ private boolean checkMatch (Attribute attr , boolean ignoreCase , String nodeValue , VariableStrings tempVariableStrings ) {
170
170
if (nodeValue == null ) {
171
171
// treat non-existent attributes has having matched a negated expression
172
172
// so for example, `cpos!:NUM` matches not having a cpos at all
@@ -185,7 +185,13 @@ private boolean checkMatch(Attribute attr, boolean ignoreCase, String nodeValue)
185
185
matches = nodeValue .equals (toMatch .toString ());
186
186
}
187
187
} else if (toMatch instanceof Pattern ) {
188
- matches = ((Pattern ) toMatch ).matcher (nodeValue ).matches ();
188
+ Matcher matcher = ((Pattern ) toMatch ).matcher (nodeValue );
189
+ if (matcher .matches ()) {
190
+ matches = true ;
191
+ // TODO: check the VariableStrings here
192
+ } else {
193
+ matches = false ;
194
+ }
189
195
} else {
190
196
throw new IllegalStateException ("Unknown matcher type: " + toMatch + " (of class + " + toMatch .getClass () + ")" );
191
197
}
@@ -196,7 +202,8 @@ private boolean checkMatch(Attribute attr, boolean ignoreCase, String nodeValue)
196
202
}
197
203
198
204
@ SuppressWarnings ("unchecked" )
199
- public boolean nodeAttrMatch (IndexedWord node , final SemanticGraph sg , boolean ignoreCase ) {
205
+ public boolean nodeAttrMatch (IndexedWord node , final SemanticGraph sg , boolean ignoreCase ,
206
+ VariableStrings tempVariableStrings ) {
200
207
// System.out.println(node.word());
201
208
if (isRoot ) {
202
209
// System.out.println("checking root");
@@ -230,8 +237,7 @@ public boolean nodeAttrMatch(IndexedWord node, final SemanticGraph sg, boolean i
230
237
// }
231
238
// System.out.println(nodeValue);
232
239
233
- // TODO: check varGroups here
234
- boolean matches = checkMatch (attr , ignoreCase , nodeValue );
240
+ boolean matches = checkMatch (attr , ignoreCase , nodeValue , tempVariableStrings );
235
241
236
242
if (!matches ) {
237
243
// System.out.println("doesn't match");
@@ -258,7 +264,8 @@ public boolean nodeAttrMatch(IndexedWord node, final SemanticGraph sg, boolean i
258
264
nodeValue = (value == null ) ? null : value .toString ();
259
265
}
260
266
261
- boolean matches = checkMatch (attr , ignoreCase , nodeValue );
267
+ // TODO: not connected to varGroups yet
268
+ boolean matches = checkMatch (attr , ignoreCase , nodeValue , tempVariableStrings );
262
269
if (!matches ) {
263
270
return negDesc ;
264
271
}
@@ -274,6 +281,7 @@ public boolean nodeAttrMatch(IndexedWord node, final SemanticGraph sg, boolean i
274
281
throw new RuntimeException ("Can only use partial attributes with Maps... this should have been checked at creation time!" );
275
282
map = (Map ) rawmap ;
276
283
}
284
+ // TODO: check varGroups here
277
285
boolean matches = partialAttribute .checkMatches (map , ignoreCase );
278
286
if (!matches ) {
279
287
return negDesc ;
@@ -509,10 +517,9 @@ private void goToNextNodeMatch() {
509
517
}
510
518
}
511
519
} else {
512
- // TODO: pass in all varstrings and local varstrings
513
520
boolean found = myNode .nodeAttrMatch (nextMatch ,
514
521
hyp ? sg : sg_aligned ,
515
- ignoreCase );
522
+ ignoreCase , tempVariableStrings );
516
523
if (found ) {
517
524
// nodeAttrMatch already checks negDesc, so no need to
518
525
// check for that here
@@ -521,10 +528,9 @@ private void goToNextNodeMatch() {
521
528
}
522
529
}
523
530
} else { // try to match the description pattern.
524
- // TODO: pass in all varstrings and local varstrings
525
531
boolean found = myNode .nodeAttrMatch (nextMatch ,
526
532
hyp ? sg : sg_aligned ,
527
- ignoreCase );
533
+ ignoreCase , tempVariableStrings );
528
534
if (found ) {
529
535
// nodeAttrMatch already checks negDesc, so no need to
530
536
// check for that here
@@ -556,9 +562,6 @@ private void goToNextNodeMatch() {
556
562
edgeNamedFirst = true ;
557
563
namesToEdges .put (myNode .reln .getEdgeName (), nextMatchEdge );
558
564
}
559
- // TODO FIXME: this would need to read all of the matchers used
560
- // (eg, from the various attributes)
561
- // and commit all of them
562
565
commitVariableGroups (tempVariableStrings ); // commit my variable groups.
563
566
}
564
567
// finished is false exiting this if and only if nextChild exists
0 commit comments