Skip to content

feat(gen-owl): honor instantiates on emitted schema resources - #31

Open
jdsika wants to merge 1 commit into
mainfrom
feat/owlgen-permissible-value-instantiates
Open

jdsika wants to merge 1 commit into
mainfrom
feat/owlgen-permissible-value-instantiates

Conversation

@jdsika

@jdsika jdsika commented Oct 2, 2026 •

Copy link
Copy Markdown

2026-10-14: fixed a defect found when combined with #33: without type objects a type is emitted as its XSD datatype (for example xsd:integer), and asserting its instantiates made that datatype an individual, which OWL 2 DL forbids (OWL 2 Structural Specification §2.4, reserved vocabulary). Such assertions are now skipped with a warning; test_instantiates_ignored_on_reserved_vocabulary fails without the fix. The OWLAPI consumer gate passes on the integration branch with it.

Summary

gen-owl ignored explicit instantiates declarations. This PR translates them to rdf:type on the emitted schema resource using one shared mapping for schemas, classes, slots, locally emitted types, enums, and non-literal permissible values.

For example, an enum value with meaning: ex:approved and instantiates: [vocab:Category] emits ex:approved rdf:type vocab:Category. CURIEs expand using the schema's prefixes; absolute IRIs and minted permissible-value IRIs are supported. An enum represented as named individuals retains its own owl:oneOf; the external class is not closed by that enumeration.

Literal permissible values cannot be RDF subjects, so the generator warns that their instantiates declaration cannot be emitted. Existing implements and permissible-value representation settings retain their roles.

Semantics, generality, and option necessity

  • LinkML instantiates is a multivalued URI-or-CURIE relationship applicable to schema elements and permissible values. The implementation follows those declarations and contains no vocabulary-specific lists.
  • LinkML's instantiation guide defines a relationship at the metamodel level: it types the schema element itself, not its ordinary data instances. This change neither inherits slots nor introduces rdfs:subClassOf to the instantiated class.
  • OWL 2's RDF mapping represents class assertions with rdf:type. Where the same IRI is an OWL class or property and an individual, OWL metamodeling/punning keeps those interpretations separate. The change does not claim that every existing generator representation satisfies the full OWL 2 DL profile.
  • No new flag: the author already chose the relationship in the schema. --metaclasses controls automatically added LinkML metamodel types, not whether explicit instantiates declarations are honored.

Cross-generator consistency

gen-rdf and gen-jsonld serialize the schema as metamodel data and retain linkml:instantiates; gen-owl translates the declaration to an ontology membership assertion. A regression test exercises both RDF and OWL generation. JSON Schema and SHACL describe data instances, so applying a schema element's metaclass to those instances would be incorrect. Elements that the OWL generator does not emit, such as standalone subsets, gain no new representation from this change.

The same mapping applies across emitted schema resources. Tests cover both values of metaclasses and type_objects.

The downstream use in OMB #106 declares domain enum values as members of open vocabulary classes. Each enum closes only its own class; this does not turn those external vocabulary classes into closed enums.

Validation

  • OWL generator suite: 110 passed, 3 skipped.
  • Tests cover multiple memberships, absent declarations, warning behavior for literals, explicit/minted IRIs, class/individual punning, enum closure, every emitted element category, and RDF-versus-OWL representation.
  • Combined OWL/RDF/JSON-LD/OWL-CLI suites: 118 passed, 11 skipped.
  • Lock check, pinned Ruff and pre-commit checks, Sphinx HTML build with warnings as errors, and both packages' wheel/sdist builds passed.
  • Rebased onto main bd102062b (2026-10-14): full compiler suite 12,404 passed. CI: see the checks on the current head.

@jdsika jdsika self-assigned this Oct 2, 2026
@jdsika
jdsika force-pushed the feat/owlgen-permissible-value-instantiates branch from d3b8b2d to 7335442 Compare October 5, 2026 07:37
@jdsika jdsika changed the title feat(gen-owl): type a permissible value by the classes it instantiates feat(gen-owl): honor instantiates on emitted schema resources Oct 5, 2026
@jdsika
jdsika force-pushed the feat/owlgen-permissible-value-instantiates branch from 7335442 to fa0010a Compare October 14, 2026 06:30
Translate explicit instantiates declarations to rdf:type on the emitted
schema resource through one shared helper. Apply the mapping consistently
to schemas, classes, slots, types, enums, and non-literal permissible values.
Literal permissible values cannot be RDF subjects and produce a warning.

Membership types the schema element itself, not its ordinary data instances,
and does not become subclass inheritance. Existing enum representation and
OWL class/individual punning remain intact. No additional flag is needed
because the schema already declares the relationship.

Cover CURIEs, absolute and minted IRIs, literal values, representation modes,
and the distinction between gen-rdf metamodel serialization and gen-owl
ontology assertions. Document the LinkML and OWL specification references.

A resource in the OWL 2 reserved vocabulary (Structural Specification
section 2.4), such as a type emitted as xsd:integer without type objects,
cannot be an OWL 2 DL individual; its instantiates is not asserted, with
a warning.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
@jdsika
jdsika force-pushed the feat/owlgen-permissible-value-instantiates branch from fa0010a to bbc8680 Compare October 14, 2026 07:42
jdsika added a commit that referenced this pull request Oct 14, 2026
Review update from #31: without type objects a type is emitted as its XSD
datatype, and asserting its instantiates made xsd:integer an individual,
which OWL 2 DL forbids (found by the OWLAPI consumer gate in this branch).

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
jdsika added a commit that referenced this pull request Oct 14, 2026
Review update from #31: without type objects a type is emitted as its XSD
datatype, and asserting its instantiates made xsd:integer an individual,
which OWL 2 DL forbids (found by the OWLAPI consumer gate in this branch).

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
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.

1 participant