Skip to content

validate-schema: extend term-label validation to slots and classes (slot_uri, class_uri, *_mappings) #43

Description

@cmungall

Summary

validate-schema currently validates the meaning field of enum permissible values only. It would be valuable to apply the same ontology-label consistency check to slots and classes — i.e. slot_uri, class_uri, and the mapping slots (exact_mappings, close_mappings, related_mappings, narrow_mappings, broad_mappings).

Current behavior (v0.3.0)

EnumValidator.validate_schema() iterates enums only:

all_enums = schema_view.all_enums()
for enum_name in all_enums:
    ...
    issues = self.validate_enum(enum_def, enum_name)

validate_enum then checks, for each PV with a meaning, that the ontology term's label matches one of the PV's own strings (text / title / description / aliases / annotations).

There is no equivalent for slots or classes. A schema can map a slot via slot_uri: ENVO:00001998 or exact_mappings: [MIXS:0000011], or a class via class_uri, and those CURIEs are never checked — they could be nonexistent, obsolete, or label-inconsistent with the element name, and validate-schema stays green.

Why it matters

We generate per-study LinkML "data dictionary" profiles in which every slot carries slot_uri / exact_mappings to MIxS / BERVO / ENVO terms, while only categorical levels become enums. validate-schema vets the enum-PV groundings beautifully — it caught a real mis-grounding for us (meaning: NCBITaxon:62324, which is Anopheles funestus, not Miscanthus). But the much larger set of slot-level mappings is entirely unvetted, so the strongest correctness signal doesn't cover most of the schema.

Proposed enhancement

In validate-schema, additionally iterate schema_view.all_slots() and schema_view.all_classes() and validate:

  • slot_uri / class_uri
  • exact_mappings, close_mappings, related_mappings, narrow_mappings, broad_mappings

For each, confirm the CURIE resolves in a configured ontology. A label-vs-name check is reasonable but should probably be looser than for enum PVs, since a mapping isn't an exact identity. Suggested defaults:

  • error on unresolvable / obsolete CURIEs for configured prefixes (mirrors the enum behavior),
  • warn / info on label mismatch (configurable, off by default for related/narrow/broad).

Related observation (matching is element-side only)

For PVs, the match is: ontology primary label ∈ {PV text, title, description, aliases, structured_aliases, select annotations}. The ontology term's own synonyms are not consulted, so a legitimate common-name grounding fails unless the user adds the ontology label as a PV alias — e.g. switchgrassNCBITaxon:38727 ("Panicum virgatum") fails until Panicum virgatum is added as an alias. Optionally consulting the adapter's exact/related synonyms would reduce that friction. Mentioning here for context; happy to split into a separate issue.

Environment: linkml-term-validator 0.3.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions