Sub-features and relations
Reading features of related objects — the single-target and multi-target relations, dot and parenthesised forms, nested WHERE/ORDER BY/LIMIT, the all/any/count quantifiers in WHERE, systems, zones, ports, space boundaries and decomposition.
A sub-feature is a feature of a related object: the name of an object's storey, the type of its children, the area of the windows in its boundaries. A relation name in front of a feature path moves the evaluation to the related object(s).
Relations#
Single-target relations point at one object; multi-target relations at a set.
| Relation | Target | GET | WHERE |
|---|---|---|---|
project, site, building, buildingStorey, space |
The containing spatial element of that class | yes | yes |
containedIn |
The immediate spatial container | yes | yes |
parent |
The parent in the object tree (containment or decomposition) | yes | yes |
decomposes |
The assembly this object is a part of | yes | yes |
typeObject |
The object's type definition (Type objects) | yes | yes |
relatedBuildingElement |
From a space boundary, the building element it belongs to | yes | yes |
own |
The object itself, without data merged from its type (type-objects#own) | yes | yes |
portConnectedTo, portContainedIn |
From a port: the port it connects to; the element that contains it | yes | — |
fillsVoid, voidsElement |
Opening and filling, single form (Openings and fillings) | yes | — |
children, allChildren |
Direct children; all descendants | yes | children |
containmentChildren, decompositionChildren |
Children by spatial containment only; by decomposition only | yes | — |
system, zone |
The systems (IfcSystem) and zones (IfcZone) the object is assigned to |
yes | yes |
members |
From an IfcZone, IfcSystem or IfcGroup: the objects it groups — the inverse of zone and system |
yes | — |
port |
The object's distribution ports | yes | yes |
spaceBoundary |
The space boundaries of a space or element | yes | yes |
hasOpenings, hasFillings, fills, fillings |
Openings and fillings, multi forms (Openings and fillings) | yes | — |
The WHERE column says whether the relation can start a condition path (where#paths); every relation can be used in GET.
Dot form#
<relation>.<feature> reads one feature of the related object; for a multi-target relation, a list. Relations chain: spaceBoundary.relatedBuildingElement.attribute.Name.
GET qid, attribute.Name, parent.attribute.Name, typeObject.attribute.Name WHERE type = IFCDOORGET qid, attribute.Name, system.attribute.Name, port.attribute.Name WHERE type = IFCFLOWSEGMENTParenthesised form#
<relation>(<feature>, <feature>, ...) reads several features of the related object(s) as one nested record. A multi-target relation also accepts WHERE, GROUP BY, ORDER BY and LIMIT inside the parentheses, applied to the related set per object.
GET qid, buildingStorey(attribute.Name, attribute.Elevation) WHERE type = IFCWALLGET attribute.Name, children(qid, niceType, attribute.Name WHERE type IN (IFCDOOR, IFCWINDOW) ORDER BY attribute.Name LIMIT 10)
WHERE type = IFCBUILDINGSTOREYAggregates over a relation#
An aggregate in the parentheses summarises the related set per object. A numeric aggregate gives a number, usable in GET and as a WHERE operand (where#relation-aggregates). COUNT(children) counts direct children (get#special).
GET qid, attribute.Name, spaceBoundary(SUM(quantity.*.Area) WHERE type = IFCWINDOW) AS WindowArea, COUNT(children) AS Children WHERE type = IFCSPACECOUNT, FIRST and COLLECT work over a relation too: COUNT(qid) counts the related objects that pass the WHERE, FIRST(feature) is the feature of the first related object that has it, COLLECT(feature) the list of them (COLLECT(DISTINCT feature): every different one once). ORDER BY and LIMIT shape the related set before it is aggregated, so FIRST with ORDER BY is the arg-min (or, with DESC, the arg-max), and SUM with ORDER BY … DESC LIMIT 3 the sum of the three largest. GROUP BY does not combine with aggregates. In the record each value sits under the relation's name and the aggregate's text ("children": {"COUNT(qid)": …}), also with an alias (children(COUNT(qid) AS Spaces WHERE …)), which names the column in the answer's columns (get#nested, get#alias).
GET attribute.Name, children(COUNT(qid) WHERE type = IFCSPACE) AS Spaces, children(FIRST(attribute.Name) WHERE type = IFCSPACE ORDER BY calculated.quantity.floorArea) AS SmallestSpace WHERE type = IFCBUILDINGSTOREYGET attribute.Name, members(COUNT(qid) WHERE type = IFCSPACE) AS Spaces WHERE type = IFCZONEA single aggregate over a relation is what a virtual feature uses to give an object a value that comes from other objects.
Quantifiers in WHERE#
A multi-target relation in a condition needs a quantifier: .any(<condition>) (at least one related object matches), .all(<condition>) (every one does), or .count(<condition>) <comparator> <n>.
GET qid, attribute.Name WHERE type = IFCSPACE AND spaceBoundary.any(relatedBuildingElement.type = IFCWINDOW)GET qid, attribute.Name WHERE type = IFCBUILDINGSTOREY AND children.all(calculated.geometry.hasGeometry)GET qid, attribute.Name WHERE type = IFCSYSTEM AND children.count(type = IFCFLOWTERMINAL) > 10A single-target relation takes the condition directly: buildingStorey.attribute.Name = "Level 1", typeObject.attribute.Name CONTAINS "Double", decomposes.type = IFCCURTAINWALL.
children#
children are the objects one level below in the tree: spatially contained elements for a storey or space, parts for an assembly. allChildren descends the whole subtree; containmentChildren and decompositionChildren pick one of the two relationship kinds.
GET attribute.Name, COUNT(children) AS Direct, allChildren(qid, niceType) AS Everything WHERE type = IFCBUILDINGSTOREYSystems, zones, ports and space boundaries#
system and zone follow the group assignments of an object; port follows to its IfcDistributionPorts and from a port portConnectedTo reaches the connected port and portContainedIn the element that owns it; spaceBoundary returns the IfcRelSpaceBoundary objects of a space (or of a boundary element), and from a boundary relatedBuildingElement and space reach the two sides.
GET qid, port(qid, attribute.FlowDirection, portConnectedTo.portContainedIn.attribute.Name) WHERE type = IFCFLOWFITTINGGET system.attribute.Name, COLLECT(attribute.Name) GROUP BY system.attribute.Namedecomposition#
The decomposition feature returns the object's decomposition tree as nested records of qid, niceType and Name, without spelling out each level.
GET qid, attribute.Name, decomposition WHERE type = IFCCURTAINWALLUsed in#
- Relations — storeys, types, materials, children.