Environment
- cbm version: 0.6.0
- Platform: macOS (Darwin arm64)
Bug
Label tests in WHERE clauses (standard openCypher syntax WHERE n:Label) are not supported. The parser rejects them outright.
Minimal reproducer
MATCH (n)
WHERE n:Class OR n:Method
AND n.file_path CONTAINS 'JarvisApp.swift'
RETURN count(n) AS c
Expected: count of nodes that are either Class or Method labels in JarvisApp.swift.
Actual: parse error — expected token type 67, got 73 at pos 18.
Both individual WHERE n:Class and WHERE n:Method also fail, so this isn't specific to OR.
Root cause
src/cypher/cypher.h — cbm_condition_t (line 184) has slots for variable, property, op, value, but no slot for label tests. The AST can't represent n:Label as a condition.
This is an architectural limitation — fixing it requires:
- Extending
cbm_condition_t with a const char *label_test field (or a new condition variant)
- Teaching
parse_condition_expr (line 826) to recognize variable:Label in WHERE clauses
- Teaching
eval_condition (line 1914) to check labels against the node
Workaround (current)
Use pattern-level label filtering: MATCH (n:Class) WHERE n.file_path CONTAINS 'JarvisApp.swift'. But this doesn't support OR-of-labels, which is the main reason to use WHERE-level label tests.
Medium-complexity fix — AST change + parser + executor. Reporting for visibility and roadmap.
Environment
Bug
Label tests in
WHEREclauses (standard openCypher syntaxWHERE n:Label) are not supported. The parser rejects them outright.Minimal reproducer
Expected: count of nodes that are either Class or Method labels in
JarvisApp.swift.Actual: parse error —
expected token type 67, got 73 at pos 18.Both individual
WHERE n:ClassandWHERE n:Methodalso fail, so this isn't specific toOR.Root cause
src/cypher/cypher.h—cbm_condition_t(line 184) has slots forvariable,property,op,value, but no slot for label tests. The AST can't representn:Labelas a condition.This is an architectural limitation — fixing it requires:
cbm_condition_twith aconst char *label_testfield (or a new condition variant)parse_condition_expr(line 826) to recognizevariable:Labelin WHERE clauseseval_condition(line 1914) to check labels against the nodeWorkaround (current)
Use pattern-level label filtering:
MATCH (n:Class) WHERE n.file_path CONTAINS 'JarvisApp.swift'. But this doesn't support OR-of-labels, which is the main reason to use WHERE-level label tests.Medium-complexity fix — AST change + parser + executor. Reporting for visibility and roadmap.