glam/SESSION_SUMMARY_20251121_TIMESPAN_INTEGRATION.md
2025-11-21 22:12:33 +01:00

7 KiB

TimeSpan Schema Integration - Summary

Date: November 21, 2025

Problem Statement

The TimeSpan class was orphaned in the schema:

  • Defined in modules/classes/TimeSpan.yaml with CIDOC-CRM E52 fuzzy temporal boundaries
  • The temporal_extent slot existed but was not assigned to any class
  • No class relationships to TimeSpan were visible in UML diagrams

Solution Implemented

1. CustodianReconstruction ← TimeSpan

Added: temporal_extent slot to CustodianReconstruction

Location: schemas/20251121/linkml/modules/classes/CustodianReconstruction.yaml

Purpose: Model uncertain founding/dissolution dates for heritage institutions

Example Use Case:

temporal_extent:
  begin_of_the_begin: "1800-01-01"  # Earliest possible founding
  end_of_the_begin: "1805-12-31"    # Latest possible founding
  begin_of_the_end: "1950-01-01"    # Earliest possible closure
  end_of_the_end: "1955-12-31"      # Latest possible closure

When to Use:

  • Founding date is uncertain: "established sometime between 1800-1805"
  • Closure date is approximate: "closed around 1950"
  • For precise legal dates, use registration_date/dissolution_date instead

2. CustodianName ← TimeSpan

Added: name_validity_period slot to CustodianName

Location: schemas/20251121/linkml/modules/classes/CustodianName.yaml

Purpose: Model uncertain name adoption/change dates

Example Use Case:

name_validity_period:
  begin_of_the_begin: "1920-01-01"  # Name adopted sometime in the 1920s
  end_of_the_begin: "1929-12-31"
  begin_of_the_end: "1945-01-01"    # Name changed around 1950
  end_of_the_end: "1955-12-31"

When to Use:

  • Name adoption date is uncertain: "name adopted sometime in the 1920s"
  • Name change date is approximate: "renamed around 1950"
  • For precise name validity dates, use valid_from/valid_to instead

3. New Slot Definition

Created: modules/slots/name_validity_period.yaml

Slot URI: crm:P4_has_time-span

Range: TimeSpan


4. Schema Imports Updated

CustodianReconstruction.yaml:

imports:
  - TimeSpan  # Added

CustodianName.yaml:

imports:
  - TimeSpan  # Added

UML Diagram Updates

Mermaid ER Diagram

Generated: schemas/20251121/uml/mermaid/custodian_name_v5.mmd

New Relationships:

CustodianReconstruction ||--|o TimeSpan : "temporal_extent"
CustodianName ||--|o TimeSpan : "name_validity_period"

Cardinality: ||--|o = One-to-zero-or-one (optional)


PlantUML Class Diagram

Generated: schemas/20251121/uml/mermaid/custodian_name_v4.puml

New Relationships:

CustodianReconstruction "1" --> "0..1" TimeSpan : temporal_extent
CustodianName "1" --> "0..1" TimeSpan : name_validity_period

New Generator Script

Created: scripts/generate_mermaid_modular.py

Purpose: Generate Mermaid ER diagrams from modular LinkML schemas (workaround for gen-erdiagram bug with linkml:types imports)

Usage:

python scripts/generate_mermaid_modular.py schema.yaml [output.mmd]

Features:

  • Uses SchemaView (same as PlantUML generator)
  • Handles modular imports correctly
  • Generates proper Mermaid ER diagram syntax with cardinality

CIDOC-CRM E52 Time-Span Pattern

TimeSpan uses the CIDOC-CRM E52 fuzzy temporal boundaries pattern with four datetime properties:

Property CIDOC Property Description
begin_of_the_begin crm:P82a_begin_of_the_begin Earliest possible start time (outer bound)
end_of_the_begin crm:P81a_end_of_the_begin Latest possible start time (inner bound)
begin_of_the_end crm:P81b_begin_of_the_end Earliest possible end time (inner bound)
end_of_the_end crm:P82b_end_of_the_end Latest possible end time (outer bound)

Precision Cases:

  1. Precise date: Set begin_of_the_begin == end_of_the_begin
  2. Unknown start: Set begin_of_the_begin to earliest plausible date
  3. Ongoing/present: Leave end_of_the_end as null
  4. Uncertain range: Use full four-property range

Schema Design Rationale

Why Two Temporal Slots?

CustodianReconstruction:

  • registration_date / dissolution_date (precise legal dates)
  • temporal_extent (fuzzy operational dates)

CustodianName:

  • valid_from / valid_to (precise validity dates)
  • name_validity_period (fuzzy validity dates)

Rationale:

  • Legal/formal dates are often precise (registration certificates, gazette notices)
  • Operational/social facts are often uncertain ("museum founded around 1850")
  • Both patterns coexist in heritage data - schema supports both

Files Modified

  1. schemas/20251121/linkml/modules/classes/CustodianReconstruction.yaml

    • Added temporal_extent slot
    • Added TimeSpan import
    • Added slot_usage documentation
  2. schemas/20251121/linkml/modules/classes/CustodianName.yaml

    • Added name_validity_period slot
    • Added TimeSpan import
    • Added slot_usage documentation
  3. schemas/20251121/linkml/modules/slots/name_validity_period.yaml (NEW)

    • Created new slot definition
  4. scripts/generate_mermaid_modular.py (NEW)

    • Created Mermaid ER diagram generator

Verification

Schema Load Test

$ linkml-validate -s schemas/20251121/linkml/01_custodian_name_modular.yaml
✅ Schema valid

Diagram Generation Test

$ python scripts/generate_plantuml_modular.py schemas/20251121/linkml/01_custodian_name_modular.yaml
✅ Generated: custodian_name_v4.puml (5937 bytes)

$ python scripts/generate_mermaid_modular.py schemas/20251121/linkml/01_custodian_name_modular.yaml
✅ Generated: custodian_name_v5.mmd (3042 bytes)

TimeSpan Relationship Check

$ rg "TimeSpan" schemas/20251121/uml/mermaid/custodian_name_v5.mmd
CustodianReconstruction ||--|o TimeSpan : "temporal_extent"
CustodianName ||--|o TimeSpan : "name_validity_period"

Next Steps

  1. RDF Generation: Regenerate OWL/Turtle files with new TimeSpan relationships

    gen-owl -f ttl schemas/20251121/linkml/01_custodian_name_modular.yaml > schemas/20251121/rdf/01_custodian_name.owl.ttl
    
  2. Example Instances: Create example YAML instances using temporal_extent and name_validity_period

  3. Documentation Update: Update docs/SCHEMA_MODULES.md to document TimeSpan usage patterns

  4. TypeDB Schema: Update TypeDB schema to include TimeSpan relations (manual translation)


References


Author Notes

Implemented by: OpenCODE AI Agent
Date: November 21, 2025
Context: Fixing orphaned TimeSpan class per user request
Status: Complete - TimeSpan now integrated with CustodianReconstruction and CustodianName