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
¶
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 ¶
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 ¶
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 |
has_schema ¶
Return True if name is a valid schema in the bundled model.
is_a ¶
Return True if schema extends ancestor transitively.
Reflexive on schema itself.
is_deprecated ¶
Return True if prop is marked deprecated on schema or any ancestor.
is_matchable_schema ¶
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 ¶
Yield every property name available on schema, including inherited ones.
matchable_schemata ¶
Return every schema name with matchable: true in the model.
Sorted alphabetically for stable error messages.
property_matchable ¶
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
¶
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_index ¶
Project every schema (or only matchable ones) as summaries, name-sorted.
schema_properties ¶
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 ¶
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
¶
Return the typed definition of one schema.
Raises:
| Type | Description |
|---|---|
KeyError
|
if |
schema_summary ¶
Project a schema header (no properties): name, description, matchable, lineage.
type_spec
cached
¶
Return the typed definition of one property type (country, date, …).
Raises:
| Type | Description |
|---|---|
KeyError
|
if |
type_values ¶
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 |