Expand description
ifc-validate – Schema and model validation: is this file actually legal IFC?
Split from parsing on purpose. A reader that rejects everything imperfect is useless on real data – roughly half of production files violate something – so parsing is permissive and validation is an explicit, separate pass.
§What a report means
let report = ifc_validate::validate(model, ifc_schema::ifc4());
if report.is_conformant() {
// No *errors*. There may still be warnings, and there are certainly
// rules this validator does not evaluate -- `report.summary()`
// says how many.
}The four severities are not a mood scale. Severity::Error means the
file breaks a schema requirement; Severity::EvaluationError means an
implemented rule applied to an instance but could not be decided for it;
Severity::Warning means it is legal but will behave badly;
Severity::Unsupported is a statement about this validator, not about
the file. Errors and evaluation errors affect Report::is_conformant:
a rule nobody could decide is not a rule that passed.
§What this crate deliberately does not do
It does not evaluate arbitrary EXPRESS WHERE expressions – there is no
expression evaluator here. Rules that need one are registered as
unsupported and reported, so a clean report never silently means
“unchecked”. See where_rule::RULES.
It checks the aggregate bounds, nesting and element uniqueness of
explicit attributes, and every UNIQUE clause of the declared release
(structure). A bound written as an expression, and the bounds of an
aggregate reached through a defined type, are not evaluated.
It does not derive INVERSE relationship semantics: the schema tables
record every INVERSE clause, but no cardinality over them is checked. A
selected rule whose IFC2X3 form depends on an inverse is therefore
reported unsupported, even when a later schema revision exposes
equivalent direct attributes.
§Module map
| Module | Role |
|---|---|
header | Declared schema and implementation level |
structure | References, required slots, cardinality, bounds, UNIQUE clauses |
type_check | Values against their declared EXPRESS types |
where_rule | Native rules, and honest reporting of the rest |
report | Findings, paths, severities, summaries |
error | Why validation could not run |
Re-exports§
pub use error::ValidateError;pub use report::Finding;pub use report::Path;pub use report::Report;pub use report::Severity;pub use report::Summary;pub use where_rule::Budget;
Modules§
- error
- Why validation could not run.
- header
- Header well-formedness and the schema a file declares.
- report
- Structured findings: severity, entity, rule, message.
- structure
- Structural conformance: references, slots, cardinality, uniqueness.
- type_
check - Type conformance: entity types, scalars, enumerations, selects.
- where_
rule - EXPRESS
WHERErules, and honesty about the ones not evaluated.
Functions§
- validate
- Validate a model against a schema with the default budget.
- validate_
declared - Validate against the schema the file itself declares.
- validate_
with - Validate under an explicit budget.