Domain Layer

The domain package defines the type system that gives semantic meaning to nodes and edges. It contains no persistence or UI code — only the rules about what shapes of data are valid within a given graph.

Conceptual Model

graph TD
    GT["GraphType (base)"] -->|owns| NS["NodeSchema (per type)"]
    GT -->|owns| ES["EdgeSchema (per type)"]
    NS -->|contains| AF1["AttributeField (required)"]
    NS -->|contains| AF2["AttributeField (optional)"]
    ES -->|contains| AF3["AttributeField"]
    TR["TypeRegistry"] -->|maps name to| GT

A GraphType is a schema document for a graph. It declares:

  • Which node types are valid and what attributes each node must/may carry (NodeSchema).
  • Which edge types are valid, which node types each endpoint may be, and what attributes edges carry (EdgeSchema).

The TypeRegistry holds all registered graph types for the current session.

Modules in this Layer

Module Purpose
domain.graph_type AttributeField, NodeSchema, EdgeSchema, GraphType base class
domain.registry TypeRegistry — maps type_name → GraphType