User Tools

Site Tools


01_user_documentation:07_rgg_xl:02_xl:03_query:01_predicate:04_singlelate_match

Single, Late match

Single, late and optional matches enables to restrict the set of matches to a specific condition. These conditions can improve the pattern matching in as it might enable to skip some of the predicates. The syntax is:

  • : : for single match
  • & : for late match
  • ? : for optional match

The condition match is added in parenthesis: pattern (: pattern) , where pattern can be any pattern (node, path, combined). All the three conditions are matched as late as possible to unsure that the other predicates are properly resolved. Yet, by using these matching conditions, we can force the matching algorithm to not choose a disadvantageous order with respect to computation time.

Combining

The optional pattern may be combined with the first match pattern as in X (:? Y) or the equivalent variant X (?: Y) so that if there are matches, only the first one is used.

Example

The pattern X Y yields the matches (b, e), (c, d), (c, f ), while:

  • X (: --> Y) yields (b, e), (c, d) or (b, e), (c, f ), depending on whether d or f is found at first.
  • X (& --> Y)yields (b, e), (c, d), (c, f ).
  • X (? --> Y) would yield the matches (a, null), (b, e), (c, d), (c, f )
  • X (:? --> Y) yields (a, null), (b, e), (c, d) or (a, null), (b, e), (c, f ).
01_user_documentation/07_rgg_xl/02_xl/03_query/01_predicate/04_singlelate_match.txt · Last modified: 2025/08/25 11:34 by gaetan