Oihana PHP Arango

resolveTraversalQuantifier.php

Table of Contents

Functions

resolveTraversalQuantifier()  : TraversalQuantifier
Resolve the `quant` parameter for an edge/join traversal into the predicate decisions that shape its `LENGTH( FOR … RETURN 1 ) <cmp> <threshold>` check.

Functions

resolveTraversalQuantifier()

Resolve the `quant` parameter for an edge/join traversal into the predicate decisions that shape its `LENGTH( FOR … RETURN 1 ) <cmp> <threshold>` check.

resolveTraversalQuantifier(mixed $value) : TraversalQuantifier

This is the relation counterpart of resolveQuantifier() (which targets the array surface). It shares the same vocabulary — any / all / none / an integer n — but maps it to a count comparison rather than to an AQL quantifier keyword:

  • any (or absent)LENGTH(...) > 0 with a LIMIT 1 short-circuit (« at least one linked match ») — the historical, backward-compatible form;
  • noneLENGTH(...) == 0 with LIMIT 1 (« no linked match »);
  • allLENGTH(...) == 0 with LIMIT 1 over the negated leaf (« no linked vertex violates the condition »); vacuously true with no relation. The caller negates the leaf and requires one to be present;
  • a bare integer n (or its numeric string) → LENGTH(...) >= n, without LIMIT (the rows must be counted). The threshold is cast to an int and inlined, which is injection-safe — and consistent with the array surface.

n means « at least n » and must be >= 1: « at least 0 » is always true (use none for « no linked match »).

Parameters
$value : mixed

The raw quant parameter (any, all, none, or an integer).

Tags
example
use function oihana\arango\db\helpers\resolveTraversalQuantifier;

resolveTraversalQuantifier( null )   ; // > 0,  LIMIT 1            (any, default)
resolveTraversalQuantifier( 'none' ); // == 0, LIMIT 1
resolveTraversalQuantifier( 'all' ) ; // == 0, LIMIT 1, negate leaf
resolveTraversalQuantifier( 3 )     ; // >= 3, no LIMIT
throws
ValidationException

When the quantifier is neither a known name nor an integer >= 1.

since
1.4.0
author

Marc Alcaraz

Return values
TraversalQuantifier

The resolved predicate decisions.

On this page

Search results