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. The typed views (:func:schema_spec, :func:property_specs, :func:type_spec) are what to navigate for anything beyond the common membership / inheritance / deprecation checks.

PropertySpec

Bases: BaseModel

One property definition from the bundled model.

SchemaSpec

Bases: BaseModel

One schema definition from the bundled model, with its own properties only.

TypeSpec

Bases: BaseModel

One property type definition from the bundled model.

all_property_specs cached

all_property_specs() -> Mapping[str, PropertySpec]

Return one definition per property name across every schema.

For names met without a schema (a statement row's prop). A few names differ between schemata — authority is a string on Sanction but an entity on Contract — so prefer :func:property_specs when the schema is known. Schemata are scanned alphabetically; the first definition wins.

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.

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.

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: PropertySpec) -> 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.

property_specs cached

property_specs(schema: str) -> Mapping[str, PropertySpec]

Return every property available on schema, own and inherited.

Where several ancestors define the same name, the first in the model's schemata list wins.

Raises:

Type Description
KeyError

if schema is not a schema in the bundled model.

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_spec cached

schema_spec(name: str) -> SchemaSpec

Return the typed definition of one schema.

Raises:

Type Description
KeyError

if name is not a schema in the bundled model.

schema_summary

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

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

type_spec cached

type_spec(name: str) -> TypeSpec

Return the typed definition of one property type (country, date, …).

Raises:

Type Description
KeyError

if name is not a type in the bundled model.

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.