glam/docs/schema_architecture.txt
2025-11-19 23:25:22 +01:00

129 lines
7.3 KiB
Text

================================================================================
Heritage Custodian Schema - Modular Architecture (v0.2.0)
================================================================================
┌─────────────────────────────────┐
│ heritage_custodian.yaml │
│ (Main Schema - 62 lines) │
│ │
│ Imports all modules below │
└────────────┬────────────────────┘
┌───────────────┼───────────────┬─────────────────┐
│ │ │ │
▼ ▼ ▼ ▼
┌────────────────┐ ┌────────────────┐ ┌──────────────┐ ┌─────────────┐
│ enums.yaml │ │ core.yaml │ │ provenance │ │ collections │
│ (241 lines) │ │ (494 lines) │ │ .yaml │ │ .yaml │
│ │ │ │ │ (237 lines) │ │ (177 lines)│
│ 7 Enumerations │ │ 5 Core Classes │ │ 3 Provenance │ │ 3 Collection│
│ │ │ │ │ Classes │ │ Classes │
└────────────────┘ └────────────────┘ └──────────────┘ └─────────────┘
│ │ │ │
│ │ │ │
▼ ▼ ▼ ▼
┌────────────────┐ ┌────────────────┐ ┌──────────────┐ ┌─────────────┐
│InstitutionType │ │HeritageCustodian│ │Provenance │ │Collection │
│OrganizationStat│ │Location │ │GHCIDHistory │ │DigitalPlatfm│
│DataSource │ │ContactInfo │ │ChangeEvent │ │Partnership │
│DataTier │ │Identifier │ │ │ │ │
│MetadataStandard│ │OrgUnit │ │ │ │ │
│PlatformType │ │ │ │ │ │ │
│ChangeType │ │ │ │ │ │ │
└────────────────┘ └────────────────┘ └──────────────┘ └─────────────┘
┌─────────────────────┐
│ dutch.yaml │
│ (142 lines) │
│ │
│ Country-specific │
│ extension module │
└─────────────────────┘
┌─────────────────────┐
│DutchHeritageCustod. │
│ extends: │
│ HeritageCustodian │
│ │
│ + kvk_number │
│ + gemeente_code │
│ + provincie │
│ + platform flags │
└─────────────────────┘
================================================================================
Future Extensions (Planned)
================================================================================
More country modules following the dutch.yaml pattern:
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ brazil.yaml │ │vietnam.yaml │ │ japan.yaml │
│ (planned) │ │ (planned) │ │ (planned) │
│ │ │ │ │ │
│BrazilianHC │ │VietnameseHC │ │JapaneseHC │
│ + cnpj │ │ + mst_code │ │ + nacsis_cat │
│ + ibram_reg │ │ + archives │ │ + isil_jp │
└──────────────┘ └──────────────┘ └──────────────┘
================================================================================
Module Dependency Graph
================================================================================
enums.yaml [no dependencies]
core.yaml [imports: enums]
├────────────┐
│ │
provenance.yaml collections.yaml [imports: enums, core]
↑ ↑
└────┬───────┘
dutch.yaml [imports: core]
heritage_custodian.yaml [imports: all modules]
================================================================================
Usage Patterns
================================================================================
1. Full schema (all features):
from linkml_runtime import SchemaView
sv = SchemaView('schemas/heritage_custodian.yaml')
2. Core classes only (minimal):
sv = SchemaView('schemas/core.yaml')
3. Custom subset:
# my_schema.yaml
imports:
- enums
- core
# Omit provenance, collections, dutch
4. Extension development:
# brazil.yaml
imports:
- core
classes:
BrazilianHeritageCustodian:
is_a: HeritageCustodian
================================================================================
Benefits
================================================================================
✓ Modularity - Use only what you need
✓ Clarity - Each module has clear purpose
✓ Maintainability - Changes isolated to specific modules
✓ Extensibility - Easy to add country/domain modules
✓ Compatibility - 100% backward compatible (53 tests pass)
✓ Efficiency - Smaller files, faster IDE loading
================================================================================