Skip to main content

Crate ifc_validate

Crate ifc_validate 

Source
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 bundle the schemas’ rule text: the IFC schemas are CC BY-ND 4.0, and the bundled tables keep only rule labels. validate runs a hand-written subset of the WHERE rules (where_rule::RULES) and reports the rest it knows of as unsupported. Given the release’s own .exp text, the express evaluator (feature express, on by default) evaluates every WHERE rule, type rule and global rule of the release through validate_with_options, so a clean report never silently means “unchecked”.

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.

The hand-written rules do not derive INVERSE relationships, so one whose IFC2X3 form depends on an inverse is reported unsupported; the express evaluator resolves INVERSE attributes through the reverse index.

§Module map

ModuleRole
headerDeclared schema and implementation level
structureReferences, required slots, cardinality, bounds, UNIQUE clauses
type_checkValues against their declared EXPRESS types
where_ruleNative rules, and honest reporting of the rest
expressEvery EXPRESS rule, evaluated from the release’s text
property_setPset_/Qto_ names, and the members of catalog sets
optionsWhat a run is given: budget, rules, catalog
reportFindings, paths, severities, summaries
errorWhy validation could not run

Re-exports§

pub use error::ValidateError;
pub use options::validate_with_options;
pub use options::ValidateOptions;
pub use property_set::CatalogMember;
pub use property_set::CatalogMemberForm;
pub use property_set::CatalogQuantityKind;
pub use property_set::CatalogSet;
pub use property_set::CatalogSetKind;
pub use property_set::PropertySetCatalog;
pub use report::BudgetExceeded;
pub use report::CatalogMemberDetail;
pub use report::CatalogMismatch;
pub use report::Finding;
pub use report::FindingDetail;
pub use report::NotEvaluated;
pub use report::Path;
pub use report::Report;
pub use report::ReservedSetName;
pub use report::RuleDetail;
pub use report::RuleOutcome;
pub use report::RuleScope;
pub use report::Severity;
pub use report::Summary;
pub use where_rule::Budget;

Modules§

error
Why validation could not run.
express
EXPRESS rule evaluation: WHERE rules, type rules, global rules and the FUNCTIONs they call, read from the release’s own schema text.
header
Header well-formedness and the schema a file declares.
options
ValidateOptions: what a validation run checks beyond the bundled tables, and how much it may report.
property_set
Property and quantity set names using a reserved prefix (#511).
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 WHERE rules, 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.