# Complete Schema Mermaid Diagram - Quick Reference **TL;DR**: We extended LinkML to generate a single comprehensive Mermaid diagram showing the entire schema (53 classes, 149 relationships) instead of 53 individual per-class diagrams. --- ## Quick Start ```bash # Generate complete diagram cd /Users/kempersc/apps/glam python3 scripts/generate_complete_mermaid_diagram.py # Output: schemas/20251121/uml/mermaid/complete_schema_YYYYMMDD_HHMMSS.mmd ``` **View online**: Copy `.mmd` contents to https://mermaid.live/ --- ## What Was Generated **File**: `schemas/20251121/uml/mermaid/complete_schema_20251124_004143.mmd` - ✅ 53 classes - ✅ 149 relationships (42 inheritance, 107 associations) - ✅ 697 lines - ✅ 31 KB --- ## Why This Matters **Before** (LinkML default): - 53 separate `.mmd` files (one per class) - No holistic view of schema architecture - Hard to understand cross-class relationships **After** (this script): - 1 comprehensive diagram - Complete schema overview - All relationships visible - Perfect for presentations, onboarding, ontology consultations --- ## Key Architecture Visualized ### 1. EncompassingBody Hierarchy (NEW!) ``` EncompassingBody (abstract) ├── UmbrellaOrganisation (legal parent) ├── NetworkOrganisation (service provider) └── Consortium (peer-to-peer collaboration) ``` ### 2. Hub Architecture ``` Custodian (hub) ←─── CustodianObservation ├─── CustodianLegalStatus ├─── CustodianName ├─── CustodianPlace ├─── CustodianCollection └─── OrganizationalStructure ``` ### 3. 19 CustodianType Subtypes ``` CustodianType ├── MuseumType ├── LibraryType ├── ArchiveOrganizationType ├── GalleryType ├── OfficialInstitutionType ├── ResearchOrganizationType ├── CommercialOrganizationType ├── UnspecifiedType ├── BioCustodianType ├── EducationalProviderType ├── CollectingSocietyType ├── FeaturePlaceType ├── IntangibleHeritageType ├── MixedCustodianType ├── PersonalCollectionType ├── HolySiteType ├── DigitalPlatformType ├── NonProfitType └── TasteScentHeritageType ``` --- ## When to Use What | Use Case | Tool | |----------|------| | **Schema overview** | Complete diagram (this script) | | **Detailed class docs** | Per-class diagrams (LinkML gen-yuml) | | **Presentations** | Complete diagram → export to SVG | | **Developer reference** | Both (overview + details) | | **Ontology consultation** | Complete diagram (shows all alignments) | --- ## Extending the Script **Change attributes shown per class** (line 72): ```python for slot_name in class_slots[:10]: # Change 10 to 5, 20, etc. ``` **Filter to specific classes** (add after line 69): ```python if class_name not in ['Custodian', 'CustodianObservation', 'EncompassingBody']: continue # Only generate diagram for core classes ``` --- ## Files - **Script**: `scripts/generate_complete_mermaid_diagram.py` - **Output**: `schemas/20251121/uml/mermaid/complete_schema_YYYYMMDD_HHMMSS.mmd` - **Documentation**: `COMPLETE_SCHEMA_MERMAID_GENERATION.md` --- ## See Also - Per-class diagrams: `schemas/20251121/uml/mermaid/auto_generated/` - Markdown docs: `schemas/20251121/docs/20251124_003435/` - RDF output: `schemas/20251121/rdf/` (8 formats)