Skip to content

fix(schema): align /// with BNF; widen timeLiteralPattern#582

Open
aorzelskiGH wants to merge 1 commit into
IDTA-01002-3-2_workingfrom
fix/datetime-time-semantics
Open

fix(schema): align /// with BNF; widen timeLiteralPattern#582
aorzelskiGH wants to merge 1 commit into
IDTA-01002-3-2_workingfrom
fix/datetime-time-semantics

Conversation

@aorzelskiGH
Copy link
Copy Markdown
Contributor

Summary

Align the JSON Schemas for AAS Query Language / Access Rules with the BNF grammar for date and time semantics.

Problem

The BNF defines $dayOfWeek, $dayOfMonth, $month, $year as numeric extraction functions whose argument is a <dateTimeOperand> (a literal, a dateTime(...) cast or a GLOBAL(UTCNOW) attribute access). The schema typed these keys as dateTimeLiteralPattern, forcing the argument to be a literal xsd:dateTime string and rejecting legal constructs such as:

{"$dayOfWeek": {"$attribute": {"GLOBAL": "UTCNOW"}}}

In addition, timeLiteralPattern did not allow fractional seconds, although the BNF <time> rule does.

Solution

  • $dayOfWeek, $dayOfMonth, $month, $year now reference #/definitions/Value, matching the BNF.
  • timeLiteralPattern is widened to ^[0-9]{2}:[0-9]{2}(:[0-9]{2})?(\.[0-9]+)?$ to cover optional seconds and fractional seconds per xsd:time / BNF <time>.

Affected files

  • documentation/IDTA-01002-3/modules/ROOT/partials/query-json-schema.json
  • documentation/IDTA-01002-3/modules/ROOT/pages/schema.adoc

Review notes

  • No BNF changes; schema is brought in line with the existing grammar.
  • Backwards compatible: all previously accepted inputs remain valid.
  • Please verify that existing examples still validate against the updated schema.

Refs: Review Finding T-14

…h/$year and timeLiteralPattern

The BNF defines these keys as numeric-extraction functions over a
dateTime expression:

  <dateTimeToNum> ::=
      ( "$dayOfWeek" | "$dayOfMonth" | "$month" | "$year" )
      <ws> "(" <ws> <dateTimeOperand> <ws> ")" <ws>

where <dateTimeOperand> is a DateTimeLiteral, a cast to dateTime, or
a GlobalAttribute (e.g. GLOBAL(UTCNOW)). The argument is therefore a
Value expression that evaluates to a dateTime, not a literal
xsd:dateTime string.

The JSON schemas typed these four keys as
$ref: "#/definitions/dateTimeLiteralPattern"
which forced them to be literal ISO date-time strings and made
constructs like `{"$dayOfWeek": {"$attribute": {"GLOBAL": "UTCNOW"}}}`
invalid even though the BNF explicitly allows them.

timeLiteralPattern was also stricter than the grammar: it rejected
fractional seconds. The BNF <time> is:

  <hour> ":" <minute> ( ":" <second> )? ( "." <fraction> )?

Changes:

- $dayOfWeek, $dayOfMonth, $month, $year -> $ref Value
- timeLiteralPattern pattern
    before: ^[0-9][0-9]:[0-9][0-9](:[0-9][0-9])?$
    after : ^[0-9]{2}:[0-9]{2}(:[0-9]{2})?(\.[0-9]+)?$

Files:
- aas-specs-api: partials/query-json-schema.json, pages/schema.adoc
- aas-specs-security: partials/json/aas-queries-and-access-rules-schema.json, partials/json/formulas-and-logical-expressions.json

Refs: Review Finding T-14
Made-with: Cursor
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