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
| Property | Value |
|---|---|
| Language | Python 3.11 |
| Framework | FastAPI + Strawberry (GraphQL) |
| Port | 8101 |
| Namespace | matih-data-plane |
| Storage | Dgraph (graph store), PostgreSQL (metadata) |
| Source code | data-plane/ontology-service/src/ |
Sub-Pages
| Page | Description |
|---|---|
| Object Types | Domain object definitions and property models |
| Datasource Mapping | Physical-to-logical schema mapping |
| Schema Validation | Ontology validation and consistency checks |
| GraphQL API | Strawberry GraphQL schema and resolvers |
| Ontology Templates | Pre-built ontology templates by industry |
| API Reference | Complete 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 repositoryKey Concepts
| Concept | Description |
|---|---|
| Object Type | A domain entity (e.g., Customer, Order, Product) with typed properties |
| Property | A field on an object type with data type, validation, and governance metadata |
| Relationship | A typed link between two object types with cardinality |
| Datasource Mapping | Configuration that maps a physical table/column to a logical object type/property |
| Ontology Template | A pre-built set of object types for a specific industry vertical |