Gralkor.Ontology (jido_gralkor v4.0.0)

Copy Markdown View Source

Declare an entity-and-relationship ontology for graphiti's custom entity extraction.

A consumer writes:

defmodule MyOntology do
  use Gralkor.Ontology, entities: :strict, relationships: :scoped

  entity User do
    field :handle,   :string, required: true, doc: "stable login handle"
    field :timezone, :string,                  doc: "IANA tz"
  end

  entity Preference do
    field :description, :string, required: true
  end

  from User do
    prefers Preference do
      field :since, :string, doc: "date first observed"
    end
    trusts User
  end
end

The macro produces MyOntology.__ontology__/0 — a payload the Pythonx layer translates into graphiti's entity_types, edge_types, edge_type_map, and excluded_entity_types. The Elixir side never constructs Pydantic classes.

See ex-ontology and ex-ontology-payload in TEST_TREES.md.

Summary

Functions

entity(other, arg2)

(macro)

field(name, type, opts \\ [])

(macro)

from(other, arg2)

(macro)

from_verb_call(verb, target)

(macro)

from_verb_call(verb, target, list)

(macro)