Skip to main content

LabelExpr

Enum LabelExpr 

Source
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

Source

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).

Source

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).

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for LabelExpr

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LabelExpr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for LabelExpr

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LabelExpr

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.