Skip to content

feat(read): read IDS 1.0 documents into a typed model - #5

Merged
GeneralPawz merged 2 commits into
mainfrom
feat/ids-reader
Sep 27, 2026
Merged

GeneralPawz merged 2 commits into
mainfrom
feat/ids-reader

Conversation

@GeneralPawz

@GeneralPawz GeneralPawz commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Implements IDS-PARSE (#1).

  • read::from_str / read::from_slice → model::Ids, or a ReadError with line and column.
  • First pass: version signals + xsi:schemaLocation → detect_version. Drafts and header/shape contradictions are refused with ErrorKind::UnsupportedVersion(Detected<_>). A document that declares nothing and shows no revision-specific shape is read as 1.0 only if it fully satisfies the 1.0 schema, and reports Detected::Inferred.
  • Second pass follows ids.xsd 1.0.0 strictly. Schema defaults are explicit (absent @cardinality → required, absent minOccurs/maxOccurs → 1). Requirement facets keep document order. @ifcVersion is split as an xs:list. IFCRELVOIDSELEMENT IFCRELFILLSELEMENT stays one token.
  • Restrictions keep base (prefix resolved) and every facet in lexical form. xs:whiteSpace, inline xs:simpleType and xs:assertion are refused as unsupported rather than dropped.

Evidence

  • All 334 buildingSMART test cases read as declared 1.0 (IDS_TEST_CASES=… cargo test --test corpus -- --ignored). The corpus is CC BY-ND 4.0, so it is not vendored.
  • A differential dump against IfcOpenShell ifctester 0.8.5 over the same 334 files shows 0 differences.
  • Six mutations of load-bearing rules, each caught by a test (table in PLAN.md).

Correction to #1's definition of done

The corpus invalid-* cases are schema-valid IDS whose content contradicts IFC (e.g. 42.0 for an integer attribute). Rejecting them needs the IFC schema, so that belongs to IDS-AUDIT. The reader must read them, and does.

GeneralPawz and others added 2 commits September 26, 2026 12:04
Adds `read::from_str`/`from_slice` and the `model` types. A lenient first
pass collects version signals and the `xsi:schemaLocation` declaration and
refuses drafts and contradictions with their evidence; a strict second pass
follows ids.xsd 1.0.0, applying schema defaults explicitly (absent
cardinality is required, absent minOccurs/maxOccurs is 1) and keeping
requirement facets in document order.

All 334 buildingSMART test cases read as declared 1.0, and a differential
dump against IfcOpenShell ifctester 0.8.5 shows no differences. The corpus
(CC BY-ND 4.0) is read from IDS_TEST_CASES, not vendored.

Closes #1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MNzJbWbSLjhFXQKs3LhUm
A base in the XML Schema namespace was accepted whatever its name, so
base="xs:invalid" read as a restriction. Only the XML Schema 1.0 built-in
simple types, the revision ids.xsd imports, are now accepted.

Found by reading the invalid fixtures of an independent IDS implementation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MNzJbWbSLjhFXQKs3LhUm
@GeneralPawz
GeneralPawz marked this pull request as ready for review September 27, 2026 19:00
@GeneralPawz
GeneralPawz merged commit 381cc5e into main Sep 27, 2026
2 checks passed
@GeneralPawz
GeneralPawz deleted the feat/ids-reader branch September 27, 2026 19:00
GeneralPawz added a commit to axioval/engine that referenced this pull request Sep 28, 2026
The importer wrote its rule definitions' parameters by hand, so the new
rule and folder gates, ruleset classifications and property-requirements
columns left it uncompilable and its definitions refused by the compiler.
It now reads each definition's parameters and table columns from the
trusted capability it selects, so a new optional parameter or column no
longer leaves it behind.

The openbim-ids reader merged (openbimrs/ids#5) and its branch is gone;
the dependency is pinned to the merge commit on main until a release
carries it.

Refs #116

Claude-Session: https://claude.ai/code/session_01J42ceJFik9GZt6cjZSWzuR
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