Selector¶
-
public final class
Selector
implements Comparable<Selector>¶ A zenoh Selector is a string which is the conjunction of an path expression identifying a set of keys and some optional parts allowing to refine the set of
Path
s and associatedValue
s. Structure of a selector:/s1/s2/../sn?x>1&y<2&..&z=4(p1=v1;p2=v2;..;pn=vn)#a;x;y;..;z | | | | | | | | |-- expr --| |-- filter --| |--- properties ---| |fragment|
where:
- expr: is a path expression. I.e. a string similar to a
Path
but with character ‘*’ allowed. A single ‘*’ matches any set of characters in a path, except ‘/’. While “**” matches any set of characters in a path, including ‘/’. A path expression can be absolute (i.e. starting with a ‘/’) or relative to aWorkspace
. - filter: a list of predicates separated by ‘&’ allowing to perform filtering on the
Value
associated with the matching keys. Each predicate has the form “field``operator``value” where:- field is the name of a field in the value (is applicable and is existing. otherwise the predicate is false)
- operator is one of a comparison operators: `` , <= , >= , = , !=
- value is the the value to compare the field’s value with
- fragment: a list of fields names allowing to return a sub-part of each value. This feature only applies to structured values using a “self-describing” encoding, such as JSON or XML. It allows to select only some fields within the structure. A new structure with only the selected fields will be used in place of the original value.
NOTE: the filters and fragments are not yet supported in current zenoh version.
See also:
Workspace.get(Selector)
,Workspace.subscribe(Selector,Listener)
- expr: is a path expression. I.e. a string similar to a