Skip to content

chore: refresh ENVITED-X integration with reviewed generator features - #14

Draft
jdsika wants to merge 26 commits into
mainfrom
feat/envited-x-pipeline
Draft

jdsika wants to merge 26 commits into
mainfrom
feat/envited-x-pipeline

Conversation

@jdsika

@jdsika jdsika commented May 7, 2026 •

Copy link
Copy Markdown

Purpose

Feature integration branch for downstream ENVITED-X projects: every fork feature PR at its reviewed head, on upstream main eff06809d (2026-11-25). This PR remains a draft and is not an upstream submission.

Rebuilt 2026-11-25 from upstream main instead of rebased: 18 PRs, cherry-picked as 23 commits (the five gen-owl PRs reviewed on 2026-11-25 keep their review commit next to the original), plus the two integration-only commits. All are signed and signed off, and each keeps its author. The previous head e9f58807d stays reachable as the tag envited-x/2026.11.19.

New since envited-x/2026.11.19: #69, #70, #71, #72 and #73, and #68 at its reviewed head. The other PRs are their 2026-11-25 rebases onto eff06809d with unchanged patches, except #26, whose dependency list now includes upstream's pydantic>=2.14.3.

Snapshot

Tagged as envited-x/2026.11.25 (signed, on 98956883c). This snapshot changes linkml-runtime too (rdf_terms, the canonicalizer), so pin both packages. Pinning only packages/linkml pulls linkml-runtime from PyPI, which fails to import:

linkml-runtime @ git+https://github.com/ASCS-eV/linkml.git@envited-x/2026.11.25#subdirectory=packages/linkml_runtime
linkml[diff-stable] @ git+https://github.com/ASCS-eV/linkml.git@envited-x/2026.11.25#subdirectory=packages/linkml

Carried PRs

Fork PR Head Upstream Feature
#16 f4dd214a8 linkml#3716 (approved) propertyNames from inlined-dict key slot constraints
#29 7aedde058 linkml#4028 class-level boolean expressions alike in SHACL and JSON Schema
#30 fd53c62dc linkml#4169 (approved) range_expression on each value
#34 be3f01b09 linkml#4170 has_member
#19 1307f1b02 linkml#3989 presence-implies-value rules to SHACL-SPARQL
#20 00b21156f linkml#3990 compositional rule translation
#31 72152d6ad linkml#4171 instantiates as rdf:type
#56 b153b82fc linkml#4144 "@version": 1.1 in contexts
#27 f62f6ff2b linkml#3993 deterministic-output docs
#63 c0c0c455d linkml#4246 gen-graphql emits a document that parses
#4 26d3cc8c0 linkml#3446 (draft) --normalize-prefixes
#26 374859cf7 fork only canonicalization delegated to diffable-rdf
#68 2e1982b61 linkml#4260 gen-owl states restrictions on the property a slot is declared as
#69 dba10c144 linkml#4272 gen-owl does not redeclare imported properties without merged imports
#70 917251940 linkml#4273 a condition without a range has the range of the slot it names
#71 833eb0427 linkml#4276 patterns as XML Schema in OWL and for XPath in SHACL; one sh:in
#72 d14debb09 linkml#4279 an enum of literals is a datatype
#73 0d80ae8f9 linkml#4280 the kind of a property comes from all ranges of its slot

Merge order for the upstream series: linkml#3716 → linkml#4168 → linkml#3993 → linkml#4144 → linkml#4171 → linkml#3989 → linkml#3990 → linkml#4028 → linkml#4169 → linkml#4170 → linkml#3446 → linkml#4246; gen-owl: linkml#4260 → linkml#4273, linkml#4272, linkml#4276, linkml#4279 → linkml#4280.

No longer carried:

Integration reconciliation

From earlier rebuilds, unchanged:

New in this rebuild, where the gen-owl and gen-shacl PRs meet. Each item is also needed upstream in whichever PR merges second:

Validation (head 98956883c)

  • tests/linkml and tests/linkml_runtime as CI runs them: 17,539 passed (15,564 + 1,975), 2,283 skipped, 16 xfailed, 268 subtests. Slow tests (--with-slow --with-biolink): 66 passed. The docs build passes.
  • An independent review of the merged code found the two defects fixed above (kinds read in the owner, strings on node values). The open ones are listed under Known limitations.
  • End to end with ontology-management-base (scripts/build_linkml_domain.sh, six domains). envited-x/2026.11.18 reproduces the committed artifacts byte for byte. With this branch:
    • ontology-header is unchanged, and every JSON-LD context and JSON Schema is unchanged.
    • The SHACL patterns are rewritten for XPath. The OWL patterns are XML Schema regexes, and equals_string becomes owl:oneOf.
    • OWL 2 DL violations, per ontology without its imports (ROBOT 1.9.11): openlabel-tagging 658 → 0, envited-x 350 → 280, ositrace 90 → 46, manifest 10 → 1, georeference 0 → 0. The only new kind, "undeclared annotation property" (dcterms:title, …), comes from [mirror] fix(owlgen): do not redeclare imported properties without merged imports #69: these are declared in the imported ontology-header and manifest.
  • CI on this branch: 19 passed, 1 skipped (the Docker image build, which is conditional). This covers the full test matrix on ubuntu and windows, Slow Tests, Notebook Tests, the docs build, test-rustgen, the OWLAPI gate and quality-checks.
  • Both packages install from the tag into a fresh environment (Python 3.12), and gen-owl and gen-shacl run on them.

Known limitations

  • Behaviour changes that matter downstream, carried from earlier snapshots:
    • A bare equals_string rule precondition reads "every value".
    • An optional slot with has_member is required in JSON Schema.
    • range_expression is enforced per value in both SHACL and JSON Schema.
    • Contexts declare JSON-LD 1.1.
    • Slots used as OWL annotations must declare implements: [owl:AnnotationProperty].
    • With --normalize-prefixes, sdo for https://schema.org/ is written as schema, with a warning.
  • New in this snapshot:
    • Six openlabel-tagging slots range over both literals and nodes (motionAccelerateValue, motionDecelerateValue, motionDriveValue, laneSpecificationDimensionsValue, laneSpecificationLaneCountValue, subjectVehicleSpeedValue). They become object properties without a range, and the six rules that test them are left out, with warnings. Before, gen-owl reported them as "Ambiguous type" and wrote a punned property.
    • Without merged imports, gen-owl no longer redeclares imported properties, so a consumer needs the owl:imports closure.
  • Open defects from the review of this rebuild, none hit by the ENVITED-X schemas. The first, third and fourth are fixed on the PR heads since 2026-11-26 ([mirror] fix(generators): translate patterns for OWL and SHACL, list allowed strings #71 93afca14e, [mirror] fix(owlgen): decide the kind of a property by all ranges of its slot #73 e1cb9e741), not yet in this snapshot; the next rebuild carries them.

@jdsika
jdsika force-pushed the feat/envited-x-pipeline branch 9 times, most recently from a705c35 to 3d3a52a Compare May 12, 2026 16:35
@jdsika
jdsika force-pushed the feat/envited-x-pipeline branch 3 times, most recently from cab84ad to b2b3dba Compare June 10, 2026 19:42
@rmessaou
rmessaou force-pushed the feat/envited-x-pipeline branch from 97e73d0 to ef7ad85 Compare July 8, 2026 09:02
@jdsika jdsika self-assigned this Jul 11, 2026
@jdsika
jdsika force-pushed the feat/envited-x-pipeline branch from 6aa7702 to 233adc3 Compare September 11, 2026 14:23
@jdsika jdsika changed the title chore: consolidated feature branch for ENVITED-X pipeline chore: feature integration branch for the ENVITED-X pipeline Sep 11, 2026
@jdsika
jdsika force-pushed the feat/envited-x-pipeline branch from 233adc3 to b8a388e Compare September 11, 2026 14:44
@jdsika
jdsika force-pushed the feat/envited-x-pipeline branch from 3026d81 to abd2032 Compare October 2, 2026 12:10
@jdsika
jdsika force-pushed the feat/envited-x-pipeline branch from e3081ef to d75f782 Compare October 8, 2026 14:35
@jdsika jdsika changed the title chore: feature integration branch for the ENVITED-X pipeline chore: refresh ENVITED-X integration with reviewed generator features Oct 8, 2026
@jdsika
jdsika force-pushed the feat/envited-x-pipeline branch 2 times, most recently from 0ac558f to 536d6f1 Compare October 14, 2026 07:58
@jdsika
jdsika force-pushed the feat/envited-x-pipeline branch 2 times, most recently from d6ef9ea to 88e3a80 Compare October 23, 2026 13:13
jdsika and others added 23 commits November 25, 2026 20:28
…L and JSON Schema

gen-shacl ignored a slot's range_expression, and gen-json-schema read it
with the two-valued builder of rules, which ignores cardinalities, the
range of a condition, and the slot_usage and aliases of the value class.

Both generators now read it as a class-level expression: each value must
satisfy it as an instance of the range class satisfies a class-level
expression. In SHACL it is an sh:node next to the range's sh:class. On a
class alternative of any_of it applies to that alternative, and in a
slot condition it takes the form of the condition. SHACL skips an
expression it cannot express with a warning, as it skips a class-level
expression.

gen-json-schema applied the value constraints of a slot inlined as a
dict to the dict instead of to each value, which only a range_expression
showed. The compact forms of such a dict, {id: value} and {id: null},
stay out of its reach.

JSON Schema sees only the identifier of a reference, and a value of a
type or an enum has no slots. On such a value an expression on its slots
is unknown: it holds, and it is not definitely true under a negation.
SHACL checks a reference against its description in the data graph.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
has_member asks for at least one value of a multivalued slot satisfying
an expression. gen-shacl ignored it. gen-json-schema translated it as
contains, which an absent slot passes but an empty one fails, applied
only the value operators of the expression, and ignored it in
class-level expressions.

Both generators now read a member as one value, which must satisfy the
value operators, range and range_expression of the expression. A slot
without a value has no member, so has_member decides presence. In SHACL
it is an sh:qualifiedValueShape with sh:qualifiedMinCount 1; in JSON
Schema, contains on a required slot, or some value of a dict inlined by
key. In a slot condition the member takes the form of the condition.
SHACL skips a has_member it cannot express with a warning, and both
generators warn about one on a slot that is not multivalued.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
The rules-to-SHACL-SPARQL converter recognised two named patterns.  This
adds the presence-implies-value pattern: a precondition asserting
`value_presence: PRESENT` on one slot, and a postcondition constraining
another slot with `equals_string` or `equals_string_in`.  It reads as
"if the guard slot is present, the target slot must be present and hold
one of the allowed values", and generalises the boolean guard to
arbitrary enum values.  The boolean guard becomes the case
`equals_string: "true"` of this pattern on an xsd:boolean-typed flag.

`equals_string` / `equals_string_in` compare strings.  The metamodel
defines them for slots of range string; enums and types with datatype
xsd:string are treated alike, and a slot without a range takes the
schema's default_range.  On an xsd:boolean-typed slot each value must be
a lexical form of xsd:boolean (XML Schema 1.1 Part 2 section 3.3.2.2:
true, false, 1, 0) and denotes that boolean.  A rule applying them to
any other range is skipped with a warning: its RDF values are typed
literals or IRIs that equal no string.  Built-in type names resolve
without importing linkml:types, as in the main slot loop; the built-in
name of `curie` was misspelt there and is corrected.

Values are compared with `=`, spelled out as the disjunction SPARQL 1.1
section 17.4.1.9 defines `IN` to be, so the RDF 1.1-identical plain and
xsd:string literal forms both match and booleans compare by value;
rdflib evaluates `IN` and triple-pattern constants by term identity.
COALESCE turns the type error that RDFterm-equal raises for
incomparable literals into false, so a spec-conformant engine reports
such a value instead of dropping the row.  Queries are DISTINCT and
project ?path (and ?value where there is one), so each result names the
property and the offending value.  A value containing a backslash
followed by "u" or "U" is split with CONCAT, since codepoint escapes are
replaced before a query is parsed.

The exclusive-value pattern takes the precondition `has_member:
{equals_string: V}`, which states "V is one of the values". A bare
`equals_string: V` applies to every value of the slot, as the
specification applies a slot constraint to all members of a collection
and as gen-json-schema reads it, so it no longer matches this pattern:
such a rule is skipped with a warning naming has_member. The pattern
gets the same range check and value comparison, and its
maximum_cardinality > 1 form tests HAVING on the COUNT aggregate:
expressions projected by SELECT are not visible to HAVING (SPARQL 1.1
section 18.2.4.2), so `HAVING (?count > N)` never held and the
constraint never fired.

A rule applies to all members of its class, so a class shape now
carries the rules of its ancestors and mixins, as the JSON Schema
generator applies them.  Each rule is translated in the inheriting
class's context, where slot_usage may refine the slots it references.
Classes sharing a class_uri share one shape, which carries each rule
once.  With `open_world: true` "the postconditions may be omitted in
instance data", so an absent target is no violation.

Skip warnings name the rule by its position and its title, or its
description without one.

A rule whose conditions carry any operator beyond what a pattern
translates, or name an unknown or identifier slot, is skipped rather
than partially translated.  Each problem with a rule is logged once as a
warning naming the declaring class, the rule's position and the class
shapes it affects.  The metadata fields the operator accounting ignores
are derived from the metamodel.  Slot resolution goes through induced
slots, so slot_usage overrides, slot_uri overrides and alias-form keys
resolve to the IRI sh:path emits.

Behaviour changes for existing schemas: an exclusive-value rule with a
bare equals_string precondition is skipped (write has_member:
{equals_string: V}); the boolean guard rejects a string "true" on an
xsd:boolean flag and skips a flag whose type has another datatype IRI
(main compared with str()); exclusive-value rules with
maximum_cardinality > 1 now fire; inherited rules are now enforced on
subclass shapes; problems with rules are logged at WARNING instead of
DEBUG; rule results carry sh:resultPath and sh:value; sh:message follows
the rule's in_language or default_language.

Co-authored-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…ersion

A rule that no named pattern matches is now composed from the operators
it uses: each precondition becomes SPARQL filters on $this, and each
postcondition slot gets its own constraint, the union of the ways to
violate that slot's condition, binding the offending value to ?value
(SHACL sections 5.3.1 and 5.3.2).  A rule P -> A and B is violated
exactly when P and not A, or P and not B, holds.

A condition may use value_presence, required, equals_string,
equals_string_in, equals_number, pattern, minimum_value, maximum_value,
the slot-level any_of, all_of, exactly_one_of and none_of over those
value tests, a range_expression on the slot's class (nested to any
depth) and has_member.  The semantics follow the JSON Schema
generator's if/then:

- presence: value_presence decides, then required, then a default: a
  precondition requires its slot, a postcondition unless the rule is
  open_world, an inner condition of a nested expression never;
- value operators and range_expression apply to every value of the slot
  (05validation.md: "all members"), has_member to some value;
- equals_string(_in) only on string, enum and boolean slots (the named
  patterns' range check); equals_number and the bounds only on the
  numeric datatypes of SPARQL 1.1 section 17.1, guarded with isNumeric,
  and only finite numbers; pattern as REGEX on the value's string form,
  as sh:pattern reads it (SHACL section 4.4.2);
- a value is one term, so each member of a slot-level boolean is true or
  false, and the operators are those of 05validation.md: exactly_one_of
  counts the members that hold.

Any other operator, or a rule with empty pre- or postconditions, skips
the rule with one warning, so a rule is never partially translated.  A
rule skipped part-way no longer reports the notes of the abandoned
translation.

The compliance suite now runs SHACL in the rule tests, and every rule of
test_preconditions and test_preconditions_combos is translated, so each
instance is checked.

The SHACL generator's documentation now describes the translation: the
two named patterns and the composed one with the operators it supports
and one constraint per postcondition slot, the semantics shared with the
JSON Schema generator, inheritance, open_world, --no-emit-rules and the
skip warnings, with a generated example. The rules section of
advanced.md links to the JSON Schema and SHACL generator pages instead of
a dangling "See above for implementation status".

Co-authored-by: jdsika <carlo.van-driesten@vdl.digital>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
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. A value that is neither a CURIE nor an IRI would become a
relative IRI and is skipped with a warning too.

The instantiated class is declared as owl:Class, since OWL 2 DL requires a
declaration for every class a class assertion uses (section 5.8.1).

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
A generated context can use JSON-LD 1.1 constructs: scoped contexts on
enum slots and on class-level range overrides, and @Prefix. A JSON-LD 1.0
processor ignores them silently, so datatype coercions are lost. A context
that uses one now starts with "@Version": 1.1. It makes a JSON-LD 1.0
processor stop (JSON-LD 1.1 section 1.7), and a JSON-LD 1.1 processor then
requires 1.1 processing (JSON-LD 1.1 API section 4.1.2). The generator marks
the three places where it emits such a construct, so no keyword table is
needed, and the declaration follows what the context actually contains:
with --no-model the scoped contexts are left out, with --no-prefixes the
@Prefix entries. A context without a 1.1 construct stays loadable by a
JSON-LD 1.0 processor. gen-jsonld embeds the declaration with the
generated context.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Describe in the gen-owl documentation what RDFC-1.0 canonicalization
guarantees for standard RDF, why its sequential blank-node numbering can
still produce noisy diffs, and that --diff-stable reduces that churn
without guaranteeing minimal diffs. Note that the option also exists on
gen-rdf, gen-shacl and gen-shex --format rdf, and that graphs that are not
standard RDF, such as gen-shacl --include-annotations output with a
non-CURIE annotation tag, are serialized by rdflib with a warning, where
--diff-stable has no effect.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…t names

A generated document failed to parse, or failed schema validation, in eight
independent ways. A class resolving to no slot closed its body immediately,
which GraphQL has no syntax for. A type the schema defined itself was named
by a field but never declared. An enumeration drawing its values from an
ontology was dropped while fields kept naming it; an enum type defines one or
more values (GraphQL spec, October 2021, section 3.9), so such an enumeration
is carried as a custom scalar instead. A type whose name landed on that of a
class or an enumeration was declared alongside it, although every type of a
schema shares one namespace in which a name is unique (section 3.3); such a
name is now left undeclared, with a warning. The list of implemented
interfaces was joined with a comma rather than an ampersand. A linkml:Any
class was declared under its raw name while the fields referring to it used
the camelcased one. A mixin carrying mixins of its own stayed an object type
although other types implemented it. And the set of linkml:Any names lived on
a mutable class attribute shared by every instance, so generating a second
schema in the same process truncated it.

The reference snapshot of the biolink model in this repository did not parse
before this change and parses after it, with no type and no field lost.

The docs gain sections on mixins, types, enumerations and fieldless classes,
and record the gaps left open: no root operation type, names encoded with the
reserved double underscore, interface field covariance, and implements being
derived from mixins alone.

Signed-off-by: jdsika <carlo.van-driesten@bmw.de>
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…mes in generated artifacts

Add an opt-in --normalize-prefixes option that writes the conventional
name of a well-known namespace, e.g. dc for
http://purl.org/dc/elements/1.1/ where a schema declares dce, and writes
the same name in each of the generators that offer it: gen-owl,
gen-shacl, gen-shex, gen-sparql, gen-yarrrml, gen-sssom and
gen-jsonld-context. Only names change; every IRI stays the same.

The names come from two curated sources, the prefixmaps linked_data
context and the names rdflib binds by default, which the RDF generators
serialize with; the two name no namespace differently. prefixmaps'
merged context is not used: it names a namespace after the first
registry in its merge order that lists it, which for W3C vocabularies is
often the upper-cased Bioregistry name, such as ADMS for
http://www.w3.org/ns/adms#.

linkml.generators.common.prefixes computes one plan per schema as a
curies Converter of preferred names with the other names as synonyms. In
each output format a prefix declaration reaches no further than the
document that carries it (Turtle 1.1 2.4, SPARQL 1.1 4.1.1.1, JSON-LD
1.1 3.1, CURIE Syntax 1.0 3), so a declaration in an imported schema
binds nothing in a generated document that does not repeat it. A
conventional name is therefore unavailable for a namespace where the
schema's documents write it for another one: the schema declares it
itself, or only an import declares it and it is in use, meaning that an
element is identified by or mapped to an IRI of that namespace, is
written with the prefix in a CURIE, names it in id_prefixes, or a schema
lists it in emit_prefixes; or nothing declares it and a CURIE,
id_prefixes or emit_prefixes names it all the same. A prefix that only
an import declares and nothing uses holds no name.

linkml:types declares schema for http://schema.org/ and uses it only in
the mappings of its types, which none of these generators writes. A
schema that declares schema for https://schema.org/ next to it is
refused by gen-jsonld-context, gen-shex and gen-sssom, and gen-owl and
gen-shacl then write http://schema.org/ IRIs; so a schema declares
another name, such as sdo, and the option writes schema for
https://schema.org/, which schema.org calls its preferred form in
examples. LinkML's loaders and dumpers keep expanding schema in data as
the import declares it, which the plan reports as a warning. A prefix
keeps its name, with a warning, where two namespaces want the same
conventional name or the name is that of a class, slot or permissible
value, which a JSON-LD context uses as a term.

How a generator applies the plan depends on what its prefixes are. Self-
contained documents (Turtle, RDF/XML, ShExC, SPARQL, YARRRML, SSSOM) use
only the preferred names, as a prefix there only abbreviates IRIs (RDF
1.1 Concepts 1.4); they rename only the prefixes they declare, keep the
order of their declarations, and a prefix that their own CURIEs use
keeps what it denotes, declared or not. A JSON-LD context is shared with
the data written against it, and a compact IRI whose prefix it no longer
defines stops expanding (JSON-LD 1.1 4.1.5), so it keeps every declared
name and adds the preferred one; it writes its own compact IRIs, but not
its keys, with the preferred names, and renames nothing with --no-
prefixes. SchemaLoader-based generators read the plan from a SchemaView
of the schema as given, resolving local imports of YAML text against
base_dir.

gen-sparql renders its queries once to learn which prefixes they use and
keeps the declarations of those it writes as they stand, the named
graphs and the template's own. It resets the caches of its working copy
of the SchemaView: the copy compares equal to the original, so once the
plan had filled the original's caches the copy was served those
elements, and materialization rewrote the input and dropped queries.

gen-prefix-map gives each namespace one name, the schema's, gen-rdf and
gen-jsonld write CURIEs as literal data, and gen-python, gen-pydantic
and gen-namespaces make prefix names part of the generated code, so they
do not offer the option.

test_csv_limit set csv.field_size_limit(20) without restoring it, so any
later test on the same worker that read prefixmaps' CSV data failed; it
now restores the limit.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
The RDF canonicalizer in linkml_runtime was extracted into diffable-rdf,
and the two copies diverged. Calling the library fixes nine defects of
the in-tree copy, each asserted against both entry points in
test_rdf_canonicalize_defects.py:

- a base IRI ending in # no longer rewrites every IRI sharing its prefix
- a shared rdf:List tail is no longer duplicated
- N-Triples refuses a relative IRI instead of writing a file its own
  parser rejects; N-Triples allows only absolute IRIs
- literals containing U+2028 and other line separators survive sorting
- degraded RDF/XML, degraded Turtle and JSON-LD are byte-identical
  across processes
- every format ends with exactly one newline
- a Dataset is refused instead of silently flattened

diffable-rdf becomes a required dependency of linkml-runtime. It needs
only rdflib and pyoxigraph, which the runtime already requires. The
diff-stable extras remain as aliases. Turtle output of the four RDF
generators is unchanged.

The library logs degraded output; the runtime re-emits those records as
RDFCanonicalizationWarning so they stay visible without logging
configuration.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
With --no-use-native-uris gen-owl declares a slot's property under its
slot_uri, but it stated the axioms that come from a slot_usage or
slot_conditions entry, a unique key or a type designator on an IRI
derived from the slot's name. Such an entry names a slot and holds only
what it adds, so it carries no slot_uri. The restrictions of class-level
boolean expressions, of rule and classification-rule conditions, of
range expressions and of slot_usage on an inherited slot, and owl:hasKey
and the type designator's axiom where two classes have an attribute of
the same name, were therefore on properties the ontology does not
declare, such as ex:note where the slot is skos:note, which OWL 2 DL
does not allow (Structural Specification 5.8.1).

These axioms now take the slot_uri of the slot the entry names in the
class it is about: the class that states the expression, the class a
rule's expression names with is_a, or, for a range expression, the class
it names with is_a, else the class the slot ranges over. Two classes
with an attribute of the same name each get their own property. The IRI
derived from a slot's name is computed as before, now also for a slot
named in its underscored form, so with native URIs, the default, the
output changes only for such names.

The annotation-property check for conditions reads the same slot, so a
like-named slot elsewhere no longer decides whether a condition is
refused, and a condition that names an annotation property in its
underscored form is refused, as one that names it as written.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
With --no-mergeimports, gen-owl writes the schema's own elements and an
owl:imports for each import. _declare_annotation_properties (linkml#4158)
declares as an annotation property every predicate outside the reserved
vocabulary that the ontology neither declares nor restricts. Without the
imported slots in the graph, that included the IRI of an imported slot:
dcterms:title for native title metadata, for example, or the tag of an
annotation that an imported metaclass declares. The imported ontology
declares that IRI as an object or data property, so the import closure
declared one IRI as two kinds of property, which OWL 2 DL forbids
(Structural Specification §5.8.1).

Without merged imports, the method now also skips the IRIs of the slots
of the imported schemas, and of the attributes of their classes, that
are not annotation properties: the object and data properties that
add_slot declares when imports are merged, under the IRI it gives them
(_prop_uri). The importing and the imported ontology then together
declare what the merged ontology declares. Nothing changes with
--mergeimports.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
Without merged imports, gen-owl leaves out the annotation-property
declaration of a predicate that is the IRI of an imported object or data
property, as the imported ontology declares it. That holds for an
imported ontology generated with the same options. A linkml: import is
not one: it names an ontology the LinkML metamodel publishes. With
--no-use-native-uris, a schema that imports linkml:meta therefore left
dcterms:title, skos:definition and skos:inScheme undeclared, as the
metamodel maps its slots to them, while the published meta.owl.ttl uses
native URIs and declares none of them. OWL 2 DL requires a declaration
for each (Structural Specification 5.8.1).

The slots of linkml: imports are now left out of that rule, as as_graph
already leaves linkml:types out of owl:imports.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
A slot_usage or slot_conditions entry names a slot and holds only what
it adds, such as required: true. Where it set no range, gen-owl
restricted the slot to the schema's default_range, or to owl:Thing in a
schema without one, not to the range of the slot it names. With
default_range: string, a condition on a float slot became
owl:allValuesFrom xsd:string, which no float value satisfies, as the
value spaces of xsd:string and xsd:float are disjoint. On an
enum-ranged slot, an object property, the restriction had a data range,
which OWL 2 DL does not allow (Structural Specification 5.8.1). A slot
in a class's slots whose range comes from its parent slot (is_a) was
restricted the same way.

The filler is now the range of the slot that the entry names in the
class the condition is about, the class that also gives its slot_uri:
the range the class or an ancestor refines in slot_usage, the range of
its attribute, or the range the slot inherits. Where that slot has no
range, the default_range applies as before. A type whose values are
nodes rather than literals, such as uri without type_objects, has no
datatype to restrict to; for it, too, the default_range applies as
before, since xsd:anyURI would contradict a global range xsd:string.

In a schema without a default_range, gen-owl declares a slot without a
range of its own as an object or a data property by the kinds of the
fillers of its restrictions. There the fallback now records the kind of
the range it takes from the named slot, so such a slot is declared the
same kind of property as the slot it inherits its range from, where it
was guessed to be an object property. With a default_range, which then
declares the slot, the fallback records nothing, as before.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…d slot

Whether a condition's filler is a class or a data range was read from
the global slot of the entry's name, which a name in its underscored form
does not find. A condition on a uriorcurie slot written that way, such as
exact_mappings in the any_of of UnitOfMeasure in the metamodel's units
schema, then took the default_range: an xsd:string filler on an object
property, which OWL 2 DL does not allow (Structural Specification 5.8.1).
The kind is now read from the slot the name stands for.

With skip_vacuous_local_range_axioms, a restriction to the range a slot
inherits from its parent slot is vacuous: the parent's rdfs:range
declares it for the slot through rdfs:subPropertyOf. The check compared
the filler with the slot's own range only, so the restrictions that now
have the inherited range were kept; it now uses the slot's induced range.

The snapshots are written as their previous version with only the
changed fillers, so that their diff shows what changes.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…neOf

gen-owl copied the pattern of a slot or type into an xsd:pattern facet
as it is. LinkML's validators search a pattern with Python's re, where ^
and $ are anchors. An XML Schema regular expression matches the whole
value, ^ and $ are ordinary characters in it, and ., \s and \w cover
other characters. So the facet of ^[a-z_]+$ admitted only values with a
literal ^ and $, and the facet of [a-z]+ rejected ID-42x, which LinkML
accepts. equals_string on a literal was written as a pattern too, so
application/ld+json matched application/lddjson and not itself.

_regex_as_xsd translates a pattern into an XML Schema regular expression
that matches exactly the values in which re.search finds it. Each
top-level branch loses its anchors: an unanchored end gets (.|\n|\r)*,
and a $ becomes \n?. ., \s, \S, \w and \W are spelled out, inside
classes as choices or subtractions where XML Schema cannot nest a
negated class. Ranges are split around characters that need an escape,
and (?:, lazy quantifiers, {,n} and literal braces are rewritten.

It gives None for a pattern Python cannot compile and for one with a
construct XML Schema lacks, such as a lookaround, a backreference, \b,
an inline flag, a possessive quantifier, an anchor inside a group or a
character XML excludes. Such a pattern gets no facet and a warning, and
the restriction admits more values, which is sound. Where that would
make an expression admit fewer, as under a negation, in a union that
loses the operand or in the condition of a rule, the whole any_of,
exactly_one_of, none_of, rule or classification rule is left out.

equals_string on a literal slot or type becomes a one-literal owl:oneOf,
as on an enum-ranged slot, and a pattern next to it is kept.

Refs linkml#1695

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…ning

Move the translation of patterns into linkml.utils.pattern_dialects, so
that gen-owl and gen-shacl share one reading of a LinkML pattern, and
give it a second dialect. SHACL's sh:pattern is an XPath regular
expression (SHACL 4.4.3), searched in the value like Python's re.search
but with XML Schema's character classes, while pyshacl compiles it with
Python's re and Java engines with java.util.regex. regex_for_xpath
therefore writes only forms that these read with Python's meaning: "."
as [^\n], \s and \S as explicit classes derived from str.isspace, (?: as
a group, {,n} as {0,n}, a literal "{" or "}" escaped, and an escape
XPath does not have, such as \/, as the character. \w, \W and "$" stay
as written, as no form reads alike in all of them; a pattern with a
construct XPath lacks stays as it is.

Both translations read the escapes \xHH, \uHHHH, \UHHHHHHHH and \N{...}
as the characters they stand for, a named group as a group, and drop a
comment, where a pattern with one of them was left out before; a range
may end at a C0 control, of which XML allows only tab, line feed and
carriage return. These three are written as escapes, which RDF/XML does
not normalize.

gen-shacl now writes the equals_string and equals_string_in of a type as
sh:in, as it does for a slot. A shape has at most one sh:in (SHACL
4.8.3), and pyshacl refuses shapes with two, so the strings that all of
these settings of a slot and its type allow become one list. gen-json-
schema, and with it linkml-validate, now also checks the
equals_string_in of a type, as it checks its equals_string.

In gen-owl, the structured pattern of an anonymous expression, which
SchemaView does not resolve and the other generators leave out too,
counts as a pattern left out, so that an any_of with such an operand is
left out rather than narrowed to its other operands; and a pattern on a
slot whose values are individuals is no longer a facet of its global
range, as it already was not in a class's restrictions.

The OWL snapshots are written as their previous version with only the
changed facets.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
An enum whose permissible values are all rdfs:Literal was typed both
owl:Class and rdfs:Datatype, with the owl:oneOf of its literals on the
enum itself, and a slot with this range was an object property. OWL 2
DL does not let an IRI be both a class and a datatype, and an object
property has individuals as values, not literals. The OWL API reads
the owl:oneOf as an empty enumeration of individuals, so the enum and
every class that requires a value from it are unsatisfiable.

Such an enum is now only a datatype, defined by an owl:equivalentClass
to an anonymous rdfs:Datatype with the owl:oneOf, as OWL 2 maps a
datatype definition to RDF. A slot that ranges over such an enum is a
data property if each of its ranges is such an enum or, without
type_objects, a type whose values are literals. Its ranges are those of
its range, range_expression, which is a class expression if it has
slot conditions, any_of, all_of, exactly_one_of, none_of and
all_members, or else the default range, and those of its has_member.
Boolean expressions over such enums are data ranges, and a slot that a
class refines without a range keeps such an enum as its range instead
of the default range.

OWL 2 has no subtype axiom for datatypes, so the is_a, mixins and
inherits parents of such an enum are not emitted, and such an enum is
not a parent of an enum that stays a class; gen-owl warns when it
drops a parent. An enum without permissible values, or with values
that are not all literals, stays a class.

Refs linkml#2090

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
The runtime RDF dumper writes a permissible value without a meaning as
a plain literal. Check, with and without type_objects, that gen-owl
makes the slot of an enum of literals a data property whose range is
the enum's datatype, and that the enumeration of this datatype holds
the literal the dumper writes, so that the data LinkML writes fits the
ontology. On main, the slot is an object property and the enum has no
datatype definition.

Shorten the property-kind rule for enums of literals in owl.rst.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
gen-owl took the kind of a property from the range of its slot, or from
the default range for a slot without one, and not from any_of or
exactly_one_of. With a type as the default range, a slot whose any_of
lists classes, or enums that are classes, was a data property with a
union of classes as its range. A slot whose any_of lists a type and a
class was a data property too, and its range and restrictions mixed a
datatype and a class. The values of an object property are individuals
and those of a data property are literals, and in OWL 2 DL an IRI is not
both, so the OWL API reads such a property as both kinds and the
datatype as a class.

The kind of a property now comes from all ranges of its slot, those that
gen-owl already collects for enums of literals: the ranges of its range,
range_expression, any_of, all_of, exactly_one_of, none_of and
all_members, or else the default range, and those of its has_member. A
branch of any_of or exactly_one_of without a range, such as one with
only a pattern, has the range of the expression it is in, or else that
of the slot, or else the default range. Operands of all_of and none_of
only narrow a slot and add no kind, and linkml:Any adds none beside
other ranges, as the documentation of unions as ranges gives a slot the
range Any and lists its ranges in any_of. A role that the slot declares
with implements comes first; otherwise, if the values of each range are
literals, the slot is a data property, and if they are IRIs or blank
nodes, an object property. A slot without ranges, in a schema without a
default range, keeps the kind that the classes that narrow it give it,
and an enum that is a class, or a type under type_objects, now counts as
nodes there, as a class does.

Where OWL cannot state what the schema says, gen-owl now leaves it out
and logs a warning. No OWL property has both literals and individuals as
values, so a slot that ranges over both is an object property, as a slot
of linkml:Any is, without a range, and classes do not restrict its
values. A class that narrows a slot to values that its property cannot
have, such as a slot of strings to a class, does not restrict it there.
A slot whose range_expression, or that of its has_member or of an
expression in it, has a condition that OWL cannot state has no range
either. Of a class, an any_of or exactly_one_of with an operand that has
such a condition is left out, as is a rule or classification rule with
one, since leaving out only the condition could make the axiom stronger;
of all_of and none_of, only the operand is left out.

A class that refined a slot without giving a range restricted it to
owl:Thing if the range of the slot is a class, and else to the default
range, so to a datatype for a slot whose any_of lists classes or whose
range is an enum that is a class. Such a slot now gets owl:Thing too.
The expressions of exactly_one_of were given the types of the slot,
which gen-owl records differently from those of their operands, so over
data ranges they were untyped and their complements were complements of
classes. They now take the types of their operands, as unions do, and
complements and intersections pass their types on to the expressions
that have them as operands, so over data ranges these are data ranges,
with owl:datatypeComplementOf. An expression over an enum that is a
class has the types of a class expression, as one over a class has, so
its intersection with the data range of a constraint, such as
equals_string_in, is no longer typed as a datatype.

Refs linkml#1483

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
The OWL snapshots of kitchen_sink and of the metamodel were written
anew, so their blank nodes were renumbered and nearly every line
changed. They are now their previous version with only the triples
that this change adds or removes; the snapshot tests compare them as
graphs, up to blank-node renaming.

Shorten the description of the ranges of a slot in owl.rst.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…r features

Consumer checks for features that meet on the integration branch: an any_of
branch keeps its pattern next to a nested range_expression after RDF
serialization, in both RDF label modes; one OWL resource keeps its
metaclass membership (instantiates) next to its declared IRI-valued
annotation, while a type keeps its membership (gen-owl writes no annotations
on types); every pattern gen-shacl writes, as sh:pattern or in a SPARQL
REGEX, is the XPath rewrite of the LinkML pattern, also in class expressions
and rules, and still accepts and rejects what the Python pattern does; a
condition read in its owner never puts a class filler on a data property;
and equals_string on an enum that is a class, or on a type under
type_objects, stays a string.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
A separate job resolves the pinned OWLAPI 5.5.0 tree with Maven and runs a
Java probe on gen-owl output: OWL 2 DL profile, no unparsed triples, and the
expected annotations kept through a round trip. It checks the documented
DCMI example in four modes and a schema where metaclass membership, a
declared annotation, annotation properties with a super-property and a
built-in IRI, and an ordinary data property meet.

Both profile tests are strict expected failures: gen-owl writes metadata
annotations (dcterms:title, skos:definition, skos:inScheme,
linkml:permissible_values) without declaring their annotation properties,
and asserts membership in external classes without declaring them, which
upstream main does for any schema too. They fail loudly once the
declarations exist.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
(cherry picked from commit 88e3a80)
Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
…ral only implies

- diffable-rdf 0.4.0 extends rdflib's Turtle serializer under its rdflib 7
  method names, which rdflib 8 renamed, so canonicalize_rdf_graph raises
  AttributeError on every graph that takes the fallback path. 0.4.1 fixes
  that.
- rdflib 8 also gives every literal a datatype (RDFLib/rdflib#3757, in the
  ASCS-eV rdflib tag envited-x/2026.11.27.1). 0.4.1 then writes
  "x"^^xsd:string for every simple literal, and 5 tests of
  test_rdf_canonicalize*.py fail against that tag. With 0.4.2 four of them
  pass. The fifth, test_iri_with_trailing_dot_round_trips, fails with 0.4.1
  and 0.4.2 alike, on that tag and on envited-x/2026.11.25: rdflib 8 writes
  the IRI as the escaped prefixed name ex:Strand\#\. where the test expects
  the rdflib 7 form. Under rdflib 7 all 65 pass and the output is unchanged.
- Raise the floor of the dependency and of the diff-stable extra to 0.4.2
  and relock; only diffable-rdf changes.
- Exempt diffable-rdf from the seven-day exclude-newer cooldown, as
  neverblink-linkml is: canonicalization is delegated to it, and ASCS-eV,
  which maintains this fork, publishes it.

Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
@jdsika
jdsika force-pushed the feat/envited-x-pipeline branch from 94c9b0d to 0bcc4a2 Compare November 28, 2026 08: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.

2 participants