glam/schemas/20251121/examples/validation_tests/invalid_bidirectional_violation.yaml
kempersc 67657c39b6 feat: Complete Country Class Implementation and Hypernyms Removal
- Created the Country class with ISO 3166-1 alpha-2 and alpha-3 codes, ensuring minimal design without additional metadata.
- Integrated the Country class into CustodianPlace and LegalForm schemas to support country-specific feature types and legal forms.
- Removed duplicate keys in FeatureTypeEnum.yaml, resulting in 294 unique feature types.
- Eliminated "Hypernyms:" text from FeatureTypeEnum descriptions, verifying that semantic relationships are now conveyed through ontology mappings.
- Created example instance file demonstrating integration of Country with CustodianPlace and LegalForm.
- Updated documentation to reflect the completion of the Country class implementation and hypernyms removal.
2025-11-23 13:09:38 +01:00

134 lines
5.4 KiB
YAML

---
# Invalid LinkML Instance - Bidirectional Relationship Violation
# ❌ This example demonstrates violations of Rule 2 (Collection-Unit Bidirectional)
# and Rule 5 (Staff-Unit Bidirectional).
#
# Expected validation errors:
# - Collection references managing unit, but unit doesn't reference collection back
# - Staff member references employing unit, but unit doesn't reference staff back
id: https://w3id.org/heritage/custodian/example/invalid-bidirectional
name: Bidirectional Violation Museum
description: >-
A fictional museum with missing inverse relationships. This example
intentionally violates bidirectional consistency rules.
# Custodian Aspect
custodian_aspect:
class_uri: cpov:PublicOrganisation
name: Bidirectional Violation Museum
valid_from: "2000-01-01"
valid_to: null
has_legal_form:
id: https://w3id.org/heritage/custodian/example/legal-form-003
legal_form_code: "3000"
name: Museum Foundation
valid_from: "2000-01-01"
valid_to: null
# Organizational Structure
organizational_structure:
- id: https://w3id.org/heritage/custodian/example/curatorial-dept-003
class_uri: org:OrganizationalUnit
name: Curatorial Department
unit_type: DEPARTMENT
valid_from: "2000-01-01"
valid_to: null
part_of_custodian: https://w3id.org/heritage/custodian/example/invalid-bidirectional
# ❌ VIOLATION: Missing manages_collections property
# This unit should list the collections it manages, but doesn't
# manages_collections: [] ← Should reference paintings-collection
- id: https://w3id.org/heritage/custodian/example/research-dept-003
class_uri: org:OrganizationalUnit
name: Research Department
unit_type: DEPARTMENT
valid_from: "2000-01-01"
valid_to: null
part_of_custodian: https://w3id.org/heritage/custodian/example/invalid-bidirectional
# ❌ VIOLATION: Missing employs_staff property
# This unit should list the staff it employs, but doesn't
# employs_staff: [] ← Should reference researcher-001
# Collections Aspect - Forward reference exists, but NO inverse
collections_aspect:
# ❌ VIOLATION: Collection → Unit exists, but Unit → Collection missing
# Rule 2: Bidirectional consistency between collection and unit
- id: https://w3id.org/heritage/custodian/example/paintings-collection-003
collection_name: Orphaned Paintings Collection
collection_type: MUSEUM_OBJECTS
valid_from: "2002-06-15"
valid_to: null
managed_by_unit:
- https://w3id.org/heritage/custodian/example/curatorial-dept-003 # ✓ Forward ref
subject_areas:
- Contemporary Art
temporal_coverage: "1950-01-01/2020-12-31"
extent: "100 artworks"
violation_note: >-
This collection correctly references its managing unit (curatorial-dept-003),
but that unit does NOT reference this collection back in its
manages_collections property. This violates bidirectional consistency.
# Staff Aspect - Forward reference exists, but NO inverse
staff_aspect:
# ❌ VIOLATION: Staff → Unit exists, but Unit → Staff missing
# Rule 5: Bidirectional consistency between staff and unit
- id: https://w3id.org/heritage/custodian/example/researcher-001-003
person_observation:
class_uri: pico:PersonObservation
observed_name: Charlie Orphan
role: Senior Researcher
valid_from: "2005-01-15"
valid_to: null
employed_by_unit:
- https://w3id.org/heritage/custodian/example/research-dept-003 # ✓ Forward ref
violation_note: >-
This staff member correctly references their employing unit
(research-dept-003), but that unit does NOT reference this staff member
back in its employs_staff property. This violates bidirectional consistency.
# Expected Validation Errors:
#
# 1. Collection "Orphaned Paintings Collection":
# - collection.managed_by_unit: [curatorial-dept-003] ✓ Forward ref exists
# - unit.manages_collections: (missing/empty) ✗ Inverse ref missing
# - ERROR: Collection references unit, but unit doesn't reference collection
#
# 2. Staff "Charlie Orphan":
# - staff.employed_by_unit: [research-dept-003] ✓ Forward ref exists
# - unit.employs_staff: (missing/empty) ✗ Inverse ref missing
# - ERROR: Staff references unit, but unit doesn't reference staff
#
# Technical Note:
# In LinkML/RDF, bidirectional relationships should be symmetric:
# - If A → B exists, then B → A must exist
# - In W3C Org Ontology: org:hasUnit ↔ org:unitOf
# - In our schema: managed_by_unit ↔ manages_collections
# employed_by_unit ↔ employs_staff
# Provenance
provenance:
data_source: EXAMPLE_DATA
data_tier: TIER_4_INFERRED
extraction_date: "2025-11-22T15:00:00Z"
extraction_method: "Manual creation for validation testing (intentionally invalid)"
confidence_score: 0.0
notes: >-
This is an INVALID example demonstrating bidirectional relationship violations.
It should FAIL validation with 2 errors (1 collection violation, 1 staff violation).
The organizational units are missing inverse relationship properties:
- curatorial-dept-003 should have manages_collections: [paintings-collection-003]
- research-dept-003 should have employs_staff: [researcher-001-003]
locations:
- city: Bidirectional City
country: XX
latitude: 50.0
longitude: 10.0
identifiers:
- identifier_scheme: EXAMPLE_ID
identifier_value: MUSEUM-INVALID-BIDIRECTIONAL
identifier_url: https://example.org/museums/invalid-bidirectional