Skip to content

Load .shacl.ttl and .skos.ttl as SHACL and SKOS; fail duplicate LinkML class names - #189

Merged
yohei1126 merged 1 commit into
mainfrom
fix/188-shacl-skos-linkml-dup-class
Dec 2, 2026
Merged

yohei1126 merged 1 commit into
mainfrom
fix/188-shacl-skos-linkml-dup-class

Conversation

@yohei1126

Copy link
Copy Markdown
Collaborator

Closes #188

Why

A typical SHACL or SKOS Turtle file was not loaded by the SHACL or SKOS adapter. The Turtle/OWL probe runs first and claimed any path ending in .ttl, so a .shacl.ttl file loaded as turtle_owl without SHACL constraint extraction, and a .skos.ttl file loaded as turtle_owl without Concept and broader / narrower / related. A .skos.ttl file that only declared skos:Concept and skos:broader succeeded with 0 classes and 0 relationships.

Separately, a LinkML file that declared the same class name twice succeeded with only the last declaration, because the repeated YAML key was collapsed before the structural check could see it.

Done when

  • A SHACL Turtle file whose path ends in .shacl.ttl loads as SHACL, not as Turtle/OWL.
  • A SKOS Turtle file whose path ends in .skos.ttl loads as SKOS, not as Turtle/OWL. A file that only declares skos:Concept and skos:broader does not succeed with 0 classes and 0 relationships.
  • An OWL/Turtle file that is not SHACL or SKOS still loads as Turtle/OWL. examples/manufacturing.owl.ttl still loads.
  • When those SHACL and SKOS files load, the structural check still runs. A genuine undeclared class, duplicate class name, or duplicate relationship name still fails load and names the offender.
  • A LinkML file that declares the same class name twice fails load and names that class. It does not succeed with only the last declaration.
  • Committed examples still load: examples/manufacturing.native.yaml, examples/part_usage.native.yaml, examples/movies.native.yaml, examples/plm/plm.native.yaml, examples/manufacturing.linkml.yaml, examples/manufacturing.obo, examples/manufacturing.jsonld, and examples/manufacturing.owl.ttl.
  • The structural check still runs for every format load_ontology / load_ontology_from_path can load, with no per-format skip and no weaker check.
  • Local tests cover a .shacl.ttl load as SHACL, a .skos.ttl load as SKOS including a concepts-only file, and a LinkML duplicate class name.
  • cargo test --workspace passes. No docs, version, dependency, or workflow changes.

Notes

  • source.format is now shacl for a .shacl.ttl file with prefix declarations, an owl:Class and a sh:NodeShape, and skos for .skos.ttl files. A concepts-only .skos.ttl file now loads with class Concept and relationships broader, narrower, related. examples/manufacturing.owl.ttl still loads as turtle_owl with the same 7 classes and 7 relationships. Adapter probe order is unchanged; only paths ending in .shacl.ttl / .skos.ttl are no longer claimed by Turtle/OWL. Content-based detection for other .ttl paths is unchanged.
  • otg schema on a LinkML file with two Widget keys under classes now exits 1 with error: yaml error: classes: duplicate class name 'Widget' at line 5 column 3. Duplicate slots keys are not changed by this PR.
  • Faults on .shacl.ttl / .skos.ttl paths exit 1 with validation error: undeclared class 'Ghost' in to_class of relationship 'has_ghost', duplicate class name 'Widget', and duplicate relationship name 'linked'.
  • cargo test --workspace: 169 passed, 0 failed (157 on main). cargo clippy --workspace --all-targets -- -D warnings exits 0; the existing unused dependency oxiri manifest warning is unchanged.

@yohei1126

Copy link
Copy Markdown
Collaborator Author

Model: Gemini 4 Argon (gemini-4-argon) (Gemini API)
gemini-batch-head: 6013156
Findings: 0 blocker, 0 major, 0 minor, 0 nit.
Verdict: PASS

@yohei1126
yohei1126 marked this pull request as ready for review December 2, 2026 01:52
@yohei1126
yohei1126 merged commit 3c4266a into main Dec 2, 2026
21 checks passed
@yohei1126
yohei1126 deleted the fix/188-shacl-skos-linkml-dup-class branch December 2, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SHACL and SKOS Turtle files load as Turtle/OWL; a duplicate LinkML class name does not fail

1 participant