Short answer, I double checked and actually this is explicitly illegal. This is the exact code that defines it as being invalid in IFC (See WR41 in 5.4.3.68.4 Formal propositions).
Long answer: taking a step back, the reason it's a bit confusing is because IFC is documented in three ways:
-
The schema itself, which includes data types, cardinality, where rule definitions, and so on. If you do something that disobeys this, it is illegal and should not be supported. However, sometimes the data types are overly broad for technical practicality - this doesn't mean that you can use any combination you want, it's simply to make it easier to define. Also sometimes people forget to check the where rules, such as in this scenario.
-
The second layer on top is known as "concept templates". These are visualised in chapter 4: fundamental concepts and assumptions. It's not just diagrams, it's actually code behind it. So it defines the "grammar" of how are you allowed to use relationships. For example, it is technically legal to have an IfcRelAggregate that places a bridge inside a building storey, but it is assumed not to occur with any defined meaning because it is not permitted in any concept template (particularly spatial decomposition in chapter 4. Anything which doesn't follow a defined concept has undefined behaviour, so expect things to break and be unsupported :)
-
The final layer is the written documentation. This is the human readable text. It's surprisingly meaningful - every single sentence in there is there with a purpose, but it's a bit hard to read and it takes a while to get a "feel" of what the original authors intended. If there are interpretation ambiguities, often it is up to the original author to clarify (like Nick Nisbet from the previous post), and otherwise see if there is a way to ideally fix the ambiguity through improving a concept template or even the schema definition itself. Of importance here are the "Informal Propositions" they are things which have even more weight than the regular text because they are attempted to describe something logically black and white that cannot be expressed easily as a formal proposition (a where rule).
(There are also implementer agreements, but phased out in IFC4 and up)
So for those three things you do:
-
wall, structure, whatever... -> RelAssignsToGroup -> group ... this is completely fine. It is legal, and valid.
-
wall, structure, whatever... -> RelAggregates -> buildingStorey ... this is legal, but it is invalid. Chapter 4.1.4.1 defines how aggregation is meant to be used, and it is only allowed to be used within IfcElement <--> IfcElement, or IfcSpatialElement <--> IfcSpatialElement. If you want to do IfcElement <--> IfcSpatialElement, you need to use other relationships like ContainedIn or ReferencedIn. There are also informal propositions in the docs on the hierarchy of SpatialElements themselves (e.g. a building can be in a site, but not vice versa).
-
group -> RelAggregates -> buildingStorey ... like previous, it's invalid. Use RelAssignsToGroup :)
So now addressing:
Wouldn't that make the building structure part of the group, and not the opposite?
... no. There is no parent or child in this scenario. IFC defines relationships as being either hierarchical or non hierarchical. As you've correctly determined, aggregation is a hierarchical relationship, so the "children thingS" (plural) are part of the "parent thing" (single). Other hierarchical relationships are nesting, or same-type relationships group/subgroup, task/subtask, cost/subcost, etc. IFC uses an "ing" and "ed" convention to express 1:N relationships, but this does not mean hierarchical.
However RelAssignsToGroup is not hierarchical. It is similar to say a material relationship or a document reference relationship. It's just ... a relationship. A thing can be in zero, one, or many groups. In contrast, RelAggregates is hierarchical and a thing must exist once, and only once. The specific wording they use is:
The spatial project structure, established by the IfcRelAggregates, shall be acyclic.
So if you rely on an IfcGroup in that hierarchy, you break that rule because IfcGroups can be cyclic.
Now that the mumbo jumbo is out of the way, there's nothing stopping you visualising the RelAssignsToGroup as a (potentially cyclic) tree in FreeCAD. In fact, we do that in BBIM too as an option. By all means, use IfcGroup and it's a great thing and I think it's awesome to support a tree view where groups are the main organisation (note to self: we need to support it too!), so long as you also obey the rest of the IFC constraints (in that somewhere, there needs to be an acyclic aggregation hierarchy).