Skip to main content

Module entity_type

Module entity_type 

Source
Expand description

Entity type vocabulary: open since V017, with a canonical set as guidance.

This line used to read “13 variants, ValueEnum + serde + rusqlite impls”, which described the closed enum that V017__open_entity_type_vocabulary.sql removed. The module’s own //! header carries the current account. Entity type vocabulary: open by default, with a canonical set as guidance.

Until v1.2.8 this module owned a closed EntityType enum of thirteen kinds and folded every other label onto the nearest one, terminating at concept. The fold was lossy in the strict sense: the string the caller wrote was consumed inside Deserialize and never existed as a value again, so no layer above could report it, store it, or decide policy about it. On the database of this workspace that put 69% of all entities in a single bucket, which makes filtering by concept indistinguishable from not filtering.

v1.2.8 opens the vocabulary instead of widening it, mirroring what V010__open_relation_vocabulary.sql did for relations back in v1.0.49: the SQL CHECK is gone (V017), the label travels as a plain String, and crate::entity_type::CANONICAL_ENTITY_TYPES is advice rather than a gate. The path is fully qualified on purpose: a //! header is concatenated with the /// written above pub mod in lib.rs and RESOLVES in that outer scope, so a bare name here fails to resolve and cargo doc exits 101. Because nothing is folded any more, the caller’s label survives by construction — it needs no second column to be preserved, only the absence of something destroying it.

What remains enforced is shape, never membership. See crate::entity_type::normalize_entity_type.

Constants§

CANONICAL_ENTITY_TYPES
The thirteen kinds that were canonical while the vocabulary was closed.
DEFAULT_ENTITY_TYPE
Kind assigned when a caller supplies no type at all.

Functions§

is_canonical_entity_type
Reports whether s is one of CANONICAL_ENTITY_TYPES.
normalize_entity_type
Normalises an entity type label’s shape, never its meaning.
normalize_entity_type_or_default
Normalises s, falling back to DEFAULT_ENTITY_TYPE when it is unusable.