buildingSMART / buildingSMART/IFC4.x-development

Express rule: query iteration not guarded by existance check

Open
#1,018 0 comments 0 reactions 0 assignees View on GitHub
after-NWI iso-compatibility iso-Te proposal
Dominant language
Python
Stars
234
Forks
123
Avg merge
15h 4m
Merged PRs (30d)
5

Description

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;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.