glam/.opencode/rules/linkml/slot-noun-singular-convention.md
kempersc 6e63465196 Add ImageTilingServiceEndpoint class and archive ID class
- Introduced the ImageTilingServiceEndpoint class for tiled high-resolution image delivery, including deep-zoom and transformation capabilities, with multilingual descriptions and structured aliases.
- Archived the ID class as a backwards-compatible alias for Identifier, marking it as deprecated to enforce the use of the canonical Identifier model.
2026-02-15 21:40:13 +01:00

2.7 KiB

Rule: Slot Nouns Must Be Singular

🚨 CRITICAL: LinkML slot names MUST use singular nouns, even for multivalued slots. The multivalued: true property indicates cardinality, not the slot name.

Rationale

  1. Predicate semantics: Slots represent predicates/relationships. In RDF, hasCollection can have multiple objects without changing the predicate name.
  2. Consistency: Singular names work for both single-valued and multivalued slots.
  3. Ontology alignment: Standard ontologies use singular predicates (skos:broader, org:hasMember, rico:hasOrHadHolder).
  4. Readability: custodian.has_or_had_custodian_type reads naturally as "custodian has (or had) custodian type".

Correct Pattern

slots:
  has_or_had_custodian_type:        # ✅ CORRECT - singular noun
    slot_uri: org:classification
    range: CustodianType
    multivalued: true               # Cardinality expressed here, not in name

  has_or_had_collection:            # ✅ CORRECT - singular noun
    slot_uri: rico:hasOrHadPart
    range: CustodianCollection
    multivalued: true
    
  has_or_had_member:                # ✅ CORRECT - singular noun
    slot_uri: org:hasMember
    range: Custodian
    multivalued: true

Incorrect Pattern

slots:
  has_or_had_custodian_types:       # ❌ WRONG - plural noun
    multivalued: true
    
  collections:                       # ❌ WRONG - plural noun
    multivalued: true
    
  members:                           # ❌ WRONG - plural noun
    multivalued: true

Migration Examples

Old (Plural) New (Singular)
custodian_types has_or_had_custodian_type
collections has_or_had_collection
identifiers identifier
alternative_names alternative_name
staff_members staff_member

Exceptions

Compound concepts where the plural is part of the concept name itself:

  • archives_regionales - French administrative term (proper noun)
  • united_states - Geographic proper noun

NOT exceptions (still use singular):

  • has_or_had_identifier not has_or_had_identifiers (even if institution has multiple)
  • broader_type not broader_types (even if multiple broader types)

Implementation

When creating or renaming slots:

  1. Extract the noun from the slot name
  2. Convert to singular form
  3. Combine with relationship prefix (has_or_had_, is_or_was_, etc.)
  4. Set multivalued: true if multiple values are expected

See Also

  • .opencode/rules/slot-naming-convention-current-style.md - Current slot naming patterns
  • .opencode/rules/slot-centralization-and-semantic-uri-rule.md - Slot centralization requirements