pub enum LabelExpr {
Label(SmallName),
Wildcard,
Dynamic(DynamicLabelExpr),
Not(Box<LabelExpr>),
And(Vec<LabelExpr>),
Or(Vec<LabelExpr>),
}Expand description
A GQL label/relationship-type expression (CIP-14): & (conjunction),
| (disjunction), ! (negation), % (wildcard – matches any non-empty
label set, or any relationship since every relationship has exactly one
type), parenthesized grouping (folded directly into the tree, so no
explicit Group variant is needed), and CIP-249’s dynamic label name
$(expr). The legacy colon-conjunction shorthand :A:B:C lowers to
And([Label(A), Label(B), Label(C)]), and the legacy relationship-type
disjunction shorthand :A|B lowers to Or([Label(A), Label(B)]),
preserving pre-CIP-14 behavior exactly.
Variants§
Label(SmallName)
A single label/type name.
Wildcard
%
Dynamic(DynamicLabelExpr)
$(expr) / $all(expr) / $any(expr) – a label/type name (or, for
list-valued expr, a set of label/type names) resolved at runtime
(CIP-249 / CIP-156 / CIP-221).
Not(Box<LabelExpr>)
!<label-expr> – negates only the following primary.
And(Vec<LabelExpr>)
<label-expr> & <label-expr> & ...
Or(Vec<LabelExpr>)
<label-expr> | <label-expr> | ...
Implementations§
Source§impl LabelExpr
impl LabelExpr
Sourcepub fn as_label_list(&self) -> Option<Vec<SmallName>>
pub fn as_label_list(&self) -> Option<Vec<SmallName>>
Returns the flat list of label names if this expression is a plain
label list: a single label, or an And of only plain labels (as
produced by legacy colon-conjunction :A:B:C, or a comma-separated
SET/REMOVE label item). Returns None for anything using |, !,
%, or a dynamic label – those aren’t valid label lists (CREATE /
MERGE / SET / REMOVE label specifications, per CIP-14’s “DML
statements” exclusion and CIP-126).
Sourcepub fn contains_not_or_wildcard(&self) -> bool
pub fn contains_not_or_wildcard(&self) -> bool
True if this expression contains ! (negation) or % (wildcard)
anywhere, recursively. Used to reject a variable-length quantifier
combined with negation/wildcard (CIP-14).
Sourcepub fn as_ddl_list(&self) -> Option<Vec<SmallName>>
pub fn as_ddl_list(&self) -> Option<Vec<SmallName>>
Returns the flat list of label/type names if this expression is a
plain label or |-disjunction list: a single label, or an Or of
only plain labels (as produced by A|B|C). Returns None for
anything using &, !, %, or a dynamic label. Used by the
CREATE INDEX / CREATE CONSTRAINT FOR target (CIP-11/CIP-38/
CIP-235’s FOR (n:A|B) multi-label DDL surface) – a narrower
grammar than general MATCH label expressions.
Sourcepub fn contains_dynamic(&self) -> bool
pub fn contains_dynamic(&self) -> bool
True if this expression contains a $(...)/$all(...)/$any(...)
dynamic label/type atom anywhere, recursively (CIP-156). Used by
CREATE/MERGE’s static “exactly one relationship type” check to defer
to runtime resolution when the count can’t be known until the
dynamic expression is evaluated.