glam/.opencode/rules/linkml/ontology-detection-rule.md
kempersc 554fe520ea Add comprehensive rules for LinkML schema management and ontology mapping
- Introduced Rule 42: No Ontology Prefixes in Slot Names to enforce clean naming conventions.
- Established Rule: No Rough Edits in Schema Files to ensure structural integrity during modifications.
- Implemented Rule: No Version Indicators in Names to maintain stable semantic naming.
- Created Rule: Ontology Detection vs Heuristics to emphasize the importance of verifying ontology definitions.
- Defined Rule 50: Ontology-to-LinkML Mapping Convention to standardize mapping practices.
- Added Rule: Polished Slot Storage Location to specify directory structure for polished slot files.
- Enforced Rule: Preserve Bespoke Slots Until Refactoring to prevent unintended migrations during slot updates.
- Instituted Rule 56: Semantic Consistency Over Simplicity to mandate execution of revisions in slot_fixes.yaml.
- Added new Genealogy Archives Registry Enrichment class with multilingual support and structured aliases.
2026-02-15 19:20:09 +01:00

1.3 KiB

Rule: Ontology Detection vs Heuristics

Summary

When detecting classes and predicates in data/ontology/ or external ontology files, you must read the actual ontology definitions (e.g., RDF, OWL, TTL files) to determine if a term is a Class or a Property. Do not rely on naming heuristics (like "Capitalized means Class").

Detail

  • Verification: Always read the source ontology file or use a semantic lookup tool to verify the rdf:type of an entity.
    • If rdf:type is owl:Class or rdfs:Class, it is a Class.
    • If rdf:type is rdf:Property, owl:ObjectProperty, or owl:DatatypeProperty, it is a Property.
  • Avoid Heuristics: Do not assume that skos:Concept is a class just because it looks like one (it is), or that schema:name is a property just because it's lowercase. Many ontologies have inconsistent naming conventions (e.g., schema:Person vs foaf:Person).
  • Strictness: If the ontology file is not available locally, attempt to fetch it or consult authoritative documentation before guessing.

Violation Examples

  • Assuming ex:MyTerm is a class because it starts with an uppercase letter without checking the .ttl file.
  • Mapping a LinkML slot to schema:Thing (a Class) instead of a Property because you guessed based on the name.