Skip to content

Fix datatype ranges and preserve every facet value - #24

Merged
ValentinaPasqual merged 1 commit into
opencitations:mainfrom
epistrephein:range-with-restriction
Nov 11, 2026
Merged

ValentinaPasqual merged 1 commit into
opencitations:mainfrom
epistrephein:range-with-restriction

Conversation

@epistrephein

@epistrephein epistrephein commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Numeric datatype ranges lose their base datatype and earlier bounds during extraction, so generated documentation shows only the final constraint. For example, an integer range from 1 to 3 appears as "≤ restricted by 3".

The failing OWL statement (from monomyth ontology) that triggered this bugfix is

monomyth:actOrder a owl:DatatypeProperty,
        owl:FunctionalProperty ;
    rdfs:label "act order"@en ;
    rdfs:comment """The sequential position of an act in the three-act structure (1-3)."""@en ;
    rdfs:domain monomyth:Act ;
    rdfs:range [
        a rdfs:Datatype ;
        owl:onDatatype xsd:integer ;
        owl:withRestrictions (
            [ xsd:minInclusive 1 ]
            [ xsd:maxInclusive 3 ]
        )
    ] .

The bugfix crosses three layers:

  • Model: stored only one facet value while a range needs the datatype plus multiple paired constraints, such as >= 1 and <= 3. It now stores the base datatype separately from all facet/value pairs.
  • Reader: overwrote the datatype with each operator and overwrote the previous bound. It now preserves every constraint without overwriting the datatype or previous bounds.
  • Viewer: now renders the complete range, such as integer[>= 1, <= 3].

Screenshots: 🖼️ main | 🖼️ this PR

Datatype restrictions overwrote the base datatype and each preceding
facet, leaving only the final operator and value in the generated
documentation. Keep the base datatype separate from ordered facet/value
pairs and render every constraint. Preserve the existing single-value
accessor for callers that use it.

Add regression tests for inclusive and exclusive bounds, reversed facet
order, zero, patterns, and complete ranges in static index and resource
pages.
@ValentinaPasqual
ValentinaPasqual merged commit 71b20f0 into opencitations:main Nov 11, 2026
5 checks passed
@epistrephein
epistrephein deleted the range-with-restriction branch November 11, 2026 10:37
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