Skip to content

Express rule: query iteration not guarded by existance check #1018

@aothms

Description

@aothms

Most of our rules (I don't have a static analyser, not so sure) that perform iteration or get the bounds of an optional aggregate are guarded by an prior existence check. In my implementation that converts to python that also mean that due to short circuiting in the if-statement the right hand conjunct that contains the query expression or bounds check on the NIL value is never executed. Therefore at this point in time, my implementations fails on IfcPropertyListValue.WR31. I think this is my problem, because the spec probably dictates that this somehow folds to indeterminate, but for clarity and consistency I would still propose to update this in the spec.

Cases with existence check

IfcIndexedPolyCurve

Consecutive : NOT(EXISTS(Segments)) OR IfcConsecutiveSegments(Segments);

IfcConsecutiveSegments(Segments) calls HIINDEX(Segments)

IfcPropertyEnumeratedValue

WR21 : NOT(EXISTS(EnumerationReference)) 
OR  NOT(EXISTS(EnumerationValues)) 
OR  (SIZEOF(QUERY(temp <* EnumerationValues |
temp IN EnumerationReference.EnumerationValues))
= SIZEOF(EnumerationValues));

IfcPropertyTableValue

WR22 : NOT(EXISTS(DefiningValues)) OR 
(SIZEOF(QUERY(temp <* SELF.DefiningValues | TYPEOF(temp) <> TYPEOF(SELF.DefiningValues[1])
)) = 0);

Case without existence check

https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcPropertyListValue.htm

Image

Proposal

change to

WR31: When present, all values within the list of values shall be of the same measure type.

ENTITY IfcPropertyListValue
 SUBTYPE OF (IfcSimpleProperty);
	ListValues : OPTIONAL LIST [1:?] OF IfcValue;
	Unit : OPTIONAL IfcUnit;
 WHERE
	WR31 : NOT(EXISTS(ListValues)) 
  OR SIZEOF(QUERY(temp <* SELF.ListValues | 
  NOT(TYPEOF(SELF.ListValues[1]) = TYPEOF(temp))
  )) = 0;
END_ENTITY;

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalStep 2: A well defined proposal has been put forward

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions