Loading

filter.byselector

filter

This filter allow to select GTS with a standard or an extended selector.

Standard selector: classname{labelOrAttribute=x}
  • If classname match, filter.byselector looks into input labels to check if labelOrAttribute exists and equals x. If labelOrAttribute is not found among input labels, it looks into input attributes if the label exists and equals x.
Extended selector: classname{labelname=x}{attributename=y} matches if:
  • classname matches
  • input have labelname in its labels, and label value matches
  • input have attributename in its labels, and attribute value matches
Selectors example:
  • ~.*{} matches everything.
  • ={} matches only emtpy classnames, whatever the labels and attributes.
  • ~.*{label=value}{} filter.byselector is equivalent to { 'label' 'value' } filter.bylabels.
  • ~.*{}{attribute~value} filter.byselector is equivalent to { 'attribute' '~value' } filter.byattr.
filter.byselector is available since version 2.4.0.

See also

Signatures

Examples

[ NEWGTS { 'room' 'A' } RELABEL // no classname NEWGTS 'temperature' RENAME { 'alive' 'true' } RELABEL NEWGTS 'temperature' RENAME { 'room' 'B' } RELABEL NEWGTS 'temperature' RENAME { 'alive' 'maybe' } SETATTRIBUTES ] 'glist' STORE // uncomment following examples to test selectors [ $glist [] '={}' 'filter.byselector' EVAL ] FILTER //only empty classnames // [ $glist [] '={room=B}' 'filter.byselector' EVAL ] FILTER // empty classname, label=B, or attribute=B ->no match // [ $glist [] '~.*{room=(A|B)}' 'filter.byselector' EVAL ] FILTER // nothing has literal value (A|B) // [ $glist [] '~.*{room~(A|B)}' 'filter.byselector' EVAL ] FILTER // any classname, room=A or room=B. // [ $glist [] '=temperat{}' 'filter.byselector' EVAL ] FILTER // no classname is strictly equal to 'temperat' // [ $glist [] '=temperature{}' 'filter.byselector' EVAL ] FILTER // 3 gts has classname strictly equal to 'temperature' // [ $glist [] '~.*{}' 'filter.byselector' EVAL ] FILTER // no filter // [ $glist [] '~.*emper.*{}' 'filter.byselector' EVAL ] FILTER // 3 gts has classname that contains 'emper' // [ $glist [] '~.*{foo=bar}' 'filter.byselector' EVAL ] FILTER // no gts has 'foo' as label or attribute // [ $glist [] '~.*{alive~.*}' 'filter.byselector' EVAL ] FILTER // 2 gts has 'alive' label or room attribute // [ $glist [] '~.*{}{alive~.*}' 'filter.byselector' EVAL ] FILTER // only one has 'alive' attribute // [ $glist [] '~.*{alive~.*}{}' 'filter.byselector' EVAL ] FILTER // only one has 'alive' label