buildingSMART / IDS

Computer interpretable (XML) standard to define Information Delivery Specifications for BIM (mainly used for IFC)
Other
167 stars 52 forks source link

Prohibit all but specified classes #243

Closed abdoulayediak closed 2 months ago

abdoulayediak commented 3 months ago

I want to specify a short list of IFC classes and prohibit the rest. My current understanding of the doc is that I can only prohibit classes through explicit specifications. But in the use case I am talking about, that would mean prohibiting virtually all the classes of the standard. There must be a smarter way of doing this (hopefully).

CBenghi commented 2 months ago

This would restrict all to PROJECT, WALL and WINDOWS... mind you, this would be an illegal IFC.

<ids:applicability maxOccurs="unbounded">
    <ids:entity>
        <ids:name>
            <xs:restriction base="xs:string">
                <xs:pattern value="IFC\w+"/>
            </xs:restriction>
        </ids:name>
    </ids:entity>
</ids:applicability>
<ids:requirements>
    <ids:entity>
        <ids:name>
            <xs:restriction base="xs:string">
                <xs:enumeration value="IFCPROJECT"/>
                <xs:enumeration value="IFCWALL"/>
                <xs:enumeration value="IFCWINDOW"/>
            </xs:restriction>
        </ids:name>
    </ids:entity>
</ids:requirements>

Please close the issue if the response is clear.

abdoulayediak commented 2 months ago

Thanks for your reply. Could you please explain the logic of your answer? And is the detail of these tags (e.g., restrictions under name, etc.) documented somewhere? The documentation I am seeing in the Github is great for general understanding but a bit limited to allow me to understand what you did here.

CBenghi commented 2 months ago

Entities selected with the applicability will have to adhere to the requirements listed. In this case Applicability: all entities (the xs:pattern value="IFC\w+" means all entities whose name start's with IFC -> which is all of them). Have one requirement which states that they must be either IFCPROJECT, IFCWALL or IFCWINDOW.

To understand this you can think that if an IFCMATERIAL is present in the file, it matches the applicability. So It is then tested for all the requirements specified, but it will fail, because IFCMATERIAL is not in the list provided.

I hope this makes sense.

abdoulayediak commented 2 months ago

Sounds like an elegant approach! Thank you. Currently digging into the XSD to learn more, but I'd be happy to take any hint on more documentation (I'll close the issue though).