Defines the shape describing the truth values a resource may carry and provides the boolean factory stating
it, mapping the JSON boolean type to the
XSD 1.0 boolean datatype. The kind closes the domain to two
values; an enumeration closes it further to one, so that a member may stand as the tag telling the alternatives of a
union apart.
¹ XSD 1.0 datatypes are referenced by RDF 1.1 and
JSON-LD 1.1 as normative
Compatibility
JSON
XSD
JavaScript
true, false
{true, false, 1, 0} ¹
true, false
¹ Canonical form: true, false
Defining boolean shapes
import { boolean } from'@metreeca/blue/boolean';
constflag = boolean(); // either truth value constsettled = boolean({ in:true }); // the single admitted value constpaid = boolean(true); // the same, stated as a bare value
Note
An enumeration also narrows the value the shape describes: settled admits true, not both truth values. The
domain holds two values, so the constraint states the single admitted one: a list would degenerate, admitting
either the whole domain or nothing at all.
A stored value states one truth value, singling out the alternative it belongs to, and the type of the value the
union describes is narrowed by the tag exactly as the shape is.
Boolean shape types and operations.
Defines the shape describing the truth values a resource may carry and provides the boolean factory stating it, mapping the JSON boolean type to the XSD 1.0 boolean datatype. The kind closes the domain to two values; an enumeration closes it further to one, so that a member may stand as the tag telling the alternatives of a union apart.
¹ XSD 1.0 datatypes are referenced by RDF 1.1 and JSON-LD 1.1 as normative
Compatibility
true,falsetrue,false¹ Canonical form:
true,falseDefining boolean shapes
An enumeration also narrows the value the shape describes:
settledadmitstrue, not both truth values. The domain holds two values, so the constraint states the single admitted one: a list would degenerate, admitting either the whole domain or nothing at all.Using in resource shapes
Tagging the alternatives of a union
A stored value states one truth value, singling out the alternative it belongs to, and the type of the value the union describes is narrowed by the tag exactly as the shape is.
See