Skip to content

feat(gen-owl): emit IRI-valued metadata as IRIs - #33

Open
jdsika wants to merge 1 commit into
mainfrom
feat/owlgen-iri-valued-metadata
Open

jdsika wants to merge 1 commit into
mainfrom
feat/owlgen-iri-valued-metadata

Conversation

@jdsika

@jdsika jdsika commented Oct 2, 2026 •

Copy link
Copy Markdown

Summary

Fixes # — implements the proposal of linkml#3546 ("gen-owl emits rdfs:isDefinedBy and dcterms:license as string literals instead of URIs") and extends it to the ontology header.

gen-owl renders every annotations entry and every string-ranged metadata slot as a literal. For properties whose value is a resource by their own specification that is wrong: an ontology's owl:priorVersion, owl:versionIRI, prov:wasDerivedFrom, dcterms:license or dcterms:conformsTo comes out as "https://...", which tools reading the header can neither dereference nor follow. Before this change there was no way to express these header terms as IRIs at all.

A value of one of the properties below is now emitted as an IRI when it is an absolute IRI or a CURIE with a declared prefix. Every other value, and every other property, keeps its literal.

Properties Why their value is a resource
owl:versionIRI, owl:priorVersion, owl:backwardCompatibleWith, owl:incompatibleWith OWL 2 Structural Specification §3.1, §3.5
rdfs:seeAlso, rdfs:isDefinedBy rdfs:range rdfs:Resource (RDF Schema 1.1 §5.4)
dcterms:license, conformsTo, relation, references, isReferencedBy, hasVersion, isVersionOf, replaces, isReplacedBy, requires, isRequiredBy, source DCMI Metadata Terms relating a resource to another resource
prov:wasDerivedFrom, prov:wasRevisionOf, prov:hadPrimarySource rdfs:range prov:Entity (PROV-O)
id: https://example.org/onto/v2
license: https://www.eclipse.org/legal/epl-2.0/
annotations:
  owl:versionInfo: v2
  owl:priorVersion: ex:onto/v1
  prov:wasDerivedFrom: https://example.org/releases/tag/v2.0.0
<https://example.org/onto/v2> a owl:Ontology ;
    owl:versionInfo "v2" ;
    owl:priorVersion <https://example.org/onto/v1> ;
    prov:wasDerivedFrom <https://example.org/releases/tag/v2.0.0> ;
    dcterms:license <https://www.eclipse.org/legal/epl-2.0/> .
  • Applies to the schema header, classes, slots and permissible values alike: one helper, called from the metaslot loop (the string-ranged license and conforms_to) and from the annotation loop.
  • dcterms:identifier is not listed: DCMI gives it the range rdfs:Literal.

How was this tested?

  • New test_iri_valued_metadata_is_emitted_as_iris: absolute IRI, expanded CURIE, PROV, DCMI as annotations, and license / conforms_to / see_also as metamodel slots.
  • New test_literal_valued_metadata_stays_literal: owl:versionInfo, dcterms:identifier with an IRI-looking value, dcterms:creator, and an IRI-valued property with plain text all keep their literals.
  • pytest tests/linkml/test_generators -m "not kroki" — 1774 passed, 41 skipped, 3 xfailed.
  • Slow-test snapshots regenerated with --with-slow --with-biolink --generate-snapshots. The diff is the intended change only, three lines: meta.owl gets dcterms:license <https://creativecommons.org/publicdomain/zero/1.0/> and dcterms:conformsTo <https://www.rfc-editor.org/rfc/bcp/bcp47.txt>, biolink.owl.ttl gets dct:license <https://creativecommons.org/publicdomain/zero/1.0/>, each previously a string literal.
  • ruff check and ruff format --check (0.11.13) clean.

Areas of uncertainty

  • The property list is curated. It is limited to properties whose specification ranges them over resources. A property outside it keeps literals even when its value is an IRI, as before.
  • A CURIE with an undeclared prefix is a syntactically valid absolute IRI (its prefix reads as a scheme) and is emitted as such. Declaring the prefix gives the expanded form.

Checklist

  • My code follows the contributor guidelines
  • I have added tests that prove my fix/feature works
  • Existing tests pass locally with my changes

AI Assistance

If you used AI tools while preparing this PR, you are still the author and responsible for understanding, verifying, and defending your submission. Please engage with reviewers personally rather than through your agent during feedback and revisions. See our AI Covenant for details.

@jdsika jdsika self-assigned this Oct 2, 2026
gen-owl renders every annotation and every string-ranged metadata slot as a
literal. For properties whose value is a resource by their own specification
that is wrong: an ontology's owl:priorVersion, owl:versionIRI,
prov:wasDerivedFrom, dcterms:license or dcterms:conformsTo comes out as
"https://..." instead of an IRI, so it can be neither dereferenced nor
followed by tools that read the ontology header. There was no way to express
these header terms at all.

A value of one of those properties is now emitted as an IRI when it is an
absolute IRI or a CURIE with a declared prefix; every other value, and every
other property, keeps its literal. The properties are the OWL 2 ontology
properties and owl:versionIRI, rdfs:seeAlso and rdfs:isDefinedBy, the DCMI
terms relating a resource to another resource, and prov:wasDerivedFrom,
prov:wasRevisionOf and prov:hadPrimarySource. dcterms:identifier is left out:
DCMI gives it the range rdfs:Literal.

Refs: linkml#3546
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