pub struct Schema { /* private fields */ }Expand description
An IFC schema: the entity and type tables, queryable.
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn from_parsed(parsed: ParsedSchema) -> Self
pub fn from_parsed(parsed: ParsedSchema) -> Self
Wraps an already-parsed schema.
Sourcepub fn from_express(source: &str) -> Self
pub fn from_express(source: &str) -> Self
Parses EXPRESS source into a schema.
Sourcepub fn from_express_bytes(bytes: &[u8]) -> Self
pub fn from_express_bytes(bytes: &[u8]) -> Self
Parses EXPRESS source that is not valid UTF-8.
The normative IFC4.exp is Latin-1: it contains ° and similar in
comments. Decoding byte-per-char is correct for the ASCII structure
this parser reads and cannot fail.
Sourcepub fn version(&self) -> Option<SchemaVersion>
pub fn version(&self) -> Option<SchemaVersion>
The IFC schema version this table describes, when recognized.
This is the one genuinely IFC-specific query on this type: it maps a declared schema name onto the versions this crate knows about.
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
How many entity declarations the schema holds.
Sourcepub fn type_count(&self) -> usize
pub fn type_count(&self) -> usize
How many type declarations the schema holds.
Sourcepub fn entity(&self, name: &str) -> Option<&EntityDef>
pub fn entity(&self, name: &str) -> Option<&EntityDef>
The entity declaration for name, if the schema declares one.
Sourcepub fn type_def(&self, name: &str) -> Option<&TypeDef>
pub fn type_def(&self, name: &str) -> Option<&TypeDef>
The type declaration for name, if the schema declares one.
Sourcepub fn entity_names(&self) -> impl Iterator<Item = &str>
pub fn entity_names(&self) -> impl Iterator<Item = &str>
Every entity name the schema declares, in unspecified order.
Sourcepub fn accepts_type(&self, declared: &str, candidate: &str) -> bool
pub fn accepts_type(&self, declared: &str, candidate: &str) -> bool
Whether a candidate entity or defined type satisfies a declared type.
This walks entity inheritance, defined-type aliases, and nested SELECTs. Unknown declarations and cyclic aliases fail closed.
Sourcepub fn is_a(&self, name: &str, ancestor: &str) -> bool
pub fn is_a(&self, name: &str, ancestor: &str) -> bool
Whether name is ancestor, or inherits from it.
Sourcepub fn supertypes(&self, name: &str) -> Vec<&str>
pub fn supertypes(&self, name: &str) -> Vec<&str>
The supertype chain above name, nearest parent first.
Sourcepub fn direct_subtypes(&self, name: &str) -> Vec<&str>
pub fn direct_subtypes(&self, name: &str) -> Vec<&str>
Entities declaring SUBTYPE OF (name) directly, sorted by name.
Sourcepub fn subtypes(&self, name: &str) -> Vec<&str>
pub fn subtypes(&self, name: &str) -> Vec<&str>
Every entity inheriting from name at any depth, excluding name.
Sorted depth-first pre-order. The inverse of Self::is_a.
Sourcepub fn attributes(&self, name: &str) -> Vec<&Attribute>
pub fn attributes(&self, name: &str) -> Vec<&Attribute>
Every attribute slot in Part 21 positional order, inherited first.
Sourcepub fn attribute_names(&self, name: &str) -> Vec<&str>
pub fn attribute_names(&self, name: &str) -> Vec<&str>
Attribute names in positional order.
Sourcepub fn resolve_defined(&self, name: &str) -> String
pub fn resolve_defined(&self, name: &str) -> String
Resolves a defined type to the base it ultimately aliases.
IfcPositiveLengthMeasure -> IfcLengthMeasure -> REAL.
Sourcepub fn graph(&self) -> &SchemaGraph
pub fn graph(&self) -> &SchemaGraph
The underlying schema graph.
Exposed so schema-neutral consumers can work against the generic type rather than this IFC-flavoured wrapper.