{"record":{"id":"d19fefe9d82425ab","repo":"stanfordnlp/CoreNLP","slug":"use-of-node-conjugation-expressions-such-as-f-d19fef","errorCode":null,"errorMessage":"Use of node conjugation (expressions such as '< [foo bar]' or '< [foo & bar]') is now illegal.  The issue is that expressions such as '[foo bar] < zzz' may intuitively mean that foo < zzz, bar < zzz, zzz the same for both cases, but that is not the way the parser interpreted this expression.  Changing the functionality might break existing expressions, and anyway this can be rewritten in various ways such as 'zzz > foo > bar' or 'foo < zzz=a : bar < zzz=a'.  Offending expression: ","messagePattern":"Use of node conjugation \\(expressions such as '< \\[foo bar\\]' or '< \\[foo & bar\\]'\\) is now illegal\\.  The issue is that expressions such as '\\[foo bar\\] < zzz' may intuitively mean that foo < zzz, bar < zzz, zzz the same for both cases, but that is not the way the parser interpreted this expression\\.  Changing the functionality might break existing expressions, and anyway this can be rewritten in various ways such as 'zzz > foo > bar' or 'foo < zzz=a : bar < zzz=a'\\.  Offending expression: ","errorType":"exception","errorClass":"SemgrexParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/semgraph/semgrex/SemgrexParser.jj","lineNumber":109,"sourceCode":"    // start from 1 since we haven't parsed anything yet\n    startToken = getToken(1);\n  }\n  (\n    (\n      (reverse = <ALIGNRELN> node = SubNode(GraphRelation.ALIGNED_ROOT))\n      |\n      ( node = SubNode(GraphRelation.ROOT) { children.add(node); }\n        ( \":\" node = SubNode(GraphRelation.ITERATOR) { children.add(node); } )*\n      )\n    )\n    {\n      if (children.size() > 1)\n        node = new CoordinationPattern(true, children, true, true);\n      if (deprecatedAmp) {\n        throw new SemgrexParseException(\"Use of & in semgrex patterns is now illegal.  It is equivalent to the same expression without the &.  Offending expression: \" + startToken);\n      }\n      if (deprecatedNodeConj) {\n        throw new SemgrexParseException(\"Use of node conjugation (expressions such as '< [foo bar]' or '< [foo & bar]') is now illegal.  The issue is that expressions such as '[foo bar] < zzz' may intuitively mean that foo < zzz, bar < zzz, zzz the same for both cases, but that is not the way the parser interpreted this expression.  Changing the functionality might break existing expressions, and anyway this can be rewritten in various ways such as 'zzz > foo > bar' or 'foo < zzz=a : bar < zzz=a'.  Offending expression: \" + startToken);\n      }\n    }\n  )\n  (\n    (\n      \"::\" <UNIQ> { uniqKeys = new ArrayList<>(); }  (nextIdentifier = identifier() { uniqKeys.add(nextIdentifier.image); })*\n      {\n        for (String key : uniqKeys) {\n          if (!knownVariables.contains(key)) {\n            throw new SemgrexParseException(\"Semgrex pattern asked for uniq of node \" + key + \" which does not exist in the pattern\");\n          }\n        }\n        // TODO: can error check that the keys are unique between node and edge names\n        // that might require keeping edge names in a known set\n        // TODO: edge names might need some upgrades anyway - shouldn't name them under negation, for example\n        node = new UniqPattern(node, uniqKeys);\n      }\n    )?","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/semgraph/semgrex/SemgrexParser.jj#L91-L127","documentation":"SemgrexParser rejects node conjugation — bracketed multi-expression patterns attached via a relation such as '< [foo bar]' or '< [foo & bar]'. The parser's interpretation differs from intuition (it does not mean each element independently relates), so changing it would break existing patterns; instead the construct is made illegal and a SemgrexParseException naming the offending token is thrown.","triggerScenarios":"Compiling a semgrex pattern using node conjugation syntax, e.g. '{pos:VBZ} < [nsubj dobj]' or any bracketed expression combined with '&' as node conjunction.","commonSituations":"Migrating very old semgrex patterns; translating tregex habits into semgrex; tutorials predating the syntax change.","solutions":["Rewrite as sequential relations, e.g. 'zzz > foo > bar'","Use named edges with separate matches: 'foo < zzz=a : bar < zzz=a'","Drop the inner '&' and restate each relation explicitly in separate conjuncts"],"exampleFix":"// before\nSemgrexPattern p = SemgrexPattern.compile(\"{} < [foo bar]\");\n// after\nSemgrexPattern p = SemgrexPattern.compile(\"{} > foo > bar\");","handlingStrategy":"validation","validationCode":"java.util.regex.Pattern nodeConj = java.util.regex.Pattern.compile(\"\\\\\\\\?\\s*<\\s*\\\\[[^\\\\]]*(&|\\\\s)[^\\\\]]*\\\\]\");\nif (nodeConj.matcher(pattern).find()) throw new IllegalArgumentException(\"node conjugation is illegal in semgrex: \" + pattern);","typeGuard":null,"tryCatchPattern":"try {\n  p = SemgrexPattern.compile(pattern);\n} catch (SemgrexParseException e) {\n  if (e.getMessage().startsWith(\"Use of node conjugation\")) { /* rewrite pattern to sequential relations */ }\n  throw e;\n}","preventionTips":["Rewrite '[a b] < z' style patterns as 'z > a > b' or 'a < z=b : b < z=b'","Audit pattern repositories for bracketed conjunctions after a relation","Train users on modern semgrex semantics, not pre-3.6 tutorials"],"tags":["semgrex","parser","deprecated-syntax"],"backgroundTag":"deprecated-api-usage","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"}