ifcopenshell.validate#

Data validation module

Module Contents#

ifcopenshell.validate.aggregation_type#
ifcopenshell.validate.attribute#
ifcopenshell.validate.entity_attribute_map#
ifcopenshell.validate.entity_type#
ifcopenshell.validate.enumeration_type#
ifcopenshell.validate.filenames#
ifcopenshell.validate.log_entry_type#
ifcopenshell.validate.named_type#
ifcopenshell.validate.select_members_cache#
ifcopenshell.validate.select_type#
ifcopenshell.validate.simple_type#
ifcopenshell.validate.simple_type_python_mapping#
ifcopenshell.validate.type_declaration#
exception ifcopenshell.validate.ValidationError(message, attribute=None)#

Bases: Exception

Common base class for all non-exit exceptions.

Initialize self. See help(type(self)) for accurate signature.

class ifcopenshell.validate.json_logger#
__getattr__(self, level)#
log(self, level, message, *args)#
set_state(self, key, value)#
ifcopenshell.validate.annotate_inst_attr_pos(inst, pos)#
ifcopenshell.validate.assert_valid(attr_type, val, schema, no_throw=False, attr=None)#
ifcopenshell.validate.assert_valid_inverse(attr, val, schema)#
ifcopenshell.validate.format(val)#
ifcopenshell.validate.get_entity_attributes(schema, entity)#
ifcopenshell.validate.get_select_members(schema, ty)#
ifcopenshell.validate.log_internal_cpp_errors(filename, logger)#
ifcopenshell.validate.validate(f, logger, express_rules=False)#

For an IFC population model f (or filepath to such a file) validate whether the entity attribute values are correctly supplied. As this is a function that is applied after a file has been parsed, certain types of errors in syntax, duplicate numeric identifiers or invalidate entity names are not caught by this function. Some of these might have been logged and can be retrieved by calling ifcopenshell.get_log(). A verification of the type, entity and global WHERE rules is also not implemented.

For every entity instance in the model, it is checked that the entity is not abstract that every attribute value is of the correct type and that the inverse attributes are of the correct cardinality.

Express simple types are checked for their valuation type. For select types it is asserted that the value conforms to one of the leaves. For enumerations it is checked that the value is indeed on of the items. For aggregations it is checked that the elements and the cardinality conforms. Type declarations (IfcInteger which is an integer) are unpacked until one of the above cases is reached.

It is recommended to supply the path to the file, so that internal C++ errors reported during the parse stage are also captured.