Boolean Terms (True/False, Yes/No)
representation.boolean.termsBoolean value represented as a full word or phrase: true/false, yes/no, on/off, enabled/disabled, active/inactive. Any casing (TRUE, True, true). Transforms to DuckDB BOOLEAN type.
Worked samples
DuckDB 1.5.5 · finetype 0.6.64
| Value | As BOOLEAN |
|---|---|
| true | true |
| false | false |
| yes | true |
| no | false |
| on | true |
| off | false |
| True | true |
| False | false |
Background
Origin
FineType defines Boolean Terms itself, as a boolean value written as a full word: true/false, yes/no, on/off, enabled/disabled or active/inactive, in any casing.[1] The Boolean data type is named after George Boole, who first defined an algebraic system of logic in the mid-19th century.[2]
The core schema in YAML 1.2.2 resolves only true, True, TRUE, false, False and FALSE to the boolean tag.[3] The SQL:1999 standard introduced a BOOLEAN data type as an optional feature (T031).[2]
Use
RFC 8259, the JSON standard, says the literal names false, null and true must be lowercase.[4] XML Schema 1.1 gives boolean a lexical space of four literals: true, false, 1 and 0.[5] The Frictionless Table Schema casts strings in a boolean field using trueValues and falseValues, which default to true, True, TRUE and 1, and false, False, FALSE and 0.[6] PostgreSQL's boolean input accepts true, yes, on and 1 for the true state, and false, no, off and 0 for the false state.[7] PostgreSQL's boolean input ignores leading or trailing whitespace, and case does not matter.[7]
The StrictYAML documentation, in a page titled The Norway Problem, shows PyYAML loading an unquoted NO in a list of country codes as the boolean False.[8] The StrictYAML documentation gives quoting the value, as 'NO', as the quick fix.[8] When a yes/no column sits next to country codes, language codes or initials, check that a short code has not been turned into a boolean somewhere upstream. (Meridian's view)
Where you'll meet it
GLEIF's LEI-CDF Format 3.1 says an EntityStatus value in a conforming file shall be one of the code strings ACTIVE, INACTIVE or NULL.[9] GLEIF's LEI-CDF Format 3.1 describes NULL as meaning the entity status is not applicable.[9]
Sources
- [1]finetype/labels/definitions_representation.yaml at main · meridian-online/finetype · GitHubFineType
- [2]Boolean data type - Wikipediasecondary source
- [3]YAML Ain’t Markup Language (YAML™) revision 1.2.2standard
- [4]RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Formatstandard
- [5]W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypesstandard
- [6]Table Schema | Data Package (v1)standard
- [7]8.6. Boolean Typedocumentation
- [8]The Norway Problem - why StrictYAML refuses to do implicit typing and so should you - HitchDevsecondary source
- [9]Level 1 Data: LEI-CDF Format 3.1 - LEI Data: Access & Use - LEI Data – GLEIForganisation
Detection notes
Full-word boolean encoding. The most common format in application data and user-facing systems. DuckDB natively accepts true/false, yes/no, on/off (case-insensitive) for CAST to BOOLEAN.
In Meridian's open data
- gleif
entity_statusconfidence 1
Use it
$ finetype infer -i "true" --mode column
→ representation.boolean.terms
SELECT ft_infer('true');
-- → 'representation.boolean.terms'CAST(CASE WHEN lower({col}) IN ('on', 'enabled', 'active') THEN 'true' WHEN lower({col}) IN ('off', 'disabled', 'inactive') THEN 'false' ELSE {col} END AS BOOLEAN)Schema
https://meridian.online/schemas/representation.boolean.terms · Frictionless type boolean
finetype taxonomy representation.boolean.terms -o json-schema