Expand description
OpenBIM.rs family for IFC5 / IFCX.
IFCX is a layered, componentised JSON model with USD-like composition. It
is not an EXPRESS schema release, so it lives here rather than as a
SchemaVersion in openbim-ifc (see docs/adr/0001).
This crate reads and writes single ifcx_alpha files losslessly, composes
layered nodes into a resolved tree (flatten, then compose(); see
compose), and checks attribute values against a file’s
schemas (IfcxFile::validate, validate_flat,
validate_attributes; rules in validate). layers
loads a file with its imports through a caller-supplied resolver,
validates the stack as a whole
(LayerStack::validate), and federates
it into one file, ready to flatten and compose.
flatten_owned and layers::LayerStack::into_federated consume
their input and move attribute values instead of copying them; use them
when the nodes are not needed afterwards, which is the usual case after
reading a file:
use openbim_ifcx::{compose, flatten_owned, IfcxFile};
let file = IfcxFile::from_json_str(r#"{
"header": {"id": "demo", "ifcxVersion": "ifcx_alpha", "dataVersion": "1.0.0",
"author": "someone", "timestamp": "2026-10-03"},
"imports": [], "schemas": {},
"data": [{"path": "site", "attributes": {"demo::name": "Site"}}]
}"#)?;
let composition = compose(&flatten_owned(file.data))?;
assert_eq!(composition.roots(), ["site"]);§Features
integrity(default): check SHA-2integrityvalues on imports. Without it, an import that carriesintegrityis rejected rather than loaded unchecked.fs:layers::FsResolver, which loads imports from local files. The crate does no filesystem access otherwise and never uses the network.
use openbim_ifcx::IfcxFile;
let file = IfcxFile::from_json_str(r#"{
"header": {"id": "demo", "ifcxVersion": "ifcx_alpha", "dataVersion": "1.0.0",
"author": "someone", "timestamp": "2026-10-03"},
"imports": [],
"schemas": {},
"data": [{"path": "a1", "children": {"Wall": "b2", "Old": null}}]
}"#)?;
let children = file.data[0].children.as_ref().unwrap();
assert_eq!(children["Wall"].as_deref(), Some("b2"));
assert_eq!(children["Old"], None);Re-exports§
pub use compose::compose;pub use compose::flatten;pub use compose::flatten_owned;pub use compose::ComposeError;pub use compose::ComposedNode;pub use compose::Composition;pub use compose::FlatNode;pub use validate::validate_attributes;pub use validate::validate_flat;pub use validate::validate_nodes;pub use validate::FailureKind;pub use validate::JsonType;pub use validate::ValidationFailure;pub use validate::ValidationReport;pub use validate::INTERNAL_ATTRIBUTE_PREFIX;
Modules§
- compose
- Layer composition, following upstream
src/ifcx-core/compositionof buildingSMART/IFC5-development for theifcx_alphadraft. - layers
- Layer stacks: loading a main layer and, recursively, its
imports. - validate
- Checking attribute values against a file’s
schemas.
Structs§
- Array
Restrictions - Enum
Restrictions - Ifcx
File - One IFCX file: a single layer of a dataset.
- Ifcx
Header - Ifcx
Node - One node opinion.
childrenandinheritsmap a local name to a referenced path; aNonevalue deletes that entry when layers merge. - Ifcx
Schema - Describes the values allowed for one attribute id.
- Ifcx
Value Description - Import
Node - A reference to another IFCX file that this layer builds on.
- Object
Restrictions - Read
Error - A file that could not be read, with the 1-based location of the problem.
- Write
Error - A file that could not be written.
Enums§
- Data
Type - The
dataTypeof a value description. Names this crate does not know read asDataType::Otherand are written back unchanged. - Read
Error Kind - Why a file could not be read.
Type Aliases§
- Extra
- Fields this crate does not model, kept in input order for round trip.