MATIH Platform is in active MVP development. Documentation reflects current implementation status.
11. Pipelines & Data Engineering
Ontology Service
Architecture

Ontology Service Architecture

The Ontology Service is a Python/FastAPI application that manages the semantic data model for the MATIH platform. It defines object types, their properties, relationships, and mappings to physical data sources. The service provides both REST and GraphQL APIs and stores ontology definitions in Dgraph.


Service Overview

PropertyValue
LanguagePython 3.11
FrameworkFastAPI + Strawberry (GraphQL)
Port8101
Namespacematih-data-plane
StorageDgraph (graph store), PostgreSQL (metadata)
Source codedata-plane/ontology-service/src/

Sub-Pages

PageDescription
Object TypesDomain object definitions and property models
Datasource MappingPhysical-to-logical schema mapping
Schema ValidationOntology validation and consistency checks
GraphQL APIStrawberry GraphQL schema and resolvers
Ontology TemplatesPre-built ontology templates by industry
API ReferenceComplete REST API documentation

Component Layout

ontology-service/src/
  api/
    routes/
      objects.py         -- Object type CRUD
      ontology.py        -- Ontology management
      schema_mapping.py  -- Datasource mapping endpoints
      templates.py       -- Template management
      actions.py         -- Action definitions
    graphql/
      schema.py          -- Strawberry schema definition
      types.py           -- GraphQL type definitions
      resolvers.py       -- Query and mutation resolvers
  models/
    object_type.py       -- Domain models (Pydantic)
    enums.py             -- Enumeration types
  schema_mapping/
    analyzer.py          -- Schema analysis engine
    mapper.py            -- Physical-to-logical mapper
    models.py            -- Mapping models
  templates/
    registry.py          -- Template registry
    deployer.py          -- Template deployment
    models.py            -- Template models
  storage/
    dgraph/
      client.py          -- Dgraph client
      repository.py      -- Graph repository
      migration.py       -- Schema migration
    database.py          -- PostgreSQL connection
    repository.py        -- Metadata repository

Key Concepts

ConceptDescription
Object TypeA domain entity (e.g., Customer, Order, Product) with typed properties
PropertyA field on an object type with data type, validation, and governance metadata
RelationshipA typed link between two object types with cardinality
Datasource MappingConfiguration that maps a physical table/column to a logical object type/property
Ontology TemplateA pre-built set of object types for a specific industry vertical