Skip to content

Commit 18816bc

Browse files
committed
Get started connected edges to the VariableStrings as well. This gonna suck, considering how many relations need to be edited... probably the satisfies() and iterate() methods both need updates
1 parent adb8b7a commit 18816bc

File tree

5 files changed

+114
-79
lines changed

5 files changed

+114
-79
lines changed

src/edu/stanford/nlp/semgraph/semgrex/GraphRelation.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void initialize() {
255255
// GOVERNOR graph relation: ">" ===============================================
256256

257257
static private class GOVERNOR extends GraphRelation {
258-
GOVERNOR(String reln, String name, String edgeName) {
258+
GOVERNOR(String reln, String name, String edgeName, List<Pair<Integer,String>> varGroups) {
259259
super(">", reln, name, edgeName);
260260
}
261261

@@ -1453,31 +1453,35 @@ public static boolean isKnownRelation(String reln) {
14531453
public static GraphRelation getRelation(String reln,
14541454
String type,
14551455
String name,
1456-
String edgeName) throws ParseException {
1456+
String edgeName,
1457+
List<Pair<Integer,String>> varGroups) throws ParseException {
14571458
if (reln == null && type == null)
14581459
return null;
14591460
if (!isKnownRelation(reln)) {
14601461
throw new ParseException("Unknown relation " + reln);
14611462
}
14621463
switch (reln) {
14631464
case ">":
1464-
return new GOVERNOR(type, name, edgeName);
1465+
return new GOVERNOR(type, name, edgeName, varGroups);
14651466
case ">++":
1466-
return new GOVERNOR_RIGHT(type, name, edgeName);
1467+
return new GOVERNOR_RIGHT(type, name, edgeName, varGroups);
14671468
case ">--":
1468-
return new GOVERNOR_LEFT(type, name, edgeName);
1469+
return new GOVERNOR_LEFT(type, name, edgeName, varGroups);
14691470
case "<":
1470-
return new DEPENDENT(type, name, edgeName);
1471+
return new DEPENDENT(type, name, edgeName, varGroups);
14711472
case "<++":
1472-
return new DEPENDENT_RIGHT(type, name, edgeName);
1473+
return new DEPENDENT_RIGHT(type, name, edgeName, varGroups);
14731474
case "<--":
1474-
return new DEPENDENT_LEFT(type, name, edgeName);
1475+
return new DEPENDENT_LEFT(type, name, edgeName, varGroups);
14751476
case "<>":
1476-
return new CONNECTED(type, name, edgeName);
1477+
return new CONNECTED(type, name, edgeName, varGroups);
14771478
}
14781479
if (edgeName != null) {
14791480
throw new ParseException("Relation " + reln + " does not allow for named edges");
14801481
}
1482+
if (varGroups.size() != 0) {
1483+
throw new ParseException("Relation " + reln + " does not allow for capturing variable groups");
1484+
}
14811485
switch (reln) {
14821486
case ">>":
14831487
return new GRANDPARENT(type, name);

0 commit comments

Comments
 (0)