Filters¶
-f (or --filter) keeps the samples an expression selects, on every
command that works on samples. A query saved in .samplekitrc, --query NAME, is the same language. The examples are the tensile specimens of the
home page, in the last step of its example:
$ samplekit -f 'material == steel || elongation > 30' -c material,elongation
name material elongation [%]
─────────────────────────────────────
copper-01 copper 44.0
steel-01 steel 24.0
2 of 3 samples
Quote the whole expression, as above: the shell would otherwise read &&,
||, !, < and > itself.
Comparisons¶
Expression |
Selects the samples where |
|---|---|
|
|
|
|
|
a text holding a space, in quotes |
|
one field above another, in one unit |
|
the text holds |
|
the text starts with |
|
|
|
the sample has no |
A bare word is text,
material == steel, unless it names a field:tensile_strength > yield_strengthcompares two fields, and after<,<=,>or>=a bare word is always a field. In quotes, a word is always text.12,1.050,true,2026-01-24are a number, a boolean and a date; quoted,"12"is text.==and!=respect the case;containsandstarts_withdo not. An ordered comparison of texts,name > "d", follows the order-ssorts in.A number compared with a text is refused, never answered nothing:
elongation == highsays so. Two fields in different units are refused too:width > areacompares millimetres with square millimetres.A sample without the field is not selected, even under
!:!(elongation > 20)leaves out a specimen withoutelongation.elongation is missingasks for those.==on a number compares it exactly: a value shown69.2may hold69.1759, and the filter says so, with the range to write instead,young_modulus >= 69.15 && young_modulus < 69.25.
How a sample stands¶
state holds the words status and validate say of a sample:
Expression |
Selects the samples |
|---|---|
|
one of whose values is outdated |
|
one of whose values is not current, for whatever reason |
|
holding either |
|
one of whose computed values was written by hand |
Combining¶
&& (and), || (or) and ! (not), with parentheses: && binds before
||, so a && b || c is (a && b) || c.
material == steel && !(tags has reference)
(material == steel || material == copper) && elongation > 20
and, or and not are not keywords: a field may be named so, and
material == steel and elongation > 20 is refused, naming &&. -f given twice, or with
--query, keeps the samples every one selects.
Mistakes are named¶
A field no sample holds is an error that names the nearest one, never an
empty answer: elongaton > 20 says did you mean elongation?. A text no
sample holds is a warning that suggests the nearest one, material == steal
did you mean steel?, beside an empty table. A tag no sample carries,
tags has reference, is an error, which points to samplekit list tags. In
the TUI, / filters, and Tab completes the fields, the operators and the
values.