Skip to content

hygm: ship the generic default model learned ontologies start from - #441

Merged
antejavor merged 2 commits into
mainfrom
feat/431-hygm-default-ontology
Oct 7, 2026
Merged

antejavor merged 2 commits into
mainfrom
feat/431-hygm-default-ontology

Conversation

@antejavor

Copy link
Copy Markdown
Contributor

First build step of map #431, "An ontology that learns from the user's sessions". The content was decided in #436.

What

  • hygm.default_model() loads a packaged default_ontology.yaml:
    • fixed core: User, Person, and the value types Duration, Quantity, Money, Date, TimeWindow;
    • generic layer: Organization, Location, Event;
    • catch-alls: Topic, Artifact;
    • relations: 10 generic user-centred ones, plus 7 value relations, so every value type has at least one relation into it (the gap Run the revised derivation contract: batched propose and consolidate #372 hit).
  • CORE_LABELS, VALUE_LABELS, CATCH_ALL_LABELS: the label sets that derivation (never merges or retires the core) and the adoption gate (measures catch-all share, Grill: the automatic gate that adopts a new model version #435) will read.
  • with_core(model): adds any core type missing from a user-supplied schema, for derive = "extend".

Choices worth a look

  • Artifact is global: a tool or library named in many sessions is one node. The backend's existing guard keeps all-lowercase mentions of a global type per chunk, so generic nouns ("the file") don't become hubs.
  • Topic stays per chunk: as the high-volume catch-all, capitalized subjects would turn into hubs.
  • Unchanged: unstructured2graph's own DEFAULT_ONTOLOGY, as decided in Grill: the default ontology and a user-supplied one #436.
  • Version: hygm stays at 0.1.0; the bump goes with the release, once sessions-graph uses the default.

Tests

hygm/tests/test_default.py checks that:

  • the default passes validate_model();
  • it holds the core and the catch-alls;
  • every value type is per-mention (span) and has a relation into it;
  • every relation constrains both of its endpoints;
  • Artifact is global and Topic per chunk;
  • with_core adds only the missing core types.

All 41 hygm tests pass, and ruff and ty are clean. The YAML is confirmed to ship in the built wheel.

default_model() loads a packaged YAML: the fixed core (User, Person and the
value types Duration, Quantity, Money, Date, TimeWindow), the generic layer
(Organization, Location, Event), and the catch-alls Topic and Artifact, with
generic user-centred relations and at least one relation into every value
type. CORE_LABELS, VALUE_LABELS and CATCH_ALL_LABELS are what derivation and
the adoption gate read; with_core() adds missing core types to a supplied
schema for derive = "extend".

Artifact is global so a tool named in many sessions is one node; Topic stays
per chunk. Decided in #436 (map #431).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant