@@ -166,7 +166,7 @@ private Attribute buildRegexAttribute(String key, String value, boolean negated,
166166 }
167167 }
168168
169- private boolean checkMatch (Attribute attr , boolean ignoreCase , String nodeValue ) {
169+ private boolean checkMatch (Attribute attr , boolean ignoreCase , String nodeValue , VariableStrings tempVariableStrings ) {
170170 if (nodeValue == null ) {
171171 // treat non-existent attributes has having matched a negated expression
172172 // 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)
185185 matches = nodeValue .equals (toMatch .toString ());
186186 }
187187 } 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+ }
189195 } else {
190196 throw new IllegalStateException ("Unknown matcher type: " + toMatch + " (of class + " + toMatch .getClass () + ")" );
191197 }
@@ -196,7 +202,8 @@ private boolean checkMatch(Attribute attr, boolean ignoreCase, String nodeValue)
196202 }
197203
198204 @ 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 ) {
200207 // System.out.println(node.word());
201208 if (isRoot ) {
202209 // System.out.println("checking root");
@@ -230,8 +237,7 @@ public boolean nodeAttrMatch(IndexedWord node, final SemanticGraph sg, boolean i
230237 // }
231238 // System.out.println(nodeValue);
232239
233- // TODO: check varGroups here
234- boolean matches = checkMatch (attr , ignoreCase , nodeValue );
240+ boolean matches = checkMatch (attr , ignoreCase , nodeValue , tempVariableStrings );
235241
236242 if (!matches ) {
237243 // System.out.println("doesn't match");
@@ -258,7 +264,8 @@ public boolean nodeAttrMatch(IndexedWord node, final SemanticGraph sg, boolean i
258264 nodeValue = (value == null ) ? null : value .toString ();
259265 }
260266
261- boolean matches = checkMatch (attr , ignoreCase , nodeValue );
267+ // TODO: not connected to varGroups yet
268+ boolean matches = checkMatch (attr , ignoreCase , nodeValue , tempVariableStrings );
262269 if (!matches ) {
263270 return negDesc ;
264271 }
@@ -274,6 +281,7 @@ public boolean nodeAttrMatch(IndexedWord node, final SemanticGraph sg, boolean i
274281 throw new RuntimeException ("Can only use partial attributes with Maps... this should have been checked at creation time!" );
275282 map = (Map ) rawmap ;
276283 }
284+ // TODO: check varGroups here
277285 boolean matches = partialAttribute .checkMatches (map , ignoreCase );
278286 if (!matches ) {
279287 return negDesc ;
@@ -509,10 +517,9 @@ private void goToNextNodeMatch() {
509517 }
510518 }
511519 } else {
512- // TODO: pass in all varstrings and local varstrings
513520 boolean found = myNode .nodeAttrMatch (nextMatch ,
514521 hyp ? sg : sg_aligned ,
515- ignoreCase );
522+ ignoreCase , tempVariableStrings );
516523 if (found ) {
517524 // nodeAttrMatch already checks negDesc, so no need to
518525 // check for that here
@@ -521,10 +528,9 @@ private void goToNextNodeMatch() {
521528 }
522529 }
523530 } else { // try to match the description pattern.
524- // TODO: pass in all varstrings and local varstrings
525531 boolean found = myNode .nodeAttrMatch (nextMatch ,
526532 hyp ? sg : sg_aligned ,
527- ignoreCase );
533+ ignoreCase , tempVariableStrings );
528534 if (found ) {
529535 // nodeAttrMatch already checks negDesc, so no need to
530536 // check for that here
@@ -556,9 +562,6 @@ private void goToNextNodeMatch() {
556562 edgeNamedFirst = true ;
557563 namesToEdges .put (myNode .reln .getEdgeName (), nextMatchEdge );
558564 }
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
562565 commitVariableGroups (tempVariableStrings ); // commit my variable groups.
563566 }
564567 // finished is false exiting this if and only if nextChild exists
0 commit comments