{"record":{"id":"3e37d0ed3decfe9f","repo":"stanfordnlp/CoreNLP","slug":"unknown-relation","errorCode":null,"errorMessage":"Unknown relation ","messagePattern":"Unknown relation ","errorType":"validation","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/semgraph/semgrex/GraphRelation.java","lineNumber":1460,"sourceCode":"            reln.equals(\">>\") || reln.equals(\"<<\") ||\n            reln.equals(\"<>\") ||\n            reln.equals(\"@\") || reln.equals(\"==\") ||\n            reln.equals(\"$+\") || reln.equals(\"$++\") ||\n            reln.equals(\"$-\") || reln.equals(\"$--\") ||\n            reln.equals(\".\") || reln.equals(\"..\") ||\n            reln.equals(\"-\") || reln.equals(\"--\") ||\n            reln.equals(\">++\") || reln.equals(\">--\") ||\n            reln.equals(\"<++\") || reln.equals(\"<--\"));\n  }\n\n  public static GraphRelation getRelation(String reln,\n                                          String type,\n                                          String name,\n                                          String edgeName) throws ParseException {\n    if (reln == null && type == null)\n      return null;\n    if (!isKnownRelation(reln)) {\n      throw new ParseException(\"Unknown relation \" + reln);\n    }\n    switch (reln) {\n      case \">\":\n        return new GOVERNOR(type, name, edgeName);\n      case \">++\":\n        return new GOVERNOR_RIGHT(type, name, edgeName);\n      case \">--\":\n        return new GOVERNOR_LEFT(type, name, edgeName);\n      case \"<\":\n        return new DEPENDENT(type, name, edgeName);\n      case \"<++\":\n        return new DEPENDENT_RIGHT(type, name, edgeName);\n      case \"<--\":\n        return new DEPENDENT_LEFT(type, name, edgeName);\n      case \"<>\":\n        return new CONNECTED(type, name, edgeName);\n    }\n    if (edgeName != null) {","sourceCodeStart":1442,"sourceCodeEnd":1478,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/semgraph/semgrex/GraphRelation.java#L1442-L1478","documentation":"GraphRelation.createRelation throws java.text.ParseException when the relation symbol (reln) is not one of the known Semgrex relation operators (>, >++, <, <<, ==, ~, etc.). The symbol is checked against a whitelist via isKnownRelation before dispatching to the relation class.","triggerScenarios":"Calling GraphRelation.createRelation with an unrecognized reln string, e.g. a typo like '=>', 'gov', or an operator from a different grammar (Tregex-style) pasted into a Semgrex pattern.","commonSituations":"Hand-written Semgrex queries with mistyped relation operators; porting Tregex patterns to Semgrex without translating relations; config or query files edited manually.","solutions":["Correct the relation symbol to a valid Semgrex operator (>, <, <<, >>, ==, ~, <<#, etc.)","Check the Semgrex documentation for the supported relation list","If porting from Tregex, translate each relation to its Semgrex equivalent"],"exampleFix":"// before\nString pattern = \"{word:dog} => {word:cat}\";\n// after\nString pattern = \"{word:dog} > {word:cat}\";","handlingStrategy":"validation","validationCode":"Set<String> known = Set.of(\">\",\">>\",\">++\",\"<\",\"<<\",\"<<#\",\">>\",\"<<:\",\">>:\",\"==\",\".\",\"~\");\nif (reln != null && !known.contains(reln)) throw new IllegalArgumentException(\"Unknown relation \" + reln);","typeGuard":null,"tryCatchPattern":"try { GraphRelation r = GraphRelation.createRelation(reln, type, name, edgeName); } catch (ParseException e) { log.error(\"Unknown Semgrex relation '\" + reln + \"'\"); }","preventionTips":["Verify relation symbols against the Semgrex operator reference before writing patterns","Translate Tregex relations explicitly rather than reusing them in Semgrex","Add pattern validation tests covering every relation used in configs"],"tags":["java","semgrex","parse-error"],"backgroundTag":"invalid-regex-pattern","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}