Skip to content

IDS: property facet throws on properties without data (19 official test cases), and list, bounded, enumerated and table values are not checked #827

Closed

Description

@helenkwok

Summary

IDSProperty.test throws TypeError: Cannot use 'in' operator to search for 'value' in undefined when a property set refers to a property that has no data in the fragments model. With the default IfcImporter that is every property that isn't an IfcPropertySingleValue (lists, bounded, enumerated, table, reference and complex properties): the set still lists their ids, but the items come back as { _category: { value: null }, _localId } with no Name, and "value" in item.Name throws. The whole specification fails to run, not just that property.

Separately, evalValue and evalDataType read a single value key (getValueKey returns the first key containing "Value"), so list, bounded, enumerated and table properties can't be matched even when their data is there. The code has commented-out list/enumeration handling and notes that bounded and table values "are not supported yet".

Measured

buildingSMART's IDS implementer test cases (Documentation/ImplementersDocumentation/TestCases, 182 entity, property, attribute, restriction and ids cases that aren't invalid-), run through IDSSpecifications on main (8479a7c):

  • 19 property cases throw, including all of "any matching value in a list / bounded / enumerated / table property will pass", "complex properties are not supported", "reference properties are treated as objects", "predefined properties are supported but discouraged", and "properties can be inherited from the type" / "overriden by an occurrence" (1_2), where the same set also holds such a property.
  • With the importer also keeping list, bounded, enumerated, enumeration and table properties (IfcImporter leaves out list, bounded, enumerated and table properties, so property sets point at items with no data engine_fragment#323), those cases stop throwing but still fail, because only one value is read.

Fix

PR to follow:

  • Guard every Name / _category read in IDSProperty, so a property without data counts as missing (the requirement fails) instead of throwing.
  • Read every value attribute of a property (NominalValue, ListValues, LowerBoundValue / UpperBoundValue / SetPointValue, EnumerationValues, DefiningValues / DefinedValues, quantity values) and pass when any one matches, as the test cases require; the same for dataType.

With it, the run goes from 133 to 143 agreeing cases and from 21 to 2 throwing (the 2 left are the entity predefinedType crash, #819 / #820). With the importer change as well, 148. No case that agreed before regresses. The remaining bounded and table failures are unit conversion (the files are in millimetres), which is a separate gap.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions