The select
clause
The select
clause defines the extraction criteria that will be used to
select the records that will be returned by a query. In your query, you can use data fields or
technical fields. You can write a simple select
clause or use elements such as glob
patterns or field modifiers.
For more information about records, see What is a record.
The data fields are present in the Wazi Deploy evidence files. They can be, for example, the name of an activity or an action, or the name or type of an artifact. The data fields are listed and explained in The evidence file.
How to specify a simple select
clause
select: all
If you want to filter the records, then you must specify the values of the fields that you want to search for.
select
clause on data fields:- Selection of all the records that have a
name
field whose value isMEMBER_COPY
:select: name: MEMBER_COPY
- Selection of all the records that have a
steps
field for which a subrecord contains aname
field whose value isMEMBER_COPY
:select: steps: name: MEMBER_COPY
- Selection of all the records that have both a
name
field and asteps
field. The value of thename
field must beADD
and thesteps
field must contain a subrecord that contains aname
field whose value isMEMBER_COPY
:select: name: ADD steps: name: MEMBER_COPY
Using glob patterns in the select
clause
You can use glob patterns to search for fields whose value matches the pattern that you specify.
You can enter a glob pattern in the key name or in the key value. The most common use is in the key value.
Glob patterns | Explanations |
---|---|
* |
Matches any sequence of characters, including an empty sequence. |
? |
Matches a single character. |
[abc] |
Matches one of the characters (such as abc ) that are entered in the square
brackets. |
[^abc] |
Matches any character, except the characters that are entered in the square brackets. |
[0-9] or [A-F] |
Matches any character in the given interval. |
- Selection of the records whose
name
field starts with LG:select: name: LG*
- Selection of the records whose
name
field starts withN
,R
, orT
:select: name: '[NRT]*'
- Selection of the records whose
name
field contains an uppercase A:select: name: '*A*'
Using field modifiers in the select
clause
You can use field modifiers to indicate to what extent each criterion of the
select
clause applies.
You can enter the field modifiers after the key name. The use of a white space before or after the field modifier is optional.
You can combine the field modifiers.
Field modifiers | Explanations |
---|---|
>= |
The field value must be greater than or equal to the specified value. |
> |
The field value must be strictly greater than the specified value. |
<= |
The field value must be less than or equal to the specified value. |
< |
The field value must be strictly less than the specified value. |
! |
The field value must match a value different from the specified value. |
| |
The field value must match at least one of the specified values. |
& or no field modifier |
The field value must match all the specified values. |
~ |
The field value must match the specified regular expression. |
- Selection of the records whose
name
must be lexicographically greater than or equal toLGD
and strictly lower thanLGU
:select: name>=: LGD name<: LGU
- Selection of the records whose
name
is notCICS
:select: name!: CICS
- Selection of the records whose
name
lists eitherCICS
orDB2
:select: name|: - CICS - DB2
- Selection of the records whose
properties
has at least two subrecords. One subrecord must have apath
key and another subrecord must have atype
key.select: properties&: - key: path - key: type
Note: The&
is optional. You can omit it to specify the same selection. - Selection of the records whose
name
ends with an uppercase E. In the following example, you use a regular expression for this selection:select: name~: .*E$
Note: The regular expressions are a standard concept that is not specific to Wazi Deploy.
Combining selection criteria in the select
clause
and
,
or
, all
, any
, none
,
not
. and
, or
, all
,
any
, and none
keywords must contain a YAML list. - Selection of the records that do not meet the following criteria: a
key
that is eitherpath
ortype
and a value that starts with an uppercase C.select: not: and: - or: - key: path - key: type - value: C*
- Selection of the records that do not have a
key
that is eitherpath
ortype
and do not have a value that starts with an uppercase C.select: none: - key: path - key: type - value: C*
Using technical fields in a select
clause
The previous explanations and example were based on data fields.
You must be aware that you can also use technical fields, which are automatically added to each record at indexing time.
The names of the technical fields start with ymli_ (which stands for YAML Indexer) but alternate names can be defined in an alias file.
select
clause.Field names | Description |
---|---|
ymli_id |
Unique numeric identifier of a record. Each record has one id . |
ymli_file |
Name of the file, without the folder name, that the record was extracted from. |
ymli_folder |
Path to the folder that contains an indexed file. The path is relative to the index root. |
ymli_level |
Level of the record relatively to the root in the YAML tree. |
ymli_category |
Path from the root of the YAML tree to the record. |
ymli_parent |
Reference to an ancestor record. |
ymli_parent_id |
Identifier (ymli_id) of the parent record. |
ymli_rank |
Rank of the record in the current file. |
ymli_line |
Start line of the record in the indexed file. |
ymli_stop_line |
End line of the record in the indexed file. |
ymli_version |
Version of the record. It corresponds to the rank of the indexing that produced this record. |
select
clause:- Selection of the indexed records that are in a file whose name contains
Python
orpython
:select: ymli_file: '*[Pp]ython*'
- Selection of all the artifacts that start with L. If you look at an evidence file, you can see
that an
activity
node containsactions
nodes, which in turn containsteps
nodes, which in turn containartifacts
nodes. With theymli_category
field, you can make queries that are related to this hierarchy. In this example, you use a regular expression.select: ymli_category~: ^ activities(:[0-9]+)? actions(:[0-9]+)? steps(:[0-9]+)? artifacts(:[0-9]+)? $ name: L*
- Selection of all the records that are on the fourth level of the YAML
hierarchy:
select: ymli_level: 4