Skip to content

mdcode: carry OWL unqualified cardinality restrictions - #343

Draft
libei wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
libei:owl-cardinality-restrictions
Draft

mdcode: carry OWL unqualified cardinality restrictions#343
libei wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
libei:owl-cardinality-restrictions

Conversation

@libei

@libei libei commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

What

Stage 3 of the OWL→OSI converter: read an anonymous owl:Restriction reached through rdfs:subClassOf from a named class — naming a property (owl:onProperty) and one or more of the unqualified cardinality predicates (owl:cardinality / owl:minCardinality / owl:maxCardinality) — and carry it verbatim on the entity as a GOOGLE custom extension.

Carriage is inert on push and lossless on the OSI round-trip (promotable later). OSI has no cardinality concept, so entity-level carriage is used: the restriction rides even when the restricted property has no field on that class (e.g. inherited).

Scope / exclusions

  • Qualified cardinality (owl:onClass / owl:onDataRange + qualified predicates) is detected and skipped — deferred to a later stage.
  • A value restriction (owl:someValuesFrom, no cardinality) and a malformed cardinality contribute nothing (no empty block).
  • Cardinality literals are parsed digits-only, so an empty / hex / exponent string is ignored rather than coerced to a bogus number.
  • A blank node typed both owl:Restriction and a named kind is pruned from the named-term maps so it does not surface as a bogus entity; a named IRI typed owl:Restriction keeps its class identity.

Tests

Full bun test suite green (510 pass / 0 fail). Adds targeted tests for the carried shapes (exact / min+max / multiple / in- vs cross-namespace onProperty), the exclusions (qualified, value restriction, via equivalentClass, no onProperty), and edge cases (malformed/coercible literals, dual-typed blank node, named dual-typed class). Docs (owl-import.md) and fixtures updated.

Read an anonymous owl:Restriction reached through rdfs:subClassOf from a
named class -- naming a property (owl:onProperty) and one or more of the
unqualified cardinality predicates (owl:cardinality / owl:minCardinality /
owl:maxCardinality) -- and carry it verbatim on the entity as a GOOGLE
custom extension. Inert on push, lossless on the OSI round-trip, promotable
later. OSI has no cardinality concept, so entity-level carriage is chosen so
the restriction rides even when the restricted property has no field on the
class (e.g. inherited).

Qualified cardinality (owl:onClass / owl:onDataRange + the qualified
predicates) is detected and skipped, deferred to a later stage. A value
restriction (owl:someValuesFrom, no cardinality) and a malformed cardinality
contribute nothing. Cardinality literals are parsed digits-only so an empty,
hex, or exponent string is ignored rather than coerced. A blank node typed
both owl:Restriction and a named kind is pruned from the named-term maps so
it does not surface as a bogus entity; a named IRI typed owl:Restriction
keeps its class identity.

Docs and fixtures updated; adds targeted tests for the carried shapes,
exclusions, and edge cases.
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