Skip to content

Schemas

Bundled FtM model snapshot and lookup helpers. Use these when you need to introspect the model at runtime — yente-cli ref is the CLI front-end for the same data.

schemas

Bundled FtM model snapshot and lookup helpers.

The model is loaded from model.json at import time and re-exported as a plain dict. Use the helpers for the common membership / inheritance / deprecation checks; navigate model directly for anything richer.

describe_schema

describe_schema(schema: str) -> dict[str, Any]

Full projected schema view: summary + settable properties + relations.

properties are the attributes you set in a match query; relations are the entity-typed edges you traverse with fetch_entity_relations (omitted when the schema has none).

describe_type

describe_type(type_name: str) -> dict[str, Any]

Project an FtM value type, trimmed like schemata/properties.

Keeps name, label, description, matchable (true-only), and values (enum types only); drops structural cruft (maxLength/group/plural/pivot) and omits empties.

Raises:

Type Description
KeyError

if type_name is not a type in the bundled model.

has_schema

has_schema(name: str) -> bool

Return True if name is a valid schema in the bundled model.

is_a

is_a(schema: str, ancestor: str) -> bool

Return True if schema extends ancestor transitively.

Reflexive on schema itself. O(1) lookup against the pre-flattened schemata list — no MRO walk needed.

is_deprecated

is_deprecated(schema: str, prop: str) -> bool

Return True if prop is marked deprecated on schema or any ancestor.

is_matchable_schema

is_matchable_schema(schema: str) -> bool

Return True if schema can be used as a /match query target.

Non-matchable schemata (e.g. Document, Article, abstract parents like Thing) cause yente to raise TypeError at query construction; the SDK refuses such queries client-side rather than let the server reject them. See yente/data/entity.py:42.

iter_properties

iter_properties(schema: str) -> Iterator[str]

Yield every property name available on schema, including inherited ones.

model.json stores own-properties only on each schema definition; this walks the pre-flattened schemata ancestor list and yields each property name at most once, even if multiple ancestors define a property of the same name.

matchable_schemata

matchable_schemata() -> list[str]

Return every schema name with matchable: true in the model.

Sorted alphabetically for stable error messages.

property_matchable

property_matchable(prop_def: dict[str, Any]) -> bool

Resolve a property's matchable flag, falling back to its type's default.

A property may not set matchable itself; when it doesn't, the value comes from its FtM type (e.g. the country type is matchable, so citizenship inherits it). This is the FtM model's own resolution rule.

schema_index

schema_index(
    matchable_only: bool = False,
) -> list[dict[str, Any]]

Project every schema (or only matchable ones) as summaries, name-sorted.

schema_properties

schema_properties(schema: str) -> list[dict[str, Any]]

Project a schema's settable attributes (non-entity-typed), sorted by name.

These are the fields you fill in a match_entity query (names, dates, countries, identifiers, …). Relationship edges (entity-typed properties) live in :func:schema_relations, not here.

schema_relations

schema_relations(schema: str) -> list[dict[str, Any]]

Project a schema's relationship edges (entity-typed properties).

These are the edges fetch_entity_relations traverses (ownershipOwner, sanctions, familyPerson, …): pass the name as its prop, range is the schema the edge points at, and reverse names the role the source plays on the far entity — which disambiguates same-range edges (familyPerson/person vs familyRelative/relative, both → Family). Kept compact — no full property projection.

schema_summary

schema_summary(schema: str) -> dict[str, Any]

Project a schema header (no properties): name, description, matchable, lineage.

type_values

type_values(type_name: str) -> dict[str, str]

Return an enum type's value → label map (topic, country, …).

Empty for non-enum types (date, name, …). The single source for the controlled vocabularies the CLI and MCP expose.

Raises:

Type Description
KeyError

if type_name is not a type in the bundled model.