Types & Ontology

Types are git-branched, schema-as-code (ADR ontology). schema_alter evolves a type in place; ontology_migrate applies a SHACL constraint set; create_link/register_edge_type wire the graph. Modules group a type pack.

14 methods across this domain. Signatures, parameters (incl. keyword-only tunable defaults), and the three SDK spellings are ported from the live SDK source; flagship methods carry a hand-written When to use + example.

RelataClient

register_type(name, **kwargs)

When to use. Register a new governed type with its column schema and constraints. **kwargs mirrors the server's full TypeDef body: description/owner, properties (each {name, required, state_machine}), computed_columns, graph_triggers (materialise a LinkStore edge from src_field to dst_field on every ingested row — the mechanism behind automatic graph wiring on ingest), bm25_params ({k1, b}, per-type full-text tuning), and force (required to redefine a computed column/state machine on a type that already has rows).

  • Python — client.relataclient.register_type(name, **kwargs)
  • TypeScript — registerType(name, spec)
  • Go — RegisterType(name, spec)

Parameters: name, **kwargs

Example

relata.register_type(
    "Company",
    properties=[{"name": "name", "required": True}, {"name": "vat", "required": False}],
    graph_triggers=[{"link_type": "employs", "src_field": "company_id", "dst_field": "employee_id"}],
)

schema_alter(type_name, action, column, new_column=None, col_type=None, optional=None)

When to use. Evolve a type in place (add/drop/rename/retype columns) without a full re-register (ADR-1307).

  • Python — client.relataclient.schema_alter(type_name, action, column, new_column=None, col_type=None, optional=None)
  • TypeScript — schemaAlter(name, action, column, opts)
  • Go — SchemaAlter(name, action, column)

Parameters: type_name, action, column, new_column=None, col_type=None, optional=None

Example

relata.schema_alter("Company", "add", "lei", col_type="text")

create_link(link_name, source_id, source_type, target_id, target_type)`

  • Python — client.relataclient.create_link(link_name, source_id, source_type, target_id, target_type)
  • TypeScript — createLink(params)
  • Go — CreateLink(params)

Parameters: link_name, source_id, source_type, target_id, target_type

delete_webhook(webhook_id)

delete_webhook(webhook_id)`

  • Python — client.relataclient.delete_webhook(webhook_id)
  • TypeScript — deleteWebhook(id)
  • Go — DeleteWebhook(id)

Parameters: webhook_id

deregister_type(name)

deregister_type(name)`

  • Python — client.relataclient.deregister_type(name)
  • TypeScript — deregisterType(name)
  • Go — DeregisterType(name)

Parameters: name

enrichment_rules(rules)

enrichment_rules(rules)`

  • Python — client.relataclient.enrichment_rules(rules)
  • TypeScript — enrichmentRules(rules)
  • Go — EnrichmentRules(rules)

Parameters: rules

list_edge_types()

list_edge_types()`

  • Python — client.relataclient.list_edge_types()
  • TypeScript — listEdgeTypes()
  • Go — ListEdgeTypes()

list_modules()

list_modules()`

  • Python — client.relataclient.list_modules()
  • TypeScript — listModules()
  • Go — ListModules()

list_types()

list_types()`

  • Python — client.relataclient.list_types()
  • TypeScript — listTypes()
  • Go — ListTypes()

list_webhooks()

list_webhooks()`

  • Python — client.relataclient.list_webhooks()
  • TypeScript — listWebhooks()
  • Go — ListWebhooks()

ontology_migrate(schema)

ontology_migrate(schema)`

  • Python — client.relataclient.ontology_migrate(schema)
  • TypeScript — ontologyMigrate(schema)
  • Go — OntologyMigrate(schema)

Parameters: schema

register_edge_type(from_type, to_type, label)

register_edge_type(from_type, to_type, label)`

  • Python — client.relataclient.register_edge_type(from_type, to_type, label)
  • TypeScript — registerEdgeType(fromType, toType, label)
  • Go — RegisterEdgeType(fromType, toType, label)

Parameters: from_type, to_type, label

register_webhook(url, event_types=None, secret=None)

register_webhook(url, event_types=None, secret=None)`

  • Python — client.relataclient.register_webhook(url, event_types=None, secret=None)
  • TypeScript — registerWebhook(url, eventTypes, opts)
  • Go — RegisterWebhook(url, eventTypes)

Parameters: url, event_types=None, secret=None

type_detail(name)

type_detail(name)`

  • Python — client.relataclient.type_detail(name)
  • TypeScript — typeDetail(name)
  • Go — TypeDetail(name)

Parameters: name