(*
Copyright by:
buildingSMART International Limited, 1996-2019

Any technical documentation made available by buildingSMART International Limited
is the copyrighted work of buildingSMART International Limited and is owned by the 
buildingSMART International Limited. It may be photocopied, used in software development, 
or translated into another computer language without prior written consent from 
buildingSMART International Limited provided that full attribution is given. 
Prior written consent is required if changes are made to the technical specification.

This material is delivered to you as is and buildingSMART International Limited makes 
no warranty of any kind with regard to it, including, but not limited to, the implied 
warranties as to its accuracy or fitness for a particular purpose. Any use of the 
technical documentation or the information contained therein is at the risk of the user. 
Documentation may include technical or other inaccuracies or typographical errors. 
buildingSMART International Limited shall not be liable for errors contained therein or 
for incidental consequential damages in connection with the furnishing, performance or use 
of the material. The information contained in this document is subject to change without notice.

Issue date:
Friday, July 26, 2019

*)

SCHEMA IFC4;

TYPE IfcStrippedOptional = BOOLEAN;
END_TYPE;

TYPE IfcArcIndex = LIST [3:3] OF IfcPositiveInteger;
END_TYPE;

TYPE IfcBoolean = BOOLEAN;
END_TYPE;

TYPE IfcCardinalPointReference = INTEGER;
 WHERE
	GreaterThanZero : SELF > 0;
END_TYPE;

TYPE IfcDateTime = STRING;
END_TYPE;

TYPE IfcDimensionCount = INTEGER;
 WHERE
	WR1 : { 0 < SELF <= 3 };
END_TYPE;

TYPE IfcGloballyUniqueId = STRING(22) FIXED;
END_TYPE;

TYPE IfcIdentifier = STRING(255);
END_TYPE;

TYPE IfcInteger = INTEGER;
END_TYPE;

TYPE IfcLabel = STRING(255);
END_TYPE;

TYPE IfcLanguageId = IfcIdentifier;
END_TYPE;

TYPE IfcLengthMeasure = REAL;
END_TYPE;

TYPE IfcLineIndex = LIST [2:?] OF IfcPositiveInteger;
END_TYPE;

TYPE IfcLogical = LOGICAL;
END_TYPE;

TYPE IfcNonNegativeLengthMeasure = IfcLengthMeasure;
 WHERE
	NotNegative : SELF >= 0.;
END_TYPE;

TYPE IfcNormalisedRatioMeasure = IfcRatioMeasure;
 WHERE
	WR1 : {0.0 <= SELF <= 1.0};
END_TYPE;

TYPE IfcParameterValue = REAL;
END_TYPE;

TYPE IfcPlaneAngleMeasure = REAL;
END_TYPE;

TYPE IfcPositiveInteger = IfcInteger;
 WHERE
	WR1 : SELF > 0;
END_TYPE;

TYPE IfcPositiveLengthMeasure = IfcLengthMeasure;
 WHERE
	WR1 : SELF > 0.;
END_TYPE;

TYPE IfcRatioMeasure = REAL;
END_TYPE;

TYPE IfcReal = REAL;
END_TYPE;

TYPE IfcSpecularExponent = REAL;
END_TYPE;

TYPE IfcText = STRING;
END_TYPE;

TYPE IfcTimeStamp = INTEGER;
END_TYPE;

TYPE IfcURIReference = STRING;
END_TYPE;

TYPE IfcAddressTypeEnum = ENUMERATION OF
	(OFFICE
	,SITE
	,HOME
	,DISTRIBUTIONPOINT
	,USERDEFINED);
END_TYPE;

TYPE IfcBSplineCurveForm = ENUMERATION OF
	(POLYLINE_FORM
	,CIRCULAR_ARC
	,ELLIPTIC_ARC
	,PARABOLIC_ARC
	,HYPERBOLIC_ARC
	,UNSPECIFIED);
END_TYPE;

TYPE IfcBSplineSurfaceForm = ENUMERATION OF
	(PLANE_SURF
	,CYLINDRICAL_SURF
	,CONICAL_SURF
	,SPHERICAL_SURF
	,TOROIDAL_SURF
	,SURF_OF_REVOLUTION
	,RULED_SURF
	,GENERALISED_CONE
	,QUADRIC_SURF
	,SURF_OF_LINEAR_EXTRUSION
	,UNSPECIFIED);
END_TYPE;

TYPE IfcBeamTypeEnum = ENUMERATION OF
	(BEAM
	,JOIST
	,HOLLOWCORE
	,LINTEL
	,SPANDREL
	,T_BEAM
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcBooleanOperator = ENUMERATION OF
	(UNION
	,INTERSECTION
	,DIFFERENCE);
END_TYPE;

TYPE IfcCableCarrierSegmentTypeEnum = ENUMERATION OF
	(CABLELADDERSEGMENT
	,CABLETRAYSEGMENT
	,CABLETRUNKINGSEGMENT
	,CONDUITSEGMENT
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcCableSegmentTypeEnum = ENUMERATION OF
	(BUSBARSEGMENT
	,CABLESEGMENT
	,CONDUCTORSEGMENT
	,CORESEGMENT
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcChangeActionEnum = ENUMERATION OF
	(NOCHANGE
	,MODIFIED
	,ADDED
	,DELETED
	,NOTDEFINED);
END_TYPE;

TYPE IfcColumnTypeEnum = ENUMERATION OF
	(COLUMN
	,PILASTER
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcConnectionTypeEnum = ENUMERATION OF
	(ATPATH
	,ATSTART
	,ATEND
	,NOTDEFINED);
END_TYPE;

TYPE IfcCurveInterpolationEnum = ENUMERATION OF
	(LINEAR
	,LOG_LINEAR
	,LOG_LOG
	,NOTDEFINED);
END_TYPE;

TYPE IfcDirectionSenseEnum = ENUMERATION OF
	(POSITIVE
	,NEGATIVE);
END_TYPE;

TYPE IfcDistributionPortTypeEnum = ENUMERATION OF
	(CABLE
	,CABLECARRIER
	,DUCT
	,PIPE
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcDistributionSystemEnum = ENUMERATION OF
	(AIRCONDITIONING
	,AUDIOVISUAL
	,CHEMICAL
	,CHILLEDWATER
	,COMMUNICATION
	,COMPRESSEDAIR
	,CONDENSERWATER
	,CONTROL
	,CONVEYING
	,DATA
	,DISPOSAL
	,DOMESTICCOLDWATER
	,DOMESTICHOTWATER
	,DRAINAGE
	,EARTHING
	,ELECTRICAL
	,ELECTROACOUSTIC
	,EXHAUST
	,FIREPROTECTION
	,FUEL
	,GAS
	,HAZARDOUS
	,HEATING
	,LIGHTING
	,LIGHTNINGPROTECTION
	,MUNICIPALSOLIDWASTE
	,OIL
	,OPERATIONAL
	,POWERGENERATION
	,RAINWATER
	,REFRIGERATION
	,SECURITY
	,SEWAGE
	,SIGNAL
	,STORMWATER
	,TELEPHONE
	,TV
	,VACUUM
	,VENT
	,VENTILATION
	,WASTEWATER
	,WATERSUPPLY
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcDuctSegmentTypeEnum = ENUMERATION OF
	(RIGIDSEGMENT
	,FLEXIBLESEGMENT
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcElementAssemblyTypeEnum = ENUMERATION OF
	(ACCESSORY_ASSEMBLY
	,ARCH
	,BEAM_GRID
	,BRACED_FRAME
	,GIRDER
	,REINFORCEMENT_UNIT
	,RIGID_FRAME
	,SLAB_FIELD
	,TRUSS
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcFlowDirectionEnum = ENUMERATION OF
	(SOURCE
	,SINK
	,SOURCEANDSINK
	,NOTDEFINED);
END_TYPE;

TYPE IfcKnotType = ENUMERATION OF
	(UNIFORM_KNOTS
	,QUASI_UNIFORM_KNOTS
	,PIECEWISE_BEZIER_KNOTS
	,UNSPECIFIED);
END_TYPE;

TYPE IfcLayerSetDirectionEnum = ENUMERATION OF
	(AXIS1
	,AXIS2
	,AXIS3);
END_TYPE;

TYPE IfcMemberTypeEnum = ENUMERATION OF
	(BRACE
	,CHORD
	,COLLAR
	,MEMBER
	,MULLION
	,PLATE
	,POST
	,PURLIN
	,RAFTER
	,STRINGER
	,STRUT
	,STUD
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcPipeSegmentTypeEnum = ENUMERATION OF
	(CULVERT
	,FLEXIBLESEGMENT
	,RIGIDSEGMENT
	,GUTTER
	,SPOOL
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcPlateTypeEnum = ENUMERATION OF
	(CURTAIN_PANEL
	,SHEET
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcProfileTypeEnum = ENUMERATION OF
	(CURVE
	,AREA);
END_TYPE;

TYPE IfcProjectionElementTypeEnum = ENUMERATION OF
	(USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcPropertySetTemplateTypeEnum = ENUMERATION OF
	(PSET_TYPEDRIVENONLY
	,PSET_TYPEDRIVENOVERRIDE
	,PSET_OCCURRENCEDRIVEN
	,PSET_PERFORMANCEDRIVEN
	,QTO_TYPEDRIVENONLY
	,QTO_TYPEDRIVENOVERRIDE
	,QTO_OCCURRENCEDRIVEN
	,NOTDEFINED);
END_TYPE;

TYPE IfcReflectanceMethodEnum = ENUMERATION OF
	(BLINN
	,FLAT
	,GLASS
	,MATT
	,METAL
	,MIRROR
	,PHONG
	,PLASTIC
	,STRAUSS
	,NOTDEFINED);
END_TYPE;

TYPE IfcRoleEnum = ENUMERATION OF
	(SUPPLIER
	,MANUFACTURER
	,CONTRACTOR
	,SUBCONTRACTOR
	,ARCHITECT
	,STRUCTURALENGINEER
	,COSTENGINEER
	,CLIENT
	,BUILDINGOWNER
	,BUILDINGOPERATOR
	,MECHANICALENGINEER
	,ELECTRICALENGINEER
	,PROJECTMANAGER
	,FACILITIESMANAGER
	,CIVILENGINEER
	,COMMISSIONINGENGINEER
	,ENGINEER
	,OWNER
	,CONSULTANT
	,CONSTRUCTIONMANAGER
	,FIELDCONSTRUCTIONMANAGER
	,RESELLER
	,USERDEFINED);
END_TYPE;

TYPE IfcSimplePropertyTemplateTypeEnum = ENUMERATION OF
	(P_SINGLEVALUE
	,P_ENUMERATEDVALUE
	,P_BOUNDEDVALUE
	,P_LISTVALUE
	,P_TABLEVALUE
	,P_REFERENCEVALUE
	,Q_LENGTH
	,Q_AREA
	,Q_VOLUME
	,Q_COUNT
	,Q_WEIGHT
	,Q_TIME);
END_TYPE;

TYPE IfcSlabTypeEnum = ENUMERATION OF
	(FLOOR
	,ROOF
	,LANDING
	,BASESLAB
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcStateEnum = ENUMERATION OF
	(READWRITE
	,READONLY
	,LOCKED
	,READWRITELOCKED
	,READONLYLOCKED);
END_TYPE;

TYPE IfcSurfaceSide = ENUMERATION OF
	(POSITIVE
	,NEGATIVE
	,BOTH);
END_TYPE;

TYPE IfcWallTypeEnum = ENUMERATION OF
	(MOVABLE
	,PARAPET
	,PARTITIONING
	,PLUMBINGWALL
	,SHEAR
	,SOLIDWALL
	,STANDARD
	,POLYGONAL
	,ELEMENTEDWALL
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcActorSelect = SELECT
	(IfcOrganization
	,IfcPerson
	,IfcPersonAndOrganization);
END_TYPE;

TYPE IfcAxis2Placement = SELECT
	(IfcAxis2Placement2D
	,IfcAxis2Placement3D);
END_TYPE;

TYPE IfcBooleanOperand = SELECT
	(IfcBooleanResult
	,IfcCsgPrimitive3D
	,IfcHalfSpaceSolid
	,IfcSolidModel
	,IfcTessellatedFaceSet);
END_TYPE;

TYPE IfcColour = SELECT
	(IfcColourSpecification);
END_TYPE;

TYPE IfcColourOrFactor = SELECT
	(IfcColourRgb
	,IfcNormalisedRatioMeasure);
END_TYPE;

TYPE IfcCsgSelect = SELECT
	(IfcBooleanResult
	,IfcCsgPrimitive3D);
END_TYPE;

TYPE IfcCurveOrEdgeCurve = SELECT
	(IfcBoundedCurve
	,IfcEdgeCurve);
END_TYPE;

TYPE IfcDefinitionSelect = SELECT
	(IfcObjectDefinition
	,IfcPropertyDefinition);
END_TYPE;

TYPE IfcGridPlacementDirectionSelect = SELECT
	(IfcDirection
	,IfcVirtualGridIntersection);
END_TYPE;

TYPE IfcLibrarySelect = SELECT
	(IfcLibraryInformation
	,IfcLibraryReference);
END_TYPE;

TYPE IfcMaterialSelect = SELECT
	(IfcMaterialDefinition
	,IfcMaterialUsageDefinition);
END_TYPE;

TYPE IfcMeasureValue = SELECT
	(IfcLengthMeasure
	,IfcNonNegativeLengthMeasure
	,IfcNormalisedRatioMeasure
	,IfcParameterValue
	,IfcPlaneAngleMeasure
	,IfcPositiveLengthMeasure
	,IfcRatioMeasure);
END_TYPE;

TYPE IfcSegmentIndexSelect = SELECT
	(IfcArcIndex
	,IfcLineIndex);
END_TYPE;

TYPE IfcSimpleValue = SELECT
	(IfcBoolean
	,IfcDateTime
	,IfcIdentifier
	,IfcInteger
	,IfcLabel
	,IfcLogical
	,IfcPositiveInteger
	,IfcReal
	,IfcText
	,IfcTimeStamp);
END_TYPE;

TYPE IfcSolidOrShell = SELECT
	(IfcClosedShell
	,IfcSolidModel);
END_TYPE;

TYPE IfcSpecularHighlightSelect = SELECT
	(IfcSpecularExponent);
END_TYPE;

TYPE IfcStyleAssignmentSelect = SELECT
	(IfcPresentationStyle);
END_TYPE;

TYPE IfcSurfaceStyleElementSelect = SELECT
	(IfcSurfaceStyleShading);
END_TYPE;

TYPE IfcUnit = SELECT
);
END_TYPE;

TYPE IfcValue = SELECT
	(IfcMeasureValue
	,IfcSimpleValue);
END_TYPE;

ENTITY IfcActorRole;
	Role : IfcRoleEnum;
	UserDefinedRole : OPTIONAL IfcLabel;
	Description : OPTIONAL IfcText;
 WHERE
	WR1 : (Role <> IfcRoleEnum.USERDEFINED) OR
((Role = IfcRoleEnum.USERDEFINED) AND
  EXISTS(SELF.UserDefinedRole));
END_ENTITY;

ENTITY IfcAddress
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcTelecomAddress));
	Purpose : OPTIONAL IfcAddressTypeEnum;
	Description : OPTIONAL IfcText;
	UserDefinedPurpose : OPTIONAL IfcLabel;
 INVERSE
	OfPerson : SET [0:?] OF IfcPerson FOR Addresses;
	OfOrganization : SET [0:?] OF IfcOrganization FOR Addresses;
 WHERE
	WR1 : (NOT(EXISTS(Purpose))) OR
((Purpose <> IfcAddressTypeEnum.USERDEFINED) OR
((Purpose = IfcAddressTypeEnum.USERDEFINED) AND
  EXISTS(SELF.UserDefinedPurpose)));
END_ENTITY;

ENTITY IfcAdvancedBrep
 SUBTYPE OF (IfcManifoldSolidBrep);
 WHERE
	HasAdvancedFaces : SIZEOF(QUERY(Afs <* SELF\IfcManifoldSolidBrep.Outer.CfsFaces |
  (NOT ('IFC4.IFCADVANCEDFACE' IN TYPEOF(Afs)))
)) = 0;
END_ENTITY;

ENTITY IfcAdvancedFace
 SUBTYPE OF (IfcFaceSurface);
 WHERE
	ApplicableSurface : SIZEOF (
['IFC4.IFCELEMENTARYSURFACE',
 'IFC4.IFCSWEPTSURFACE',
 'IFC4.IFCBSPLINESURFACE'] *
TYPEOF(SELF\IfcFaceSurface.FaceSurface)) = 1;
	RequiresEdgeCurve : SIZEOF(QUERY (ElpFbnds <* 
  QUERY (Bnds <* SELF\IfcFace.Bounds |
    'IFC4.IFCEDGELOOP' IN TYPEOF(Bnds.Bound)) |
     NOT (SIZEOF (QUERY (Oe <* ElpFbnds.Bound\IfcEdgeLoop.EdgeList |
       NOT('IFC4.IFCEDGECURVE' IN 
       TYPEOF(Oe\IfcOrientedEdge.EdgeElement)
  ))) = 0
))) = 0;
	ApplicableEdgeCurves : SIZEOF(QUERY (ElpFbnds <* 
  QUERY (Bnds <* SELF\IfcFace.Bounds |
    'IFC4.IFCEDGELOOP' IN TYPEOF(Bnds.Bound)) |
     NOT (SIZEOF (QUERY (Oe <* ElpFbnds.Bound\IfcEdgeLoop.EdgeList |
       NOT (SIZEOF (['IFC4.IFCLINE',
                     'IFC4.IFCCONIC',
                     'IFC4.IFCPOLYLINE',
                     'IFC4.IFCBSPLINECURVE'] *
         TYPEOF(Oe\IfcOrientedEdge.EdgeElement\IfcEdgeCurve.EdgeGeometry)) = 1 )
  )) = 0
))) = 0;
END_ENTITY;

ENTITY IfcApplication;
	ApplicationDeveloper : IfcOrganization;
	Version : IfcLabel;
	ApplicationFullName : IfcLabel;
	ApplicationIdentifier : IfcIdentifier;
 UNIQUE
	UR1 : ApplicationIdentifier;
	UR2 : ApplicationFullName, Version;
END_ENTITY;

ENTITY IfcArbitraryClosedProfileDef
 SUPERTYPE OF (ONEOF
    (IfcArbitraryProfileDefWithVoids))
 SUBTYPE OF (IfcProfileDef);
	OuterCurve : IfcCurve;
 WHERE
	WR1 : OuterCurve.Dim = 2;
	WR2 : NOT('IFC4.IFCLINE' IN TYPEOF(OuterCurve));
	WR3 : NOT('IFC4.IFCOFFSETCURVE2D' IN TYPEOF(OuterCurve));
END_ENTITY;

ENTITY IfcArbitraryProfileDefWithVoids
 SUBTYPE OF (IfcArbitraryClosedProfileDef);
	InnerCurves : SET [1:?] OF IfcCurve;
 WHERE
	WR1 : SELF\IfcProfileDef.ProfileType = AREA;
	WR2 : SIZEOF(QUERY(temp <* InnerCurves | temp.Dim <> 2)) = 0;
	WR3 : SIZEOF(QUERY(temp <* InnerCurves | 'IFC4.IFCLINE' IN TYPEOF(temp))) = 0;
END_ENTITY;

ENTITY IfcAsymmetricIShapeProfileDef
 SUBTYPE OF (IfcParameterizedProfileDef);
	BottomFlangeWidth : IfcPositiveLengthMeasure;
	OverallDepth : IfcPositiveLengthMeasure;
	WebThickness : IfcPositiveLengthMeasure;
	BottomFlangeThickness : IfcPositiveLengthMeasure;
	BottomFlangeFilletRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	TopFlangeWidth : IfcPositiveLengthMeasure;
	TopFlangeThickness : OPTIONAL IfcPositiveLengthMeasure;
	TopFlangeFilletRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	BottomFlangeEdgeRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	BottomFlangeSlope : OPTIONAL IfcPlaneAngleMeasure;
	TopFlangeEdgeRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	TopFlangeSlope : OPTIONAL IfcPlaneAngleMeasure;
 WHERE
	ValidFlangeThickness : NOT(EXISTS(TopFlangeThickness)) OR ((BottomFlangeThickness + TopFlangeThickness) < OverallDepth);
	ValidWebThickness : (WebThickness < BottomFlangeWidth) AND (WebThickness < TopFlangeWidth);
	ValidBottomFilletRadius : (NOT(EXISTS(BottomFlangeFilletRadius))) OR 
(BottomFlangeFilletRadius <= (BottomFlangeWidth - WebThickness)/2.);
	ValidTopFilletRadius : (NOT(EXISTS(TopFlangeFilletRadius))) OR 
(TopFlangeFilletRadius <= (TopFlangeWidth - WebThickness)/2.);
END_ENTITY;

ENTITY IfcAxis1Placement
 SUBTYPE OF (IfcPlacement);
	Axis : OPTIONAL IfcDirection;
 DERIVE
	Z : IfcDirection := NVL (IfcNormalise(Axis), IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcDirection([0.0,0.0,1.0]));
 WHERE
	AxisIs3D : (NOT (EXISTS (Axis))) OR (Axis.Dim = 3);
	LocationIs3D : SELF\IfcPlacement.Location.Dim = 3;
END_ENTITY;

ENTITY IfcAxis2Placement2D
 SUBTYPE OF (IfcPlacement);
	RefDirection : OPTIONAL IfcDirection;
 DERIVE
	P : LIST [2:2] OF IfcDirection := IfcBuild2Axes(RefDirection);
 WHERE
	RefDirIs2D : (NOT (EXISTS (RefDirection))) OR (RefDirection.Dim = 2);
	LocationIs2D : SELF\IfcPlacement.Location.Dim = 2;
END_ENTITY;

ENTITY IfcAxis2Placement3D
 SUBTYPE OF (IfcPlacement);
	Axis : OPTIONAL IfcDirection;
	RefDirection : OPTIONAL IfcDirection;
 DERIVE
	P : LIST [3:3] OF IfcDirection := IfcBuildAxes(Axis, RefDirection);
 WHERE
	LocationIs3D : SELF\IfcPlacement.Location.Dim = 3;
	AxisIs3D : (NOT (EXISTS (Axis))) OR (Axis.Dim = 3);
	RefDirIs3D : (NOT (EXISTS (RefDirection))) OR (RefDirection.Dim = 3);
	AxisToRefDirPosition : (NOT (EXISTS (Axis))) OR (NOT (EXISTS (RefDirection))) OR (IfcCrossProduct(Axis,RefDirection).Magnitude > 0.0);
	AxisAndRefDirProvision : NOT ((EXISTS (Axis)) XOR (EXISTS (RefDirection)));
END_ENTITY;

ENTITY IfcBSplineCurve
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBSplineCurveWithKnots))
 SUBTYPE OF (IfcBoundedCurve);
	Degree : IfcInteger;
	ControlPointsList : LIST [2:?] OF IfcCartesianPoint;
	CurveForm : IfcBSplineCurveForm;
	ClosedCurve : IfcLogical;
	SelfIntersect : IfcLogical;
 DERIVE
	UpperIndexOnControlPoints : IfcInteger := (SIZEOF(ControlPointsList) - 1);
	ControlPoints : ARRAY [0:UpperIndexOnControlPoints] OF IfcCartesianPoint := IfcListToArray(ControlPointsList,0,UpperIndexOnControlPoints);
 WHERE
	SameDim : SIZEOF(QUERY(Temp <* ControlPointsList |
  Temp.Dim <> ControlPointsList[1].Dim))
= 0;
END_ENTITY;

ENTITY IfcBSplineCurveWithKnots
 SUPERTYPE OF (ONEOF
    (IfcRationalBSplineCurveWithKnots))
 SUBTYPE OF (IfcBSplineCurve);
	KnotMultiplicities : LIST [2:?] OF IfcInteger;
	Knots : LIST [2:?] OF IfcParameterValue;
	KnotSpec : IfcKnotType;
 DERIVE
	UpperIndexOnKnots : IfcInteger := SIZEOF(Knots);
 WHERE
	ConsistentBSpline : IfcConstraintsParamBSpline(Degree, UpperIndexOnKnots,
UpperIndexOnControlPoints, KnotMultiplicities, Knots);
	CorrespondingKnotLists : SIZEOF(KnotMultiplicities) = UpperIndexOnKnots;
END_ENTITY;

ENTITY IfcBSplineSurface
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBSplineSurfaceWithKnots))
 SUBTYPE OF (IfcBoundedSurface);
	UDegree : IfcInteger;
	VDegree : IfcInteger;
	ControlPointsList : LIST [2:?] OF LIST [2:?] OF IfcCartesianPoint;
	SurfaceForm : IfcBSplineSurfaceForm;
	UClosed : IfcLogical;
	VClosed : IfcLogical;
	SelfIntersect : IfcLogical;
 DERIVE
	UUpper : IfcInteger := SIZEOF(ControlPointsList) - 1;
	VUpper : IfcInteger := SIZEOF(ControlPointsList[1]) - 1;
	ControlPoints : ARRAY [0:UUpper] OF ARRAY [0:VUpper] OF IfcCartesianPoint := IfcMakeArrayOfArray(ControlPointsList,
0,UUpper,0,VUpper);
END_ENTITY;

ENTITY IfcBSplineSurfaceWithKnots
 SUPERTYPE OF (ONEOF
    (IfcRationalBSplineSurfaceWithKnots))
 SUBTYPE OF (IfcBSplineSurface);
	UMultiplicities : LIST [2:?] OF IfcInteger;
	VMultiplicities : LIST [2:?] OF IfcInteger;
	UKnots : LIST [2:?] OF IfcParameterValue;
	VKnots : LIST [2:?] OF IfcParameterValue;
	KnotSpec : IfcKnotType;
 DERIVE
	KnotVUpper : IfcInteger := SIZEOF(VKnots);
	KnotUUpper : IfcInteger := SIZEOF(UKnots);
 WHERE
	UDirectionConstraints : IfcConstraintsParamBSpline (
  SELF\IfcBSplineSurface.UDegree, KnotUUpper, 
  SELF\IfcBSplineSurface.UUpper, UMultiplicities, UKnots);
	VDirectionConstraints : IfcConstraintsParamBSpline (
  SELF\IfcBSplineSurface.VDegree, KnotVUpper, 
  SELF\IfcBSplineSurface.VUpper, VMultiplicities, VKnots);
	CorrespondingULists : SIZEOF(UMultiplicities) = KnotUUpper;
	CorrespondingVLists : SIZEOF(VMultiplicities) = KnotVUpper;
END_ENTITY;

ENTITY IfcBeam
 SUPERTYPE OF (ONEOF
    (IfcBeamStandardCase))
 SUBTYPE OF (IfcBuildingElement);
	PredefinedType : OPTIONAL IfcStrippedOptional;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR
 (PredefinedType <> IfcBeamTypeEnum.USERDEFINED) OR
 ((PredefinedType = IfcBeamTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFC4.IFCBEAMTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcBeamStandardCase
 SUBTYPE OF (IfcBeam);
 WHERE
	HasMaterialProfileSetUsage : SIZEOF (QUERY(temp <* USEDIN(SELF, 'IFC4.IFCRELASSOCIATES.RELATEDOBJECTS') |
              ('IFC4.IFCRELASSOCIATESMATERIAL' IN TYPEOF(temp)) AND
              ('IFC4.IFCMATERIALPROFILESETUSAGE' IN TYPEOF(temp.RelatingMaterial))
              )) = 1;
END_ENTITY;

ENTITY IfcBeamType
 SUBTYPE OF (IfcBuildingElementType);
	PredefinedType : IfcBeamTypeEnum;
 WHERE
	CorrectPredefinedType : (PredefinedType <> IfcBeamTypeEnum.USERDEFINED) OR
((PredefinedType = IfcBeamTypeEnum.USERDEFINED) AND EXISTS(SELF\IfcElementType.ElementType));
END_ENTITY;

ENTITY IfcBlock
 SUBTYPE OF (IfcCsgPrimitive3D);
	XLength : IfcPositiveLengthMeasure;
	YLength : IfcPositiveLengthMeasure;
	ZLength : IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcBooleanClippingResult
 SUBTYPE OF (IfcBooleanResult);
 WHERE
	FirstOperandType : ('IFC4.IFCSWEPTAREASOLID' IN TYPEOF(FirstOperand)) OR 
('IFC4.IFCSWEPTDISCSOLID' IN TYPEOF(FirstOperand)) OR 
('IFC4.IFCBOOLEANCLIPPINGRESULT' IN TYPEOF(FirstOperand));
	SecondOperandType : ('IFC4.IFCHALFSPACESOLID' IN TYPEOF(SecondOperand));
	OperatorType : Operator = DIFFERENCE;
END_ENTITY;

ENTITY IfcBooleanResult
 SUPERTYPE OF (ONEOF
    (IfcBooleanClippingResult))
 SUBTYPE OF (IfcGeometricRepresentationItem);
	Operator : IfcBooleanOperator;
	FirstOperand : IfcBooleanOperand;
	SecondOperand : IfcBooleanOperand;
 DERIVE
	Dim : IfcDimensionCount := FirstOperand.Dim;
 WHERE
	SameDim : FirstOperand.Dim = SecondOperand.Dim;
	FirstOperandClosed : NOT('IFC4.IFCTESSELLATEDFACESET' IN TYPEOF(FirstOperand)) OR (EXISTS(FirstOperand.Closed) AND FirstOperand.Closed);
	SecondOperandClosed : NOT('IFC4.IFCTESSELLATEDFACESET' IN TYPEOF(SecondOperand)) OR (EXISTS(SecondOperand.Closed) AND SecondOperand.Closed);
END_ENTITY;

ENTITY IfcBoundedCurve
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBSplineCurve
    ,IfcIndexedPolyCurve
    ,IfcPolyline))
 SUBTYPE OF (IfcCurve);
END_ENTITY;

ENTITY IfcBoundedSurface
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBSplineSurface))
 SUBTYPE OF (IfcSurface);
END_ENTITY;

ENTITY IfcBuildingElement
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBeam
    ,IfcColumn
    ,IfcCovering
    ,IfcDoor
    ,IfcFooting
    ,IfcMember
    ,IfcPile
    ,IfcPlate
    ,IfcSlab
    ,IfcWall
    ,IfcWindow))
 SUBTYPE OF (IfcElement);
 WHERE
	MaxOneMaterialAssociation : SIZEOF (QUERY(temp <* SELF\IfcObjectDefinition.HasAssociations |
  'IFC4.IFCRELASSOCIATESMATERIAL' IN TYPEOF(temp)
  )) <= 1;
END_ENTITY;

ENTITY IfcBuildingElementType
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBeamType
    ,IfcColumnType
    ,IfcMemberType
    ,IfcPlateType
    ,IfcSlabType
    ,IfcWallType))
 SUBTYPE OF (IfcElementType);
END_ENTITY;

ENTITY IfcCShapeProfileDef
 SUBTYPE OF (IfcParameterizedProfileDef);
	Depth : IfcPositiveLengthMeasure;
	Width : IfcPositiveLengthMeasure;
	WallThickness : IfcPositiveLengthMeasure;
	Girth : IfcPositiveLengthMeasure;
	InternalFilletRadius : OPTIONAL IfcNonNegativeLengthMeasure;
 WHERE
	ValidGirth : Girth < (Depth / 2.);
	ValidInternalFilletRadius : NOT(EXISTS(InternalFilletRadius)) OR
((InternalFilletRadius <= Width/2. - WallThickness) AND (InternalFilletRadius <= Depth/2. - WallThickness));
	ValidWallThickness : (WallThickness < Width/2.) AND (WallThickness < Depth/2.);
END_ENTITY;

ENTITY IfcCableCarrierSegment
 SUBTYPE OF (IfcFlowSegment);
	PredefinedType : OPTIONAL IfcCableCarrierSegmentTypeEnum;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR 
 (PredefinedType <> IfcCableCarrierSegmentTypeEnum.USERDEFINED) OR 
 ((PredefinedType = IfcCableCarrierSegmentTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR 
  ('IFC4.IFCCABLECARRIERSEGMENTTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcCableSegment
 SUBTYPE OF (IfcFlowSegment);
	PredefinedType : OPTIONAL IfcCableSegmentTypeEnum;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR 
 (PredefinedType <> IfcCableSegmentTypeEnum.USERDEFINED) OR 
 ((PredefinedType = IfcCableSegmentTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR 
  ('IFC4.IFCCABLESEGMENTTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcCartesianPoint
 SUBTYPE OF (IfcPoint);
	Coordinates : LIST [1:3] OF IfcLengthMeasure;
 DERIVE
	Dim : IfcDimensionCount := HIINDEX(Coordinates);
 WHERE
	CP2Dor3D : HIINDEX(Coordinates) >= 2;
END_ENTITY;

ENTITY IfcCartesianPointList
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcCartesianPointList2D
    ,IfcCartesianPointList3D))
 SUBTYPE OF (IfcGeometricRepresentationItem);
 DERIVE
	Dim : IfcDimensionCount := IfcPointListDim(SELF);
END_ENTITY;

ENTITY IfcCartesianPointList2D
 SUBTYPE OF (IfcCartesianPointList);
	CoordList : LIST [1:?] OF LIST [2:2] OF IfcLengthMeasure;
END_ENTITY;

ENTITY IfcCartesianPointList3D
 SUBTYPE OF (IfcCartesianPointList);
	CoordList : LIST [1:?] OF LIST [3:3] OF IfcLengthMeasure;
END_ENTITY;

ENTITY IfcCartesianTransformationOperator
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcCartesianTransformationOperator2D
    ,IfcCartesianTransformationOperator3D))
 SUBTYPE OF (IfcGeometricRepresentationItem);
	Axis1 : OPTIONAL IfcDirection;
	Axis2 : OPTIONAL IfcDirection;
	LocalOrigin : IfcCartesianPoint;
	Scale : OPTIONAL IfcReal;
 DERIVE
	Scl : IfcReal := NVL(Scale, 1.0);
	Dim : IfcDimensionCount := LocalOrigin.Dim;
 WHERE
	ScaleGreaterZero : Scl > 0.0;
END_ENTITY;

ENTITY IfcCartesianTransformationOperator2D
 SUPERTYPE OF (ONEOF
    (IfcCartesianTransformationOperator2DnonUniform))
 SUBTYPE OF (IfcCartesianTransformationOperator);
 DERIVE
	U : LIST [2:2] OF IfcDirection := IfcBaseAxis(2,SELF\IfcCartesianTransformationOperator.Axis1,
SELF\IfcCartesianTransformationOperator.Axis2,?);
 WHERE
	DimEqual2 : SELF\IfcCartesianTransformationOperator.Dim = 2;
	Axis1Is2D : NOT(EXISTS(SELF\IfcCartesianTransformationOperator.Axis1)) OR 
(SELF\IfcCartesianTransformationOperator.Axis1.Dim = 2);
	Axis2Is2D : NOT(EXISTS(SELF\IfcCartesianTransformationOperator.Axis2)) OR 
(SELF\IfcCartesianTransformationOperator.Axis2.Dim = 2);
END_ENTITY;

ENTITY IfcCartesianTransformationOperator2DnonUniform
 SUBTYPE OF (IfcCartesianTransformationOperator2D);
	Scale2 : OPTIONAL IfcReal;
 DERIVE
	Scl2 : IfcReal := NVL(Scale2, SELF\IfcCartesianTransformationOperator.Scl);
 WHERE
	Scale2GreaterZero : Scl2 > 0.0;
END_ENTITY;

ENTITY IfcCartesianTransformationOperator3D
 SUPERTYPE OF (ONEOF
    (IfcCartesianTransformationOperator3DnonUniform))
 SUBTYPE OF (IfcCartesianTransformationOperator);
	Axis3 : OPTIONAL IfcDirection;
 DERIVE
	U : LIST [3:3] OF IfcDirection := IfcBaseAxis(3,SELF\IfcCartesianTransformationOperator.Axis1,
SELF\IfcCartesianTransformationOperator.Axis2,Axis3);
 WHERE
	DimIs3D : SELF\IfcCartesianTransformationOperator.Dim = 3;
	Axis1Is3D : NOT(EXISTS(SELF\IfcCartesianTransformationOperator.Axis1)) OR 
(SELF\IfcCartesianTransformationOperator.Axis1.Dim = 3);
	Axis2Is3D : NOT(EXISTS(SELF\IfcCartesianTransformationOperator.Axis2)) OR 
(SELF\IfcCartesianTransformationOperator.Axis2.Dim = 3);
	Axis3Is3D : NOT(EXISTS(Axis3)) OR (Axis3.Dim = 3);
END_ENTITY;

ENTITY IfcCartesianTransformationOperator3DnonUniform
 SUBTYPE OF (IfcCartesianTransformationOperator3D);
	Scale2 : OPTIONAL IfcReal;
	Scale3 : OPTIONAL IfcReal;
 DERIVE
	Scl2 : IfcReal := NVL(Scale2, SELF\IfcCartesianTransformationOperator.Scl);
	Scl3 : IfcReal := NVL(Scale3, SELF\IfcCartesianTransformationOperator.Scl);
 WHERE
	Scale2GreaterZero : Scl2 > 0.0;
	Scale3GreaterZero : Scl3 > 0.0;
END_ENTITY;

ENTITY IfcCircleHollowProfileDef
 SUBTYPE OF (IfcCircleProfileDef);
	WallThickness : IfcPositiveLengthMeasure;
 WHERE
	WR1 : WallThickness < SELF\IfcCircleProfileDef.Radius;
END_ENTITY;

ENTITY IfcCircleProfileDef
 SUPERTYPE OF (ONEOF
    (IfcCircleHollowProfileDef))
 SUBTYPE OF (IfcParameterizedProfileDef);
	Radius : IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcClosedShell
 SUBTYPE OF (IfcConnectedFaceSet);
END_ENTITY;

ENTITY IfcColourRgb
 SUBTYPE OF (IfcColourSpecification);
	Red : IfcNormalisedRatioMeasure;
	Green : IfcNormalisedRatioMeasure;
	Blue : IfcNormalisedRatioMeasure;
END_ENTITY;

ENTITY IfcColourRgbList
 SUBTYPE OF (IfcPresentationItem);
	ColourList : LIST [1:?] OF LIST [3:3] OF IfcNormalisedRatioMeasure;
END_ENTITY;

ENTITY IfcColourSpecification
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcColourRgb))
 SUBTYPE OF (IfcPresentationItem);
	Name : OPTIONAL IfcLabel;
END_ENTITY;

ENTITY IfcColumn
 SUPERTYPE OF (ONEOF
    (IfcColumnStandardCase))
 SUBTYPE OF (IfcBuildingElement);
	PredefinedType : OPTIONAL IfcStrippedOptional;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR
 (PredefinedType <> IfcColumnTypeEnum.USERDEFINED) OR
 ((PredefinedType = IfcColumnTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFC4.IFCCOLUMNTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcColumnStandardCase
 SUBTYPE OF (IfcColumn);
 WHERE
	HasMaterialProfileSetUsage : SIZEOF (QUERY(temp <* USEDIN(SELF, 'IFC4.IFCRELASSOCIATES.RELATEDOBJECTS') |
              ('IFC4.IFCRELASSOCIATESMATERIAL' IN TYPEOF(temp)) AND
              ('IFC4.IFCMATERIALPROFILESETUSAGE' IN TYPEOF(temp.RelatingMaterial))
              )) = 1;
END_ENTITY;

ENTITY IfcColumnType
 SUBTYPE OF (IfcBuildingElementType);
	PredefinedType : IfcColumnTypeEnum;
 WHERE
	CorrectPredefinedType : (PredefinedType <> IfcColumnTypeEnum.USERDEFINED) OR
((PredefinedType = IfcColumnTypeEnum.USERDEFINED) AND EXISTS(SELF\IfcElementType.ElementType));
END_ENTITY;

ENTITY IfcCompositeProfileDef
 SUBTYPE OF (IfcProfileDef);
	Profiles : SET [2:?] OF IfcProfileDef;
	Label : OPTIONAL IfcLabel;
 WHERE
	InvariantProfileType : SIZEOF(QUERY(temp <* Profiles | temp.ProfileType <> Profiles[1].ProfileType)) = 0;
	NoRecursion : SIZEOF(QUERY(temp <* Profiles | 'IFC4.IFCCOMPOSITEPROFILEDEF' IN TYPEOF(temp))) = 0;
END_ENTITY;

ENTITY IfcConnectedFaceSet
 SUPERTYPE OF (ONEOF
    (IfcClosedShell))
 SUBTYPE OF (IfcTopologicalRepresentationItem);
	CfsFaces : SET [1:?] OF IfcFace;
END_ENTITY;

ENTITY IfcConnectionCurveGeometry
 SUBTYPE OF (IfcConnectionGeometry);
	CurveOnRelatingElement : IfcCurveOrEdgeCurve;
	CurveOnRelatedElement : OPTIONAL IfcCurveOrEdgeCurve;
END_ENTITY;

ENTITY IfcConnectionGeometry
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcConnectionCurveGeometry
    ,IfcConnectionVolumeGeometry));
END_ENTITY;

ENTITY IfcConnectionVolumeGeometry
 SUBTYPE OF (IfcConnectionGeometry);
	VolumeOnRelatingElement : IfcSolidOrShell;
	VolumeOnRelatedElement : OPTIONAL IfcStrippedOptional;
END_ENTITY;

ENTITY IfcContext
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcProject
    ,IfcProjectLibrary))
 SUBTYPE OF (IfcObjectDefinition);
	ObjectType : OPTIONAL IfcLabel;
	LongName : OPTIONAL IfcLabel;
	Phase : OPTIONAL IfcLabel;
	RepresentationContexts : OPTIONAL SET [1:?] OF IfcStrippedOptional;
	UnitsInContext : OPTIONAL IfcStrippedOptional;
 INVERSE
	Declares : SET [0:?] OF IfcRelDeclares FOR RelatingContext;
END_ENTITY;

ENTITY IfcCovering
 SUBTYPE OF (IfcBuildingElement);
	PredefinedType : OPTIONAL IfcStrippedOptional;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR 
 (PredefinedType <> IfcCoveringTypeEnum.USERDEFINED) OR 
 ((PredefinedType = IfcCoveringTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFC4.IFCCOVERINGTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcCsgPrimitive3D
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBlock
    ,IfcRectangularPyramid
    ,IfcRightCircularCone
    ,IfcRightCircularCylinder
    ,IfcSphere))
 SUBTYPE OF (IfcGeometricRepresentationItem);
	Position : IfcAxis2Placement3D;
 DERIVE
	Dim : IfcDimensionCount := 3;
END_ENTITY;

ENTITY IfcCsgSolid
 SUBTYPE OF (IfcSolidModel);
	TreeRootExpression : IfcCsgSelect;
END_ENTITY;

ENTITY IfcCurve
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBoundedCurve
    ,IfcLine
    ,IfcPcurve))
 SUBTYPE OF (IfcGeometricRepresentationItem);
 DERIVE
	Dim : IfcDimensionCount := IfcCurveDim(SELF);
END_ENTITY;

ENTITY IfcCylindricalSurface
 SUBTYPE OF (IfcElementarySurface);
	Radius : IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcDerivedProfileDef
 SUBTYPE OF (IfcProfileDef);
	ParentProfile : IfcProfileDef;
	Operator : IfcCartesianTransformationOperator2D;
	Label : OPTIONAL IfcLabel;
 WHERE
	InvariantProfileType : SELF\IfcProfileDef.ProfileType = ParentProfile.ProfileType;
END_ENTITY;

ENTITY IfcDirection
 SUBTYPE OF (IfcGeometricRepresentationItem);
	DirectionRatios : LIST [2:3] OF IfcReal;
 DERIVE
	Dim : IfcDimensionCount := HIINDEX(DirectionRatios);
 WHERE
	MagnitudeGreaterZero : SIZEOF(QUERY(Tmp <* DirectionRatios | Tmp <> 0.0)) > 0;
END_ENTITY;

ENTITY IfcDistributionControlElement
 SUBTYPE OF (IfcDistributionElement);
 INVERSE
	AssignedToFlowElement : SET [0:1] OF IfcRelFlowControlElements FOR RelatedControlElements;
END_ENTITY;

ENTITY IfcDistributionElement
 SUPERTYPE OF (ONEOF
    (IfcDistributionControlElement
    ,IfcDistributionFlowElement))
 SUBTYPE OF (IfcElement);
END_ENTITY;

ENTITY IfcDistributionElementType
 SUPERTYPE OF (ONEOF
    (IfcDistributionFlowElementType))
 SUBTYPE OF (IfcElementType);
END_ENTITY;

ENTITY IfcDistributionFlowElement
 SUPERTYPE OF (ONEOF
    (IfcFlowSegment))
 SUBTYPE OF (IfcDistributionElement);
 INVERSE
	HasControlElements : SET [0:1] OF IfcRelFlowControlElements FOR RelatingFlowElement;
END_ENTITY;

ENTITY IfcDistributionFlowElementType
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcFlowSegmentType))
 SUBTYPE OF (IfcDistributionElementType);
END_ENTITY;

ENTITY IfcDistributionPort
 SUBTYPE OF (IfcPort);
	FlowDirection : OPTIONAL IfcFlowDirectionEnum;
	PredefinedType : OPTIONAL IfcDistributionPortTypeEnum;
	SystemType : OPTIONAL IfcDistributionSystemEnum;
END_ENTITY;

ENTITY IfcDoor
 SUPERTYPE OF (ONEOF
    (IfcDoorStandardCase))
 SUBTYPE OF (IfcBuildingElement);
	OverallHeight : OPTIONAL IfcStrippedOptional;
	OverallWidth : OPTIONAL IfcStrippedOptional;
	PredefinedType : OPTIONAL IfcStrippedOptional;
	OperationType : OPTIONAL IfcStrippedOptional;
	UserDefinedOperationType : OPTIONAL IfcStrippedOptional;
 WHERE
	CorrectStyleAssigned : (SIZEOF(IsTypedBy) = 0) 
OR ('IFC4.IFCDOORTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcDoorStandardCase
 SUBTYPE OF (IfcDoor);
END_ENTITY;

ENTITY IfcDuctSegment
 SUBTYPE OF (IfcFlowSegment);
	PredefinedType : OPTIONAL IfcDuctSegmentTypeEnum;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR 
 (PredefinedType <> IfcDuctSegmentTypeEnum.USERDEFINED) OR 
 ((PredefinedType = IfcDuctSegmentTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR 
  ('IFC4.IFCDUCTSEGMENTTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcEdge
 SUPERTYPE OF (ONEOF
    (IfcEdgeCurve
    ,IfcOrientedEdge))
 SUBTYPE OF (IfcTopologicalRepresentationItem);
	EdgeStart : IfcVertex;
	EdgeEnd : IfcVertex;
END_ENTITY;

ENTITY IfcEdgeCurve
 SUBTYPE OF (IfcEdge);
	EdgeGeometry : IfcCurve;
	SameSense : IfcBoolean;
END_ENTITY;

ENTITY IfcEdgeLoop
 SUBTYPE OF (IfcLoop);
	EdgeList : LIST [1:?] OF IfcOrientedEdge;
 DERIVE
	Ne : IfcInteger := SIZEOF(EdgeList);
 WHERE
	IsClosed : (EdgeList[1].EdgeStart) :=: (EdgeList[Ne].EdgeEnd);
	IsContinuous : IfcLoopHeadToTail(SELF);
END_ENTITY;

ENTITY IfcElement
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBuildingElement
    ,IfcDistributionElement
    ,IfcFeatureElement))
 SUBTYPE OF (IfcProduct);
	Tag : OPTIONAL IfcStrippedOptional;
 INVERSE
	ConnectedTo : SET [0:?] OF IfcRelConnectsElements FOR RelatingElement;
	IsInterferedByElements : SET [0:?] OF IfcRelInterferesElements FOR RelatedElement;
	InterferesElements : SET [0:?] OF IfcRelInterferesElements FOR RelatingElement;
	HasProjections : SET [0:?] OF IfcRelProjectsElement FOR RelatingElement;
	IsConnectionRealization : SET [0:?] OF IfcRelConnectsWithRealizingElements FOR RealizingElements;
	ConnectedFrom : SET [0:?] OF IfcRelConnectsElements FOR RelatedElement;
END_ENTITY;

ENTITY IfcElementAssemblyType
 SUBTYPE OF (IfcElementType);
	PredefinedType : IfcElementAssemblyTypeEnum;
 WHERE
	CorrectPredefinedType : (PredefinedType <> IfcElementAssemblyTypeEnum.USERDEFINED) OR 
((PredefinedType = IfcElementAssemblyTypeEnum.USERDEFINED) AND EXISTS(SELF\IfcElementType.ElementType));
END_ENTITY;

ENTITY IfcElementType
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBuildingElementType
    ,IfcDistributionElementType
    ,IfcElementAssemblyType))
 SUBTYPE OF (IfcTypeProduct);
	ElementType : OPTIONAL IfcStrippedOptional;
END_ENTITY;

ENTITY IfcElementarySurface
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcCylindricalSurface
    ,IfcPlane
    ,IfcSphericalSurface
    ,IfcToroidalSurface))
 SUBTYPE OF (IfcSurface);
	Position : IfcAxis2Placement3D;
END_ENTITY;

ENTITY IfcEllipseProfileDef
 SUBTYPE OF (IfcParameterizedProfileDef);
	SemiAxis1 : IfcPositiveLengthMeasure;
	SemiAxis2 : IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcExternalInformation
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcLibraryInformation));
END_ENTITY;

ENTITY IfcExternalReference
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcLibraryReference));
	Location : OPTIONAL IfcURIReference;
	Identification : OPTIONAL IfcIdentifier;
	Name : OPTIONAL IfcLabel;
 WHERE
	WR1 : EXISTS(Identification) OR EXISTS(Location) OR EXISTS(Name);
END_ENTITY;

ENTITY IfcExtrudedAreaSolid
 SUPERTYPE OF (ONEOF
    (IfcExtrudedAreaSolidTapered))
 SUBTYPE OF (IfcSweptAreaSolid);
	ExtrudedDirection : IfcDirection;
	Depth : IfcPositiveLengthMeasure;
 WHERE
	ValidExtrusionDirection : IfcDotProduct(IfcRepresentationItem() || IfcGeometricRepresentationItem() || IfcDirection([0.0,0.0,1.0]), SELF.ExtrudedDirection) <> 0.0;
END_ENTITY;

ENTITY IfcExtrudedAreaSolidTapered
 SUBTYPE OF (IfcExtrudedAreaSolid);
	EndSweptArea : IfcProfileDef;
 WHERE
	CorrectProfileAssignment : IfcTaperedSweptAreaProfiles(SELF\IfcSweptAreaSolid.SweptArea, SELF.EndSweptArea);
END_ENTITY;

ENTITY IfcFace
 SUPERTYPE OF (ONEOF
    (IfcFaceSurface))
 SUBTYPE OF (IfcTopologicalRepresentationItem);
	Bounds : SET [1:?] OF IfcFaceBound;
 WHERE
	HasOuterBound : SIZEOF(QUERY(temp <* Bounds | 'IFC4.IFCFACEOUTERBOUND' IN TYPEOF(temp))) <= 1;
END_ENTITY;

ENTITY IfcFaceBound
 SUPERTYPE OF (ONEOF
    (IfcFaceOuterBound))
 SUBTYPE OF (IfcTopologicalRepresentationItem);
	Bound : IfcLoop;
	Orientation : IfcBoolean;
END_ENTITY;

ENTITY IfcFaceOuterBound
 SUBTYPE OF (IfcFaceBound);
END_ENTITY;

ENTITY IfcFaceSurface
 SUPERTYPE OF (ONEOF
    (IfcAdvancedFace))
 SUBTYPE OF (IfcFace);
	FaceSurface : IfcSurface;
	SameSense : IfcBoolean;
END_ENTITY;

ENTITY IfcFacetedBrep
 SUBTYPE OF (IfcManifoldSolidBrep);
END_ENTITY;

ENTITY IfcFeatureElement
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcFeatureElementAddition
    ,IfcFeatureElementSubtraction))
 SUBTYPE OF (IfcElement);
END_ENTITY;

ENTITY IfcFeatureElementAddition
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcProjectionElement))
 SUBTYPE OF (IfcFeatureElement);
 INVERSE
	ProjectsElements : IfcRelProjectsElement FOR RelatedFeatureElement;
END_ENTITY;

ENTITY IfcFeatureElementSubtraction
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcOpeningElement))
 SUBTYPE OF (IfcFeatureElement);
 WHERE
	HasNoSubtraction : SIZEOF(SELF\IfcElement.HasOpenings) = 0;
	IsNotFilling : SIZEOF(SELF\IfcElement.FillsVoids) = 0;
END_ENTITY;

ENTITY IfcFixedReferenceSweptAreaSolid
 SUBTYPE OF (IfcSweptAreaSolid);
	Directrix : IfcCurve;
	StartParam : OPTIONAL IfcParameterValue;
	EndParam : OPTIONAL IfcParameterValue;
	FixedReference : IfcDirection;
 WHERE
	DirectrixBounded : (EXISTS(StartParam) AND EXISTS(EndParam)) OR 
(SIZEOF(['IFC4.IFCCONIC', 'IFC4.IFCBOUNDEDCURVE'] * TYPEOF(Directrix)) = 1);
END_ENTITY;

ENTITY IfcFlowSegment
 SUPERTYPE OF (ONEOF
    (IfcCableCarrierSegment
    ,IfcCableSegment
    ,IfcDuctSegment
    ,IfcPipeSegment))
 SUBTYPE OF (IfcDistributionFlowElement);
END_ENTITY;

ENTITY IfcFlowSegmentType
 ABSTRACT
 SUBTYPE OF (IfcDistributionFlowElementType);
END_ENTITY;

ENTITY IfcFooting
 SUBTYPE OF (IfcBuildingElement);
	PredefinedType : OPTIONAL IfcStrippedOptional;
 WHERE
	CorrectPredefinedType : NOT EXISTS(PredefinedType) OR
(PredefinedType <> IfcFootingTypeEnum.USERDEFINED) OR
((PredefinedType = IfcFootingTypeEnum.USERDEFINED) AND EXISTS(SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
('IFC4.IFCFOOTINGTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcGeometricRepresentationContext
 SUBTYPE OF (IfcRepresentationContext);
	CoordinateSpaceDimension : IfcDimensionCount;
	Precision : OPTIONAL IfcStrippedOptional;
	WorldCoordinateSystem : IfcAxis2Placement;
	TrueNorth : OPTIONAL IfcStrippedOptional;
 WHERE
	North2D : NOT(EXISTS(TrueNorth)) OR (HIINDEX(TrueNorth.DirectionRatios) = 2);
END_ENTITY;

ENTITY IfcGeometricRepresentationItem
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBooleanResult
    ,IfcCartesianPointList
    ,IfcCartesianTransformationOperator
    ,IfcCsgPrimitive3D
    ,IfcCurve
    ,IfcDirection
    ,IfcHalfSpaceSolid
    ,IfcPlacement
    ,IfcPoint
    ,IfcSolidModel
    ,IfcSurface
    ,IfcTessellatedItem
    ,IfcVector))
 SUBTYPE OF (IfcRepresentationItem);
END_ENTITY;

ENTITY IfcGridAxis;
	AxisTag : OPTIONAL IfcLabel;
	AxisCurve : IfcCurve;
	SameSense : IfcBoolean;
 INVERSE
	HasIntersections : SET [0:?] OF IfcVirtualGridIntersection FOR IntersectingAxes;
 WHERE
	WR1 : AxisCurve.Dim = 2;
	WR2 : (SIZEOF(PartOfU) = 1) XOR (SIZEOF(PartOfV) = 1) XOR (SIZEOF(PartOfW) = 1);
END_ENTITY;

ENTITY IfcGridPlacement
 SUBTYPE OF (IfcObjectPlacement);
	PlacementLocation : IfcVirtualGridIntersection;
	PlacementRefDirection : OPTIONAL IfcGridPlacementDirectionSelect;
END_ENTITY;

ENTITY IfcHalfSpaceSolid
 SUPERTYPE OF (ONEOF
    (IfcPolygonalBoundedHalfSpace))
 SUBTYPE OF (IfcGeometricRepresentationItem);
	BaseSurface : IfcSurface;
	AgreementFlag : IfcBoolean;
 DERIVE
	Dim : IfcDimensionCount := 3;
END_ENTITY;

ENTITY IfcIShapeProfileDef
 SUBTYPE OF (IfcParameterizedProfileDef);
	OverallWidth : IfcPositiveLengthMeasure;
	OverallDepth : IfcPositiveLengthMeasure;
	WebThickness : IfcPositiveLengthMeasure;
	FlangeThickness : IfcPositiveLengthMeasure;
	FilletRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	FlangeEdgeRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	FlangeSlope : OPTIONAL IfcPlaneAngleMeasure;
 WHERE
	ValidFlangeThickness : (2. * FlangeThickness) < OverallDepth;
	ValidWebThickness : WebThickness < OverallWidth;
	ValidFilletRadius : NOT(EXISTS(FilletRadius)) OR
((FilletRadius <= (OverallWidth - WebThickness)/2.) AND 
 (FilletRadius <= (OverallDepth - (2. * FlangeThickness))/2.));
END_ENTITY;

ENTITY IfcImageTexture
 SUBTYPE OF (IfcSurfaceTexture);
	URLReference : IfcURIReference;
END_ENTITY;

ENTITY IfcIndexedColourMap
 SUBTYPE OF (IfcPresentationItem);
	MappedTo : IfcTessellatedFaceSet;
	Opacity : OPTIONAL IfcNormalisedRatioMeasure;
	Colours : IfcColourRgbList;
	ColourIndex : LIST [1:?] OF IfcPositiveInteger;
END_ENTITY;

ENTITY IfcIndexedPolyCurve
 SUBTYPE OF (IfcBoundedCurve);
	Points : IfcCartesianPointList;
	Segments : OPTIONAL LIST [1:?] OF IfcSegmentIndexSelect;
	SelfIntersect : OPTIONAL IfcBoolean;
 WHERE
	Consecutive : (SIZEOF(Segments) = 0) OR IfcConsecutiveSegments(Segments);
END_ENTITY;

ENTITY IfcIndexedPolygonalFace
 SUPERTYPE OF (ONEOF
    (IfcIndexedPolygonalFaceWithVoids))
 SUBTYPE OF (IfcTessellatedItem);
	CoordIndex : LIST [3:?] OF IfcPositiveInteger;
 INVERSE
	ToFaceSet : SET [1:?] OF IfcPolygonalFaceSet FOR Faces;
END_ENTITY;

ENTITY IfcIndexedPolygonalFaceWithVoids
 SUBTYPE OF (IfcIndexedPolygonalFace);
	InnerCoordIndices : LIST [1:?] OF LIST [3:?] OF IfcPositiveInteger;
END_ENTITY;

ENTITY IfcIndexedTextureMap
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcIndexedTriangleTextureMap))
 SUBTYPE OF (IfcTextureCoordinate);
	MappedTo : IfcTessellatedFaceSet;
	TexCoords : IfcTextureVertexList;
END_ENTITY;

ENTITY IfcIndexedTriangleTextureMap
 SUBTYPE OF (IfcIndexedTextureMap);
	TexCoordIndex : OPTIONAL LIST [1:?] OF LIST [3:3] OF IfcPositiveInteger;
END_ENTITY;

ENTITY IfcLShapeProfileDef
 SUBTYPE OF (IfcParameterizedProfileDef);
	Depth : IfcPositiveLengthMeasure;
	Width : OPTIONAL IfcPositiveLengthMeasure;
	Thickness : IfcPositiveLengthMeasure;
	FilletRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	EdgeRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	LegSlope : OPTIONAL IfcPlaneAngleMeasure;
 WHERE
	ValidThickness : (Thickness < Depth) AND (NOT(EXISTS(Width)) OR (Thickness < Width));
END_ENTITY;

ENTITY IfcLibraryInformation
 SUBTYPE OF (IfcExternalInformation);
	Name : IfcLabel;
	Version : OPTIONAL IfcLabel;
	Publisher : OPTIONAL IfcActorSelect;
	VersionDate : OPTIONAL IfcDateTime;
	Location : OPTIONAL IfcURIReference;
	Description : OPTIONAL IfcText;
 INVERSE
	LibraryInfoForObjects : SET [0:?] OF IfcRelAssociatesLibrary FOR RelatingLibrary;
	HasLibraryReferences : SET [0:?] OF IfcLibraryReference FOR ReferencedLibrary;
END_ENTITY;

ENTITY IfcLibraryReference
 SUBTYPE OF (IfcExternalReference);
	Description : OPTIONAL IfcText;
	Language : OPTIONAL IfcLanguageId;
	ReferencedLibrary : OPTIONAL IfcLibraryInformation;
 INVERSE
	LibraryRefForObjects : SET [0:?] OF IfcRelAssociatesLibrary FOR RelatingLibrary;
END_ENTITY;

ENTITY IfcLine
 SUBTYPE OF (IfcCurve);
	Pnt : IfcCartesianPoint;
	Dir : IfcVector;
 WHERE
	SameDim : Dir.Dim = Pnt.Dim;
END_ENTITY;

ENTITY IfcLocalPlacement
 SUBTYPE OF (IfcObjectPlacement);
	PlacementRelTo : OPTIONAL IfcStrippedOptional;
	RelativePlacement : IfcAxis2Placement;
 WHERE
	WR21 : IfcCorrectLocalPlacement(RelativePlacement, PlacementRelTo);
END_ENTITY;

ENTITY IfcLoop
 SUPERTYPE OF (ONEOF
    (IfcEdgeLoop
    ,IfcPolyLoop))
 SUBTYPE OF (IfcTopologicalRepresentationItem);
END_ENTITY;

ENTITY IfcManifoldSolidBrep
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcAdvancedBrep
    ,IfcFacetedBrep))
 SUBTYPE OF (IfcSolidModel);
	Outer : IfcClosedShell;
END_ENTITY;

ENTITY IfcMappedItem
 SUBTYPE OF (IfcRepresentationItem);
	MappingSource : IfcRepresentationMap;
	MappingTarget : IfcCartesianTransformationOperator;
END_ENTITY;

ENTITY IfcMaterial
 SUBTYPE OF (IfcMaterialDefinition);
	Name : IfcLabel;
	Description : OPTIONAL IfcText;
	Category : OPTIONAL IfcLabel;
 INVERSE
	HasRepresentation : SET [0:1] OF IfcMaterialDefinitionRepresentation FOR RepresentedMaterial;
END_ENTITY;

ENTITY IfcMaterialConstituent
 SUBTYPE OF (IfcMaterialDefinition);
	Name : OPTIONAL IfcLabel;
	Description : OPTIONAL IfcText;
	Material : IfcMaterial;
	Fraction : OPTIONAL IfcNormalisedRatioMeasure;
	Category : OPTIONAL IfcLabel;
 INVERSE
	ToMaterialConstituentSet : IfcMaterialConstituentSet FOR MaterialConstituents;
END_ENTITY;

ENTITY IfcMaterialConstituentSet
 SUBTYPE OF (IfcMaterialDefinition);
	Name : OPTIONAL IfcLabel;
	Description : OPTIONAL IfcText;
	MaterialConstituents : OPTIONAL SET [1:?] OF IfcMaterialConstituent;
END_ENTITY;

ENTITY IfcMaterialDefinition
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcMaterial
    ,IfcMaterialConstituent
    ,IfcMaterialConstituentSet
    ,IfcMaterialLayer
    ,IfcMaterialLayerSet
    ,IfcMaterialProfile
    ,IfcMaterialProfileSet));
 INVERSE
	AssociatedTo : SET [0:?] OF IfcRelAssociatesMaterial FOR RelatingMaterial;
END_ENTITY;

ENTITY IfcMaterialDefinitionRepresentation
 SUBTYPE OF (IfcProductRepresentation);
	RepresentedMaterial : IfcMaterial;
 WHERE
	OnlyStyledRepresentations : SIZEOF(QUERY(temp <* Representations | 
  (NOT('IFC4.IFCSTYLEDREPRESENTATION' IN TYPEOF(temp)))
)) = 0;
END_ENTITY;

ENTITY IfcMaterialLayer
 SUPERTYPE OF (ONEOF
    (IfcMaterialLayerWithOffsets))
 SUBTYPE OF (IfcMaterialDefinition);
	Material : OPTIONAL IfcMaterial;
	LayerThickness : IfcNonNegativeLengthMeasure;
	IsVentilated : OPTIONAL IfcLogical;
	Name : OPTIONAL IfcLabel;
	Description : OPTIONAL IfcText;
	Category : OPTIONAL IfcLabel;
	Priority : OPTIONAL IfcInteger;
 INVERSE
	ToMaterialLayerSet : IfcMaterialLayerSet FOR MaterialLayers;
 WHERE
	NormalizedPriority : NOT(EXISTS(Priority)) OR {0 <= Priority <= 100};
END_ENTITY;

ENTITY IfcMaterialLayerSet
 SUBTYPE OF (IfcMaterialDefinition);
	MaterialLayers : LIST [1:?] OF IfcMaterialLayer;
	LayerSetName : OPTIONAL IfcLabel;
	Description : OPTIONAL IfcText;
 DERIVE
	TotalThickness : IfcLengthMeasure := IfcMlsTotalThickness(SELF);
END_ENTITY;

ENTITY IfcMaterialLayerSetUsage
 SUBTYPE OF (IfcMaterialUsageDefinition);
	ForLayerSet : IfcMaterialLayerSet;
	LayerSetDirection : IfcLayerSetDirectionEnum;
	DirectionSense : IfcDirectionSenseEnum;
	OffsetFromReferenceLine : IfcLengthMeasure;
	ReferenceExtent : OPTIONAL IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcMaterialLayerWithOffsets
 SUBTYPE OF (IfcMaterialLayer);
	OffsetDirection : IfcLayerSetDirectionEnum;
	OffsetValues : ARRAY [1:2] OF IfcLengthMeasure;
END_ENTITY;

ENTITY IfcMaterialProfile
 SUPERTYPE OF (ONEOF
    (IfcMaterialProfileWithOffsets))
 SUBTYPE OF (IfcMaterialDefinition);
	Name : OPTIONAL IfcLabel;
	Description : OPTIONAL IfcText;
	Material : OPTIONAL IfcMaterial;
	Profile : IfcProfileDef;
	Priority : OPTIONAL IfcInteger;
	Category : OPTIONAL IfcLabel;
 INVERSE
	ToMaterialProfileSet : IfcMaterialProfileSet FOR MaterialProfiles;
 WHERE
	NormalizedPriority : NOT(EXISTS(Priority)) OR {0 <= Priority <= 100};
END_ENTITY;

ENTITY IfcMaterialProfileSet
 SUBTYPE OF (IfcMaterialDefinition);
	Name : OPTIONAL IfcLabel;
	Description : OPTIONAL IfcText;
	MaterialProfiles : LIST [1:?] OF IfcMaterialProfile;
	CompositeProfile : OPTIONAL IfcStrippedOptional;
END_ENTITY;

ENTITY IfcMaterialProfileSetUsage
 SUPERTYPE OF (ONEOF
    (IfcMaterialProfileSetUsageTapering))
 SUBTYPE OF (IfcMaterialUsageDefinition);
	ForProfileSet : IfcMaterialProfileSet;
	CardinalPoint : OPTIONAL IfcCardinalPointReference;
	ReferenceExtent : OPTIONAL IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcMaterialProfileSetUsageTapering
 SUBTYPE OF (IfcMaterialProfileSetUsage);
	ForProfileEndSet : IfcMaterialProfileSet;
	CardinalEndPoint : OPTIONAL IfcCardinalPointReference;
END_ENTITY;

ENTITY IfcMaterialProfileWithOffsets
 SUBTYPE OF (IfcMaterialProfile);
	OffsetValues : ARRAY [1:2] OF IfcLengthMeasure;
END_ENTITY;

ENTITY IfcMaterialUsageDefinition
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcMaterialLayerSetUsage
    ,IfcMaterialProfileSetUsage));
 INVERSE
	AssociatedTo : SET [1:?] OF IfcRelAssociatesMaterial FOR RelatingMaterial;
END_ENTITY;

ENTITY IfcMember
 SUPERTYPE OF (ONEOF
    (IfcMemberStandardCase))
 SUBTYPE OF (IfcBuildingElement);
	PredefinedType : OPTIONAL IfcStrippedOptional;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR
 (PredefinedType <> IfcMemberTypeEnum.USERDEFINED) OR
 ((PredefinedType = IfcMemberTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFC4.IFCMEMBERTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcMemberStandardCase
 SUBTYPE OF (IfcMember);
 WHERE
	HasMaterialProfileSetUsage : SIZEOF (QUERY(temp <* USEDIN(SELF, 'IFC4.IFCRELASSOCIATES.RELATEDOBJECTS') |
              ('IFC4.IFCRELASSOCIATESMATERIAL' IN TYPEOF(temp)) AND
              ('IFC4.IFCMATERIALPROFILESETUSAGE' IN TYPEOF(temp.RelatingMaterial))
              )) = 1;
END_ENTITY;

ENTITY IfcMemberType
 SUBTYPE OF (IfcBuildingElementType);
	PredefinedType : IfcMemberTypeEnum;
 WHERE
	CorrectPredefinedType : (PredefinedType <> IfcMemberTypeEnum.USERDEFINED) OR
((PredefinedType = IfcMemberTypeEnum.USERDEFINED) AND EXISTS(SELF\IfcElementType.ElementType));
END_ENTITY;

ENTITY IfcObject
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcProduct))
 SUBTYPE OF (IfcObjectDefinition);
	ObjectType : OPTIONAL IfcStrippedOptional;
 INVERSE
	IsDeclaredBy : SET [0:1] OF IfcRelDefinesByObject FOR RelatedObjects;
	Declares : SET [0:?] OF IfcRelDefinesByObject FOR RelatingObject;
 WHERE
	UniquePropertySetNames : ((SIZEOF(IsDefinedBy) = 0) OR IfcUniqueDefinitionNames(IsDefinedBy));
END_ENTITY;

ENTITY IfcObjectDefinition
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcContext
    ,IfcObject
    ,IfcTypeObject))
 SUBTYPE OF (IfcRoot);
 INVERSE
	Nests : SET [0:1] OF IfcRelNests FOR RelatedObjects;
	IsNestedBy : SET [0:?] OF IfcRelNests FOR RelatingObject;
	HasContext : SET [0:1] OF IfcRelDeclares FOR RelatedDefinitions;
	IsDecomposedBy : SET [0:?] OF IfcRelAggregates FOR RelatingObject;
	Decomposes : SET [0:1] OF IfcRelAggregates FOR RelatedObjects;
	HasAssociations : SET [0:?] OF IfcRelAssociates FOR RelatedObjects;
END_ENTITY;

ENTITY IfcObjectPlacement
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcGridPlacement
    ,IfcLocalPlacement));
 INVERSE
	PlacesObject : SET [0:?] OF IfcProduct FOR ObjectPlacement;
	ReferencedByPlacements : SET [0:?] OF IfcLocalPlacement FOR PlacementRelTo;
END_ENTITY;

ENTITY IfcOpeningElement
 SUPERTYPE OF (ONEOF
    (IfcOpeningStandardCase))
 SUBTYPE OF (IfcFeatureElementSubtraction);
	PredefinedType : OPTIONAL IfcStrippedOptional;
END_ENTITY;

ENTITY IfcOpeningStandardCase
 SUBTYPE OF (IfcOpeningElement);
END_ENTITY;

ENTITY IfcOrganization;
	Identification : OPTIONAL IfcIdentifier;
	Name : IfcLabel;
	Description : OPTIONAL IfcText;
	Roles : OPTIONAL LIST [1:?] OF IfcActorRole;
	Addresses : OPTIONAL LIST [1:?] OF IfcAddress;
 INVERSE
	Engages : SET [0:?] OF IfcPersonAndOrganization FOR TheOrganization;
END_ENTITY;

ENTITY IfcOrientedEdge
 SUBTYPE OF (IfcEdge);
	EdgeElement : IfcEdge;
	Orientation : IfcBoolean;
 DERIVE
	SELF\IfcEdge.EdgeStart : IfcVertex := IfcBooleanChoose 
(Orientation, EdgeElement.EdgeStart, EdgeElement.EdgeEnd);
	SELF\IfcEdge.EdgeEnd : IfcVertex := IfcBooleanChoose 
(Orientation, EdgeElement.EdgeEnd, EdgeElement.EdgeStart);
 WHERE
	EdgeElementNotOriented : NOT('IFC4.IFCORIENTEDEDGE' IN TYPEOF(EdgeElement));
END_ENTITY;

ENTITY IfcOwnerHistory;
	OwningUser : IfcPersonAndOrganization;
	OwningApplication : IfcApplication;
	State : OPTIONAL IfcStateEnum;
	ChangeAction : OPTIONAL IfcChangeActionEnum;
	LastModifiedDate : OPTIONAL IfcTimeStamp;
	LastModifyingUser : OPTIONAL IfcPersonAndOrganization;
	LastModifyingApplication : OPTIONAL IfcApplication;
	CreationDate : IfcTimeStamp;
 WHERE
	CorrectChangeAction : (EXISTS(LastModifiedDate)) OR
(NOT(EXISTS(LastModifiedDate)) AND NOT(EXISTS(ChangeAction))) OR
(NOT(EXISTS(LastModifiedDate)) AND EXISTS(ChangeAction) AND ((ChangeAction = IfcChangeActionEnum.NOTDEFINED) OR (ChangeAction = IfcChangeActionEnum.NOCHANGE)));
END_ENTITY;

ENTITY IfcParameterizedProfileDef
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcAsymmetricIShapeProfileDef
    ,IfcCShapeProfileDef
    ,IfcCircleProfileDef
    ,IfcEllipseProfileDef
    ,IfcIShapeProfileDef
    ,IfcLShapeProfileDef
    ,IfcRectangleProfileDef
    ,IfcTShapeProfileDef
    ,IfcUShapeProfileDef
    ,IfcZShapeProfileDef))
 SUBTYPE OF (IfcProfileDef);
	Position : OPTIONAL IfcAxis2Placement2D;
END_ENTITY;

ENTITY IfcPcurve
 SUBTYPE OF (IfcCurve);
	BasisSurface : IfcSurface;
	ReferenceCurve : IfcCurve;
 WHERE
	DimIs2D : ReferenceCurve.Dim = 2;
END_ENTITY;

ENTITY IfcPerson;
	Identification : OPTIONAL IfcIdentifier;
	FamilyName : OPTIONAL IfcLabel;
	GivenName : OPTIONAL IfcLabel;
	MiddleNames : OPTIONAL LIST [1:?] OF IfcLabel;
	PrefixTitles : OPTIONAL LIST [1:?] OF IfcLabel;
	SuffixTitles : OPTIONAL LIST [1:?] OF IfcLabel;
	Roles : OPTIONAL LIST [1:?] OF IfcActorRole;
	Addresses : OPTIONAL LIST [1:?] OF IfcAddress;
 INVERSE
	EngagedIn : SET [0:?] OF IfcPersonAndOrganization FOR ThePerson;
 WHERE
	IdentifiablePerson : EXISTS(Identification) OR EXISTS(FamilyName) OR EXISTS(GivenName);
	ValidSetOfNames : NOT EXISTS(MiddleNames) OR EXISTS(FamilyName) OR EXISTS(GivenName);
END_ENTITY;

ENTITY IfcPersonAndOrganization;
	ThePerson : IfcPerson;
	TheOrganization : IfcOrganization;
	Roles : OPTIONAL LIST [1:?] OF IfcActorRole;
END_ENTITY;

ENTITY IfcPile
 SUBTYPE OF (IfcBuildingElement);
	PredefinedType : OPTIONAL IfcStrippedOptional;
	ConstructionType : OPTIONAL IfcStrippedOptional;
 WHERE
	CorrectPredefinedType : NOT EXISTS(PredefinedType) OR
(PredefinedType <> IfcPileTypeEnum.USERDEFINED) OR
((PredefinedType = IfcPileTypeEnum.USERDEFINED) AND EXISTS(SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
('IFC4.IFCPILETYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcPipeSegment
 SUBTYPE OF (IfcFlowSegment);
	PredefinedType : OPTIONAL IfcPipeSegmentTypeEnum;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR 
 (PredefinedType <> IfcPipeSegmentTypeEnum.USERDEFINED) OR 
 ((PredefinedType = IfcPipeSegmentTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR 
  ('IFC4.IFCPIPESEGMENTTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcPlacement
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcAxis1Placement
    ,IfcAxis2Placement2D
    ,IfcAxis2Placement3D))
 SUBTYPE OF (IfcGeometricRepresentationItem);
	Location : IfcCartesianPoint;
 DERIVE
	Dim : IfcDimensionCount := Location.Dim;
END_ENTITY;

ENTITY IfcPlane
 SUBTYPE OF (IfcElementarySurface);
END_ENTITY;

ENTITY IfcPlate
 SUPERTYPE OF (ONEOF
    (IfcPlateStandardCase))
 SUBTYPE OF (IfcBuildingElement);
	PredefinedType : OPTIONAL IfcStrippedOptional;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR
 (PredefinedType <> IfcPlateTypeEnum.USERDEFINED) OR
 ((PredefinedType = IfcPlateTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFC4.IFCPLATETYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcPlateStandardCase
 SUBTYPE OF (IfcPlate);
 WHERE
	HasMaterialLayerSetUsage : SIZEOF (QUERY(temp <* USEDIN(SELF, 'IFC4.IFCRELASSOCIATES.RELATEDOBJECTS') |
              ('IFC4.IFCRELASSOCIATESMATERIAL' IN TYPEOF(temp)) AND
              ('IFC4.IFCMATERIALLAYERSETUSAGE' IN TYPEOF(temp.RelatingMaterial))
              )) = 1;
END_ENTITY;

ENTITY IfcPlateType
 SUBTYPE OF (IfcBuildingElementType);
	PredefinedType : IfcPlateTypeEnum;
 WHERE
	CorrectPredefinedType : (PredefinedType <> IfcPlateTypeEnum.USERDEFINED) OR
((PredefinedType = IfcPlateTypeEnum.USERDEFINED) AND EXISTS(SELF\IfcElementType.ElementType));
END_ENTITY;

ENTITY IfcPoint
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcCartesianPoint))
 SUBTYPE OF (IfcGeometricRepresentationItem);
END_ENTITY;

ENTITY IfcPolyLoop
 SUBTYPE OF (IfcLoop);
	Polygon : LIST [3:?] OF IfcCartesianPoint;
 WHERE
	AllPointsSameDim : SIZEOF(QUERY(Temp <* Polygon | Temp.Dim <> Polygon[1].Dim)) = 0;
END_ENTITY;

ENTITY IfcPolygonalBoundedHalfSpace
 SUBTYPE OF (IfcHalfSpaceSolid);
	Position : IfcAxis2Placement3D;
	PolygonalBoundary : IfcBoundedCurve;
 WHERE
	BoundaryDim : PolygonalBoundary.Dim = 2;
	BoundaryType : SIZEOF(TYPEOF(PolygonalBoundary) * [
  'IFC4.IFCPOLYLINE', 
  'IFC4.IFCCOMPOSITECURVE']
) = 1;
END_ENTITY;

ENTITY IfcPolygonalFaceSet
 SUBTYPE OF (IfcTessellatedFaceSet);
	Closed : OPTIONAL IfcBoolean;
	Faces : LIST [1:?] OF IfcIndexedPolygonalFace;
	PnIndex : OPTIONAL LIST [1:?] OF IfcPositiveInteger;
END_ENTITY;

ENTITY IfcPolyline
 SUBTYPE OF (IfcBoundedCurve);
	Points : LIST [2:?] OF IfcCartesianPoint;
 WHERE
	SameDim : SIZEOF(QUERY(Temp <* Points | Temp.Dim <> Points[1].Dim)) = 0;
END_ENTITY;

ENTITY IfcPort
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcDistributionPort))
 SUBTYPE OF (IfcProduct);
END_ENTITY;

ENTITY IfcPresentationItem
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcColourRgbList
    ,IfcColourSpecification
    ,IfcIndexedColourMap
    ,IfcSurfaceStyleShading
    ,IfcSurfaceTexture
    ,IfcTextureCoordinate
    ,IfcTextureVertexList));
END_ENTITY;

ENTITY IfcPresentationStyle
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcSurfaceStyle));
	Name : OPTIONAL IfcLabel;
END_ENTITY;

ENTITY IfcProduct
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcElement
    ,IfcPort))
 SUBTYPE OF (IfcObject);
	ObjectPlacement : OPTIONAL IfcObjectPlacement;
	Representation : OPTIONAL IfcProductRepresentation;
 WHERE
	PlacementForShapeRepresentation : (EXISTS(Representation) AND EXISTS(ObjectPlacement))
            OR (EXISTS(Representation) AND 
			   (SIZEOF(QUERY(temp <* Representation.Representations | 'IFC4.IFCSHAPEREPRESENTATION' IN TYPEOF(temp))) = 0))
            OR (NOT(EXISTS(Representation)));
END_ENTITY;

ENTITY IfcProductDefinitionShape
 SUBTYPE OF (IfcProductRepresentation);
 INVERSE
	ShapeOfProduct : SET [1:?] OF IfcProduct FOR Representation;
 WHERE
	OnlyShapeModel : SIZEOF(QUERY(temp <* Representations | 
  (NOT('IFC4.IFCSHAPEMODEL' IN TYPEOF(temp)))
)) = 0;
END_ENTITY;

ENTITY IfcProductRepresentation
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcMaterialDefinitionRepresentation
    ,IfcProductDefinitionShape));
	Name : OPTIONAL IfcLabel;
	Description : OPTIONAL IfcText;
	Representations : LIST [1:?] OF IfcRepresentation;
END_ENTITY;

ENTITY IfcProfileDef
 SUPERTYPE OF (ONEOF
    (IfcArbitraryClosedProfileDef
    ,IfcCompositeProfileDef
    ,IfcDerivedProfileDef
    ,IfcParameterizedProfileDef));
	ProfileType : IfcProfileTypeEnum;
	ProfileName : OPTIONAL IfcLabel;
END_ENTITY;

ENTITY IfcProject
 SUBTYPE OF (IfcContext);
 WHERE
	HasName : EXISTS(SELF\IfcRoot.Name);
	CorrectContext : NOT(EXISTS(SELF\IfcContext.RepresentationContexts)) OR
(SIZEOF(QUERY(Temp <* SELF\IfcContext.RepresentationContexts |
 'IFC4.IFCGEOMETRICREPRESENTATIONSUBCONTEXT' IN TYPEOF(Temp)
  )) = 0);
	NoDecomposition : SIZEOF(SELF\IfcObjectDefinition.Decomposes) = 0;
END_ENTITY;

ENTITY IfcProjectLibrary
 SUBTYPE OF (IfcContext);
END_ENTITY;

ENTITY IfcProjectionElement
 SUBTYPE OF (IfcFeatureElementAddition);
	PredefinedType : OPTIONAL IfcProjectionElementTypeEnum;
END_ENTITY;

ENTITY IfcProperty
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcSimpleProperty))
 SUBTYPE OF (IfcPropertyAbstraction);
	Name : IfcIdentifier;
	Description : OPTIONAL IfcText;
 INVERSE
	PartOfPset : SET [0:?] OF IfcPropertySet FOR HasProperties;
END_ENTITY;

ENTITY IfcPropertyAbstraction
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcProperty
    ,IfcPropertyEnumeration));
END_ENTITY;

ENTITY IfcPropertyBoundedValue
 SUBTYPE OF (IfcSimpleProperty);
	UpperBoundValue : OPTIONAL IfcValue;
	LowerBoundValue : OPTIONAL IfcValue;
	Unit : OPTIONAL IfcStrippedOptional;
	SetPointValue : OPTIONAL IfcValue;
 WHERE
	SameUnitUpperLower : NOT(EXISTS(UpperBoundValue)) OR NOT(EXISTS(LowerBoundValue)) OR
(TYPEOF(UpperBoundValue) = TYPEOF(LowerBoundValue));
	SameUnitUpperSet : NOT(EXISTS(UpperBoundValue)) OR NOT(EXISTS(SetPointValue)) OR
(TYPEOF(UpperBoundValue) = TYPEOF(SetPointValue));
	SameUnitLowerSet : NOT(EXISTS(LowerBoundValue)) OR NOT(EXISTS(SetPointValue)) OR
(TYPEOF(LowerBoundValue) = TYPEOF(SetPointValue));
END_ENTITY;

ENTITY IfcPropertyDefinition
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcPropertySetDefinition
    ,IfcPropertyTemplateDefinition))
 SUBTYPE OF (IfcRoot);
 INVERSE
	HasContext : SET [0:1] OF IfcRelDeclares FOR RelatedDefinitions;
	HasAssociations : SET [0:?] OF IfcRelAssociates FOR RelatedObjects;
END_ENTITY;

ENTITY IfcPropertyEnumeratedValue
 SUBTYPE OF (IfcSimpleProperty);
	EnumerationValues : OPTIONAL LIST [1:?] OF IfcValue;
	EnumerationReference : OPTIONAL IfcPropertyEnumeration;
 WHERE
	WR21 : NOT(EXISTS(EnumerationReference)) 
OR  NOT(EXISTS(EnumerationValues)) 
OR  (SIZEOF(QUERY(temp <* EnumerationValues |
    temp IN EnumerationReference.EnumerationValues))
    = SIZEOF(EnumerationValues));
END_ENTITY;

ENTITY IfcPropertyEnumeration
 SUBTYPE OF (IfcPropertyAbstraction);
	Name : IfcLabel;
	EnumerationValues : LIST [1:?] OF IfcValue;
	Unit : OPTIONAL IfcStrippedOptional;
 UNIQUE
	UR1 : Name;
 WHERE
	WR01 : SIZEOF(QUERY(temp <* SELF.EnumerationValues | 
  NOT(TYPEOF(SELF.EnumerationValues[1]) = TYPEOF(temp))
  )) = 0;
END_ENTITY;

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

ENTITY IfcPropertySet
 SUBTYPE OF (IfcPropertySetDefinition);
	HasProperties : SET [1:?] OF IfcProperty;
 WHERE
	ExistsName : EXISTS(SELF\IfcRoot.Name);
	UniquePropertyNames : IfcUniquePropertyName(HasProperties);
END_ENTITY;

ENTITY IfcPropertySetDefinition
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcPropertySet))
 SUBTYPE OF (IfcPropertyDefinition);
 INVERSE
	DefinesType : SET [0:?] OF IfcTypeObject FOR HasPropertySets;
END_ENTITY;

ENTITY IfcPropertySetTemplate
 SUBTYPE OF (IfcPropertyTemplateDefinition);
	TemplateType : OPTIONAL IfcPropertySetTemplateTypeEnum;
	ApplicableEntity : OPTIONAL IfcIdentifier;
	HasPropertyTemplates : SET [1:?] OF IfcPropertyTemplate;
 WHERE
	ExistsName : EXISTS(SELF\IfcRoot.Name);
	UniquePropertyNames : IfcUniquePropertyTemplateNames(HasPropertyTemplates);
END_ENTITY;

ENTITY IfcPropertySingleValue
 SUBTYPE OF (IfcSimpleProperty);
	NominalValue : OPTIONAL IfcValue;
	Unit : OPTIONAL IfcStrippedOptional;
END_ENTITY;

ENTITY IfcPropertyTableValue
 SUBTYPE OF (IfcSimpleProperty);
	DefiningValues : OPTIONAL LIST [1:?] OF IfcValue;
	DefinedValues : OPTIONAL LIST [1:?] OF IfcValue;
	Expression : OPTIONAL IfcText;
	DefiningUnit : OPTIONAL IfcStrippedOptional;
	DefinedUnit : OPTIONAL IfcStrippedOptional;
	CurveInterpolation : OPTIONAL IfcCurveInterpolationEnum;
 WHERE
	WR21 : (NOT(EXISTS(DefiningValues)) AND NOT(EXISTS(DefinedValues)))
OR (SIZEOF(DefiningValues) = SIZEOF(DefinedValues));
	WR22 : NOT(EXISTS(DefiningValues)) OR 
(SIZEOF(QUERY(temp <* SELF.DefiningValues | TYPEOF(temp) <> TYPEOF(SELF.DefiningValues[1])
)) = 0);
	WR23 : NOT(EXISTS(DefinedValues)) OR 
(SIZEOF(QUERY(temp <* SELF.DefinedValues | TYPEOF(temp) <> TYPEOF(SELF.DefinedValues[1])
)) = 0);
END_ENTITY;

ENTITY IfcPropertyTemplate
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcSimplePropertyTemplate))
 SUBTYPE OF (IfcPropertyTemplateDefinition);
 INVERSE
	PartOfPsetTemplate : SET [0:?] OF IfcPropertySetTemplate FOR HasPropertyTemplates;
END_ENTITY;

ENTITY IfcPropertyTemplateDefinition
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcPropertySetTemplate
    ,IfcPropertyTemplate))
 SUBTYPE OF (IfcPropertyDefinition);
END_ENTITY;

ENTITY IfcRationalBSplineCurveWithKnots
 SUBTYPE OF (IfcBSplineCurveWithKnots);
	WeightsData : LIST [2:?] OF IfcReal;
 DERIVE
	Weights : ARRAY [0:UpperIndexOnControlPoints] OF IfcReal := IfcListToArray(WeightsData,0,SELF\IfcBSplineCurve.UpperIndexOnControlPoints);
 WHERE
	SameNumOfWeightsAndPoints : SIZEOF(WeightsData) = SIZEOF(SELF\IfcBSplineCurve.ControlPointsList);
	WeightsGreaterZero : IfcCurveWeightsPositive(SELF);
END_ENTITY;

ENTITY IfcRationalBSplineSurfaceWithKnots
 SUBTYPE OF (IfcBSplineSurfaceWithKnots);
	WeightsData : LIST [2:?] OF LIST [2:?] OF IfcReal;
 DERIVE
	Weights : ARRAY [0:UUpper] OF ARRAY [0:VUpper] OF IfcReal := IfcMakeArrayOfArray(WeightsData,0,UUpper,0,VUpper);
 WHERE
	CorrespondingWeightsDataLists : (SIZEOF(WeightsData) = SIZEOF(SELF\IfcBSplineSurface.ControlPointsList))
AND 
(SIZEOF(WeightsData[1]) = SIZEOF(SELF\IfcBSplineSurface.ControlPointsList[1]));
	WeightValuesGreaterZero : IfcSurfaceWeightsPositive(SELF);
END_ENTITY;

ENTITY IfcRectangleHollowProfileDef
 SUBTYPE OF (IfcRectangleProfileDef);
	WallThickness : IfcPositiveLengthMeasure;
	InnerFilletRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	OuterFilletRadius : OPTIONAL IfcNonNegativeLengthMeasure;
 WHERE
	ValidWallThickness : (WallThickness < (SELF\IfcRectangleProfileDef.XDim/2.)) AND 
(WallThickness < (SELF\IfcRectangleProfileDef.YDim/2.));
	ValidInnerRadius : NOT(EXISTS(InnerFilletRadius)) OR 
((InnerFilletRadius <= (SELF\IfcRectangleProfileDef.XDim/2. - WallThickness)) AND 
 (InnerFilletRadius <= (SELF\IfcRectangleProfileDef.YDim/2. - WallThickness)));
	ValidOuterRadius : NOT(EXISTS(OuterFilletRadius)) OR 
((OuterFilletRadius <= (SELF\IfcRectangleProfileDef.XDim/2.)) AND 
 (OuterFilletRadius <= (SELF\IfcRectangleProfileDef.YDim/2.)));
END_ENTITY;

ENTITY IfcRectangleProfileDef
 SUPERTYPE OF (ONEOF
    (IfcRectangleHollowProfileDef
    ,IfcRoundedRectangleProfileDef))
 SUBTYPE OF (IfcParameterizedProfileDef);
	XDim : IfcPositiveLengthMeasure;
	YDim : IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcRectangularPyramid
 SUBTYPE OF (IfcCsgPrimitive3D);
	XLength : IfcPositiveLengthMeasure;
	YLength : IfcPositiveLengthMeasure;
	Height : IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcRelAggregates
 SUBTYPE OF (IfcRelDecomposes);
	RelatingObject : IfcObjectDefinition;
	RelatedObjects : SET [1:?] OF IfcObjectDefinition;
 WHERE
	NoSelfReference : SIZEOF(QUERY(Temp <* RelatedObjects | RelatingObject :=: Temp)) = 0;
END_ENTITY;

ENTITY IfcRelAssociates
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcRelAssociatesLibrary
    ,IfcRelAssociatesMaterial))
 SUBTYPE OF (IfcRelationship);
	RelatedObjects : SET [1:?] OF IfcDefinitionSelect;
END_ENTITY;

ENTITY IfcRelAssociatesLibrary
 SUBTYPE OF (IfcRelAssociates);
	RelatingLibrary : IfcLibrarySelect;
END_ENTITY;

ENTITY IfcRelAssociatesMaterial
 SUBTYPE OF (IfcRelAssociates);
	RelatingMaterial : IfcMaterialSelect;
 WHERE
	NoVoidElement : SIZEOF(QUERY(temp <* SELF\IfcRelAssociates.RelatedObjects | 
  ('IFC4.IFCFEATUREELEMENTSUBTRACTION' IN TYPEOF(temp)) OR 
  ('IFC4.IFCVIRTUALELEMENT' IN TYPEOF(temp)) 
)) = 0;
	AllowedElements : SIZEOF(QUERY(temp <* SELF\IfcRelAssociates.RelatedObjects | (
  SIZEOF(TYPEOF(temp) * [   
    'IFC4.IFCELEMENT', 
    'IFC4.IFCELEMENTTYPE',
    'IFC4.IFCWINDOWSTYLE',
    'IFC4.IFCDOORSTYLE',
    'IFC4.IFCSTRUCTURALMEMBER',
    'IFC4.IFCPORT']) = 0) 
)) = 0;
END_ENTITY;

ENTITY IfcRelConnects
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcRelConnectsElements
    ,IfcRelFlowControlElements
    ,IfcRelInterferesElements))
 SUBTYPE OF (IfcRelationship);
END_ENTITY;

ENTITY IfcRelConnectsElements
 SUPERTYPE OF (ONEOF
    (IfcRelConnectsPathElements
    ,IfcRelConnectsWithRealizingElements))
 SUBTYPE OF (IfcRelConnects);
	ConnectionGeometry : OPTIONAL IfcConnectionGeometry;
	RelatingElement : IfcElement;
	RelatedElement : IfcElement;
 WHERE
	NoSelfReference : RelatingElement :<>: RelatedElement;
END_ENTITY;

ENTITY IfcRelConnectsPathElements
 SUBTYPE OF (IfcRelConnectsElements);
	RelatingPriorities : LIST [0:?] OF IfcInteger;
	RelatedPriorities : LIST [0:?] OF IfcInteger;
	RelatedConnectionType : IfcConnectionTypeEnum;
	RelatingConnectionType : IfcConnectionTypeEnum;
 WHERE
	NormalizedRelatingPriorities : (SIZEOF(RelatingPriorities) = 0)
OR
(SIZEOF (QUERY (temp <* RelatingPriorities
  | {0 <= temp <= 100}
  )) = SIZEOF(RelatingPriorities));
	NormalizedRelatedPriorities : (SIZEOF(RelatedPriorities) = 0)
OR
(SIZEOF (QUERY (temp <* RelatedPriorities
  | {0 <= temp <= 100}
  )) = SIZEOF(RelatedPriorities));
END_ENTITY;

ENTITY IfcRelConnectsWithRealizingElements
 SUBTYPE OF (IfcRelConnectsElements);
	RealizingElements : SET [1:?] OF IfcElement;
	ConnectionType : OPTIONAL IfcStrippedOptional;
END_ENTITY;

ENTITY IfcRelDeclares
 SUBTYPE OF (IfcRelationship);
	RelatingContext : IfcContext;
	RelatedDefinitions : SET [1:?] OF IfcDefinitionSelect;
 WHERE
	NoSelfReference : SIZEOF(QUERY(Temp <* RelatedDefinitions | RelatingContext :=: Temp)) = 0;
END_ENTITY;

ENTITY IfcRelDecomposes
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcRelAggregates
    ,IfcRelNests
    ,IfcRelProjectsElement))
 SUBTYPE OF (IfcRelationship);
END_ENTITY;

ENTITY IfcRelDefines
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcRelDefinesByObject))
 SUBTYPE OF (IfcRelationship);
END_ENTITY;

ENTITY IfcRelDefinesByObject
 SUBTYPE OF (IfcRelDefines);
	RelatedObjects : SET [1:?] OF IfcObject;
	RelatingObject : IfcObject;
END_ENTITY;

ENTITY IfcRelFlowControlElements
 SUBTYPE OF (IfcRelConnects);
	RelatedControlElements : SET [1:?] OF IfcDistributionControlElement;
	RelatingFlowElement : IfcDistributionFlowElement;
END_ENTITY;

ENTITY IfcRelInterferesElements
 SUBTYPE OF (IfcRelConnects);
	RelatingElement : IfcElement;
	RelatedElement : IfcElement;
	InterferenceGeometry : OPTIONAL IfcConnectionGeometry;
	InterferenceType : OPTIONAL IfcIdentifier;
	ImpliedOrder : LOGICAL;
 WHERE
	NotSelfReference : RelatingElement :<>: RelatedElement;
END_ENTITY;

ENTITY IfcRelNests
 SUBTYPE OF (IfcRelDecomposes);
	RelatingObject : IfcObjectDefinition;
	RelatedObjects : LIST [1:?] OF IfcObjectDefinition;
 WHERE
	NoSelfReference : SIZEOF(QUERY(Temp <* RelatedObjects | RelatingObject :=: Temp)) = 0;
END_ENTITY;

ENTITY IfcRelProjectsElement
 SUBTYPE OF (IfcRelDecomposes);
	RelatingElement : IfcElement;
	RelatedFeatureElement : IfcFeatureElementAddition;
END_ENTITY;

ENTITY IfcRelationship
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcRelAssociates
    ,IfcRelConnects
    ,IfcRelDeclares
    ,IfcRelDecomposes
    ,IfcRelDefines))
 SUBTYPE OF (IfcRoot);
END_ENTITY;

ENTITY IfcRepresentation
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcShapeModel));
	ContextOfItems : IfcRepresentationContext;
	RepresentationIdentifier : OPTIONAL IfcLabel;
	RepresentationType : OPTIONAL IfcLabel;
	Items : SET [1:?] OF IfcRepresentationItem;
 INVERSE
	RepresentationMap : SET [0:1] OF IfcRepresentationMap FOR MappedRepresentation;
	OfProductRepresentation : SET [0:?] OF IfcProductRepresentation FOR Representations;
END_ENTITY;

ENTITY IfcRepresentationContext
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcGeometricRepresentationContext));
	ContextIdentifier : OPTIONAL IfcStrippedOptional;
	ContextType : OPTIONAL IfcStrippedOptional;
 INVERSE
	RepresentationsInContext : SET [0:?] OF IfcRepresentation FOR ContextOfItems;
END_ENTITY;

ENTITY IfcRepresentationItem
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcGeometricRepresentationItem
    ,IfcMappedItem
    ,IfcStyledItem
    ,IfcTopologicalRepresentationItem));
 INVERSE
	StyledByItem : SET [0:1] OF IfcStyledItem FOR Item;
END_ENTITY;

ENTITY IfcRepresentationMap;
	MappingOrigin : IfcAxis2Placement;
	MappedRepresentation : IfcRepresentation;
 INVERSE
	MapUsage : SET [0:?] OF IfcMappedItem FOR MappingSource;
 WHERE
	ApplicableMappedRepr : 'IFC4.IFCSHAPEMODEL' IN TYPEOF(MappedRepresentation);
END_ENTITY;

ENTITY IfcRevolvedAreaSolid
 SUPERTYPE OF (ONEOF
    (IfcRevolvedAreaSolidTapered))
 SUBTYPE OF (IfcSweptAreaSolid);
	Axis : IfcAxis1Placement;
	Angle : IfcPlaneAngleMeasure;
 DERIVE
	AxisLine : IfcLine := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcCurve() || IfcLine(Axis.Location, 
  IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcVector(Axis.Z,1.0));
 WHERE
	AxisStartInXY : Axis.Location.Coordinates[3] = 0.0;
	AxisDirectionInXY : Axis.Z.DirectionRatios[3] = 0.0;
END_ENTITY;

ENTITY IfcRevolvedAreaSolidTapered
 SUBTYPE OF (IfcRevolvedAreaSolid);
	EndSweptArea : IfcProfileDef;
 WHERE
	CorrectProfileAssignment : IfcTaperedSweptAreaProfiles(SELF\IfcSweptAreaSolid.SweptArea, SELF.EndSweptArea);
END_ENTITY;

ENTITY IfcRightCircularCone
 SUBTYPE OF (IfcCsgPrimitive3D);
	Height : IfcPositiveLengthMeasure;
	BottomRadius : IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcRightCircularCylinder
 SUBTYPE OF (IfcCsgPrimitive3D);
	Height : IfcPositiveLengthMeasure;
	Radius : IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcRoot
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcObjectDefinition
    ,IfcPropertyDefinition
    ,IfcRelationship));
	GlobalId : IfcGloballyUniqueId;
	OwnerHistory : OPTIONAL IfcOwnerHistory;
	Name : OPTIONAL IfcLabel;
	Description : OPTIONAL IfcStrippedOptional;
 UNIQUE
	UR1 : GlobalId;
END_ENTITY;

ENTITY IfcRoundedRectangleProfileDef
 SUBTYPE OF (IfcRectangleProfileDef);
	RoundingRadius : IfcPositiveLengthMeasure;
 WHERE
	ValidRadius : ((RoundingRadius <= (SELF\IfcRectangleProfileDef.XDim/2.)) AND 
 (RoundingRadius <= (SELF\IfcRectangleProfileDef.YDim/2.)));
END_ENTITY;

ENTITY IfcShapeModel
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcShapeRepresentation))
 SUBTYPE OF (IfcRepresentation);
 WHERE
	WR11 : (SIZEOF(SELF\IfcRepresentation.OfProductRepresentation) = 1) XOR 
(SIZEOF(SELF\IfcRepresentation.RepresentationMap) = 1) XOR
(SIZEOF(OfShapeAspect) = 1);
END_ENTITY;

ENTITY IfcShapeRepresentation
 SUBTYPE OF (IfcShapeModel);
 WHERE
	CorrectContext : 'IFC4.IFCGEOMETRICREPRESENTATIONCONTEXT' 
IN TYPEOF(SELF\IfcRepresentation.ContextOfItems);
	NoTopologicalItem : SIZEOF(QUERY(temp <* Items | 
  ('IFC4.IFCTOPOLOGICALREPRESENTATIONITEM' IN TYPEOF(temp))
    AND (NOT(SIZEOF(
      ['IFC4.IFCVERTEXPOINT',
       'IFC4.IFCEDGECURVE',
       'IFC4.IFCFACESURFACE'] * TYPEOF(temp)) = 1))
)) = 0;
	HasRepresentationType : EXISTS(SELF\IfcRepresentation.RepresentationType);
	HasRepresentationIdentifier : EXISTS(SELF\IfcRepresentation.RepresentationIdentifier);
	CorrectItemsForType : IfcShapeRepresentationTypes(SELF\IfcRepresentation.RepresentationType, SELF\IfcRepresentation.Items);
END_ENTITY;

ENTITY IfcSimpleProperty
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcPropertyBoundedValue
    ,IfcPropertyEnumeratedValue
    ,IfcPropertyListValue
    ,IfcPropertySingleValue
    ,IfcPropertyTableValue))
 SUBTYPE OF (IfcProperty);
END_ENTITY;

ENTITY IfcSimplePropertyTemplate
 SUBTYPE OF (IfcPropertyTemplate);
	TemplateType : OPTIONAL IfcSimplePropertyTemplateTypeEnum;
	PrimaryMeasureType : OPTIONAL IfcLabel;
	SecondaryMeasureType : OPTIONAL IfcLabel;
	Enumerators : OPTIONAL IfcPropertyEnumeration;
	PrimaryUnit : OPTIONAL IfcUnit;
	SecondaryUnit : OPTIONAL IfcUnit;
	Expression : OPTIONAL IfcLabel;
	AccessState : OPTIONAL IfcStateEnum;
END_ENTITY;

ENTITY IfcSlab
 SUPERTYPE OF (ONEOF
    (IfcSlabElementedCase
    ,IfcSlabStandardCase))
 SUBTYPE OF (IfcBuildingElement);
	PredefinedType : OPTIONAL IfcStrippedOptional;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR
 (PredefinedType <> IfcSlabTypeEnum.USERDEFINED) OR
 ((PredefinedType = IfcSlabTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFC4.IFCSLABTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcSlabElementedCase
 SUBTYPE OF (IfcSlab);
 WHERE
	HasDecomposition : HIINDEX(SELF\IfcObjectDefinition.IsDecomposedBy) > 0;
END_ENTITY;

ENTITY IfcSlabStandardCase
 SUBTYPE OF (IfcSlab);
 WHERE
	HasMaterialLayerSetusage : SIZEOF (QUERY(temp <* USEDIN(SELF, 'IFC4.IFCRELASSOCIATES.RELATEDOBJECTS') |
              ('IFC4.IFCRELASSOCIATESMATERIAL' IN TYPEOF(temp)) AND
              ('IFC4.IFCMATERIALLAYERSETUSAGE' IN TYPEOF(temp.RelatingMaterial))
              )) = 1;
END_ENTITY;

ENTITY IfcSlabType
 SUBTYPE OF (IfcBuildingElementType);
	PredefinedType : IfcSlabTypeEnum;
 WHERE
	CorrectPredefinedType : (PredefinedType <> IfcSlabTypeEnum.USERDEFINED) OR
((PredefinedType = IfcSlabTypeEnum.USERDEFINED) AND EXISTS(SELF\IfcElementType.ElementType));
END_ENTITY;

ENTITY IfcSolidModel
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcCsgSolid
    ,IfcManifoldSolidBrep
    ,IfcSweptAreaSolid))
 SUBTYPE OF (IfcGeometricRepresentationItem);
 DERIVE
	Dim : IfcDimensionCount := 3;
END_ENTITY;

ENTITY IfcSphere
 SUBTYPE OF (IfcCsgPrimitive3D);
	Radius : IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcSphericalSurface
 SUBTYPE OF (IfcElementarySurface);
	Radius : IfcPositiveLengthMeasure;
END_ENTITY;

ENTITY IfcStyledItem
 SUBTYPE OF (IfcRepresentationItem);
	Item : OPTIONAL IfcRepresentationItem;
	Styles : SET [1:?] OF IfcStyleAssignmentSelect;
	Name : OPTIONAL IfcLabel;
 WHERE
	ApplicableItem : NOT('IFC4.IFCSTYLEDITEM' IN TYPEOF(Item));
END_ENTITY;

ENTITY IfcSurface
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBoundedSurface
    ,IfcElementarySurface
    ,IfcSweptSurface))
 SUBTYPE OF (IfcGeometricRepresentationItem);
 DERIVE
	Dim : IfcDimensionCount := 3;
END_ENTITY;

ENTITY IfcSurfaceCurveSweptAreaSolid
 SUBTYPE OF (IfcSweptAreaSolid);
	Directrix : IfcCurve;
	StartParam : OPTIONAL IfcParameterValue;
	EndParam : OPTIONAL IfcParameterValue;
	ReferenceSurface : IfcSurface;
 WHERE
	DirectrixBounded : (EXISTS(StartParam) AND EXISTS(EndParam)) OR 
(SIZEOF(['IFC4.IFCCONIC', 'IFC4.IFCBOUNDEDCURVE'] * TYPEOF(Directrix)) = 1);
END_ENTITY;

ENTITY IfcSurfaceOfLinearExtrusion
 SUBTYPE OF (IfcSweptSurface);
	ExtrudedDirection : IfcDirection;
	Depth : IfcLengthMeasure;
 DERIVE
	ExtrusionAxis : IfcVector := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcVector (ExtrudedDirection, Depth);
 WHERE
	DepthGreaterZero : Depth > 0.;
END_ENTITY;

ENTITY IfcSurfaceOfRevolution
 SUBTYPE OF (IfcSweptSurface);
	AxisPosition : IfcAxis1Placement;
 DERIVE
	AxisLine : IfcLine := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcCurve() || IfcLine(AxisPosition.Location, 
  IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcVector(AxisPosition.Z,1.0));
END_ENTITY;

ENTITY IfcSurfaceStyle
 SUBTYPE OF (IfcPresentationStyle);
	Side : IfcSurfaceSide;
	Styles : SET [1:5] OF IfcSurfaceStyleElementSelect;
 WHERE
	MaxOneShading : SIZEOF(QUERY(Style <* SELF.Styles |
  'IFC4.IFCSURFACESTYLESHADING' IN
   TYPEOF(Style)
  )) <= 1;
	MaxOneLighting : SIZEOF(QUERY(Style <* SELF.Styles |
  'IFC4.IFCSURFACESTYLELIGHTING' IN
   TYPEOF(Style)
  )) <= 1;
	MaxOneRefraction : SIZEOF(QUERY(Style <* SELF.Styles |
  'IFC4.IFCSURFACESTYLEREFRACTION' IN
   TYPEOF(Style)
  )) <= 1;
	MaxOneTextures : SIZEOF(QUERY(Style <* SELF.Styles |
  'IFC4.IFCSURFACESTYLEWITHTEXTURES' IN
   TYPEOF(Style)
  )) <= 1;
	MaxOneExtDefined : SIZEOF(QUERY(Style <* SELF.Styles |
  'IFC4.IFCEXTERNALLYDEFINEDSURFACESTYLE' IN
   TYPEOF(Style)
  )) <= 1;
END_ENTITY;

ENTITY IfcSurfaceStyleRendering
 SUBTYPE OF (IfcSurfaceStyleShading);
	DiffuseColour : OPTIONAL IfcColourOrFactor;
	TransmissionColour : OPTIONAL IfcColourOrFactor;
	DiffuseTransmissionColour : OPTIONAL IfcColourOrFactor;
	ReflectionColour : OPTIONAL IfcColourOrFactor;
	SpecularColour : OPTIONAL IfcColourOrFactor;
	SpecularHighlight : OPTIONAL IfcSpecularHighlightSelect;
	ReflectanceMethod : IfcReflectanceMethodEnum;
END_ENTITY;

ENTITY IfcSurfaceStyleShading
 SUPERTYPE OF (ONEOF
    (IfcSurfaceStyleRendering))
 SUBTYPE OF (IfcPresentationItem);
	SurfaceColour : IfcColourRgb;
	Transparency : OPTIONAL IfcNormalisedRatioMeasure;
END_ENTITY;

ENTITY IfcSurfaceTexture
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcImageTexture))
 SUBTYPE OF (IfcPresentationItem);
	RepeatS : IfcBoolean;
	RepeatT : IfcBoolean;
	Mode : OPTIONAL IfcIdentifier;
	TextureTransform : OPTIONAL IfcCartesianTransformationOperator2D;
	Parameter : OPTIONAL LIST [1:?] OF IfcIdentifier;
 INVERSE
	IsMappedBy : SET [0:?] OF IfcTextureCoordinate FOR Maps;
END_ENTITY;

ENTITY IfcSweptAreaSolid
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcExtrudedAreaSolid
    ,IfcFixedReferenceSweptAreaSolid
    ,IfcRevolvedAreaSolid
    ,IfcSurfaceCurveSweptAreaSolid))
 SUBTYPE OF (IfcSolidModel);
	SweptArea : IfcProfileDef;
	Position : OPTIONAL IfcAxis2Placement3D;
 WHERE
	SweptAreaType : SweptArea.ProfileType = IfcProfileTypeEnum.Area;
END_ENTITY;

ENTITY IfcSweptSurface
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcSurfaceOfLinearExtrusion
    ,IfcSurfaceOfRevolution))
 SUBTYPE OF (IfcSurface);
	SweptCurve : IfcProfileDef;
	Position : OPTIONAL IfcStrippedOptional;
 WHERE
	SweptCurveType : SweptCurve.ProfileType = IfcProfileTypeEnum.Curve;
END_ENTITY;

ENTITY IfcTShapeProfileDef
 SUBTYPE OF (IfcParameterizedProfileDef);
	Depth : IfcPositiveLengthMeasure;
	FlangeWidth : IfcPositiveLengthMeasure;
	WebThickness : IfcPositiveLengthMeasure;
	FlangeThickness : IfcPositiveLengthMeasure;
	FilletRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	FlangeEdgeRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	WebEdgeRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	WebSlope : OPTIONAL IfcPlaneAngleMeasure;
	FlangeSlope : OPTIONAL IfcPlaneAngleMeasure;
 WHERE
	ValidFlangeThickness : FlangeThickness < Depth;
	ValidWebThickness : WebThickness < FlangeWidth;
END_ENTITY;

ENTITY IfcTelecomAddress
 SUBTYPE OF (IfcAddress);
	TelephoneNumbers : OPTIONAL LIST [1:?] OF IfcLabel;
	FacsimileNumbers : OPTIONAL LIST [1:?] OF IfcLabel;
	PagerNumber : OPTIONAL IfcStrippedOptional;
	ElectronicMailAddresses : OPTIONAL LIST [1:?] OF IfcLabel;
	WWWHomePageURL : OPTIONAL IfcURIReference;
	MessagingIDs : OPTIONAL LIST [1:?] OF IfcURIReference;
 WHERE
	MinimumDataProvided : EXISTS (TelephoneNumbers) OR
EXISTS (FacsimileNumbers) OR 
EXISTS (PagerNumber) OR
EXISTS (ElectronicMailAddresses) OR 
EXISTS (WWWHomePageURL) OR
EXISTS (MessagingIDs);
END_ENTITY;

ENTITY IfcTessellatedFaceSet
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcPolygonalFaceSet
    ,IfcTriangulatedFaceSet))
 SUBTYPE OF (IfcTessellatedItem);
	Coordinates : IfcCartesianPointList3D;
 DERIVE
	Dim : IfcDimensionCount := 3;
 INVERSE
	HasColours : SET [0:1] OF IfcIndexedColourMap FOR MappedTo;
	HasTextures : SET [0:?] OF IfcIndexedTextureMap FOR MappedTo;
END_ENTITY;

ENTITY IfcTessellatedItem
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcIndexedPolygonalFace
    ,IfcTessellatedFaceSet))
 SUBTYPE OF (IfcGeometricRepresentationItem);
END_ENTITY;

ENTITY IfcTextureCoordinate
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcIndexedTextureMap))
 SUBTYPE OF (IfcPresentationItem);
	Maps : LIST [1:?] OF IfcSurfaceTexture;
END_ENTITY;

ENTITY IfcTextureVertexList
 SUBTYPE OF (IfcPresentationItem);
	TexCoordsList : LIST [1:?] OF LIST [2:2] OF IfcParameterValue;
END_ENTITY;

ENTITY IfcTopologicalRepresentationItem
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcConnectedFaceSet
    ,IfcEdge
    ,IfcFace
    ,IfcFaceBound
    ,IfcLoop
    ,IfcVertex))
 SUBTYPE OF (IfcRepresentationItem);
END_ENTITY;

ENTITY IfcToroidalSurface
 SUBTYPE OF (IfcElementarySurface);
	MajorRadius : IfcPositiveLengthMeasure;
	MinorRadius : IfcPositiveLengthMeasure;
 WHERE
	MajorLargerMinor : MinorRadius < MajorRadius;
END_ENTITY;

ENTITY IfcTriangulatedFaceSet
 SUBTYPE OF (IfcTessellatedFaceSet);
	Normals : OPTIONAL LIST [1:?] OF LIST [3:3] OF IfcParameterValue;
	Closed : OPTIONAL IfcBoolean;
	CoordIndex : LIST [1:?] OF LIST [3:3] OF IfcPositiveInteger;
	PnIndex : OPTIONAL LIST [1:?] OF IfcPositiveInteger;
 DERIVE
	NumberOfTriangles : IfcInteger := SIZEOF(CoordIndex);
END_ENTITY;

ENTITY IfcTypeObject
 SUPERTYPE OF (ONEOF
    (IfcTypeProduct))
 SUBTYPE OF (IfcObjectDefinition);
	ApplicableOccurrence : OPTIONAL IfcStrippedOptional;
	HasPropertySets : OPTIONAL SET [1:?] OF IfcPropertySetDefinition;
 WHERE
	NameRequired : EXISTS(SELF\IfcRoot.Name);
	UniquePropertySetNames : (NOT(EXISTS(HasPropertySets))) OR IfcUniquePropertySetNames(HasPropertySets);
END_ENTITY;

ENTITY IfcTypeProduct
 SUPERTYPE OF (ONEOF
    (IfcElementType))
 SUBTYPE OF (IfcTypeObject);
	RepresentationMaps : OPTIONAL LIST [1:?] OF IfcRepresentationMap;
	Tag : OPTIONAL IfcStrippedOptional;
 WHERE
	ApplicableOccurrence : NOT(EXISTS(SELF\IfcTypeObject.Types[1])) OR
(SIZEOF(QUERY(temp <* SELF\IfcTypeObject.Types[1].RelatedObjects |
  NOT('IFC4.IFCPRODUCT' IN TYPEOF(temp)))
) = 0);
END_ENTITY;

ENTITY IfcUShapeProfileDef
 SUBTYPE OF (IfcParameterizedProfileDef);
	Depth : IfcPositiveLengthMeasure;
	FlangeWidth : IfcPositiveLengthMeasure;
	WebThickness : IfcPositiveLengthMeasure;
	FlangeThickness : IfcPositiveLengthMeasure;
	FilletRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	EdgeRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	FlangeSlope : OPTIONAL IfcPlaneAngleMeasure;
 WHERE
	ValidFlangeThickness : FlangeThickness < (Depth / 2.);
	ValidWebThickness : WebThickness < FlangeWidth;
END_ENTITY;

ENTITY IfcVector
 SUBTYPE OF (IfcGeometricRepresentationItem);
	Orientation : IfcDirection;
	Magnitude : IfcLengthMeasure;
 DERIVE
	Dim : IfcDimensionCount := Orientation.Dim;
 WHERE
	MagGreaterOrEqualZero : Magnitude >= 0.0;
END_ENTITY;

ENTITY IfcVertex
 SUPERTYPE OF (ONEOF
    (IfcVertexPoint))
 SUBTYPE OF (IfcTopologicalRepresentationItem);
END_ENTITY;

ENTITY IfcVertexPoint
 SUBTYPE OF (IfcVertex);
	VertexGeometry : IfcPoint;
END_ENTITY;

ENTITY IfcVirtualGridIntersection;
	IntersectingAxes : LIST [2:2] OF IfcGridAxis;
	OffsetDistances : LIST [2:3] OF IfcLengthMeasure;
END_ENTITY;

ENTITY IfcWall
 SUPERTYPE OF (ONEOF
    (IfcWallElementedCase
    ,IfcWallStandardCase))
 SUBTYPE OF (IfcBuildingElement);
	PredefinedType : OPTIONAL IfcStrippedOptional;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR
 (PredefinedType <> IfcWallTypeEnum.USERDEFINED) OR
 ((PredefinedType = IfcWallTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFC4.IFCWALLTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcWallElementedCase
 SUBTYPE OF (IfcWall);
 WHERE
	HasDecomposition : HIINDEX(SELF\IfcObjectDefinition.IsDecomposedBy) > 0;
END_ENTITY;

ENTITY IfcWallStandardCase
 SUBTYPE OF (IfcWall);
 WHERE
	HasMaterialLayerSetUsage : SIZEOF (QUERY(temp <* USEDIN(SELF, 'IFC4.IFCRELASSOCIATES.RELATEDOBJECTS') |
              ('IFC4.IFCRELASSOCIATESMATERIAL' IN TYPEOF(temp)) AND
              ('IFC4.IFCMATERIALLAYERSETUSAGE' IN TYPEOF(temp.RelatingMaterial))
              )) = 1;
END_ENTITY;

ENTITY IfcWallType
 SUBTYPE OF (IfcBuildingElementType);
	PredefinedType : IfcWallTypeEnum;
 WHERE
	CorrectPredefinedType : (PredefinedType <> IfcWallTypeEnum.USERDEFINED) OR
((PredefinedType = IfcWallTypeEnum.USERDEFINED) AND EXISTS(SELF\IfcElementType.ElementType));
END_ENTITY;

ENTITY IfcWindow
 SUPERTYPE OF (ONEOF
    (IfcWindowStandardCase))
 SUBTYPE OF (IfcBuildingElement);
	OverallHeight : OPTIONAL IfcStrippedOptional;
	OverallWidth : OPTIONAL IfcStrippedOptional;
	PredefinedType : OPTIONAL IfcStrippedOptional;
	PartitioningType : OPTIONAL IfcStrippedOptional;
	UserDefinedPartitioningType : OPTIONAL IfcStrippedOptional;
 WHERE
	CorrectStyleAssigned : (SIZEOF(IsTypedBy) = 0) 
OR ('IFC4.IFCWINDOWTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcWindowStandardCase
 SUBTYPE OF (IfcWindow);
END_ENTITY;

ENTITY IfcZShapeProfileDef
 SUBTYPE OF (IfcParameterizedProfileDef);
	Depth : IfcPositiveLengthMeasure;
	FlangeWidth : IfcPositiveLengthMeasure;
	WebThickness : IfcPositiveLengthMeasure;
	FlangeThickness : IfcPositiveLengthMeasure;
	FilletRadius : OPTIONAL IfcNonNegativeLengthMeasure;
	EdgeRadius : OPTIONAL IfcNonNegativeLengthMeasure;
 WHERE
	ValidFlangeThickness : FlangeThickness < (Depth / 2.);
END_ENTITY;

FUNCTION IfcConsecutiveSegments
(Segments : LIST [1:?] OF IfcSegmentIndexSelect)
  : BOOLEAN;

 LOCAL
  Result : BOOLEAN := TRUE;
 END_LOCAL;

  REPEAT i := 1 TO (HIINDEX(Segments)-1);
    IF Segments[i][HIINDEX(Segments[i])] <> Segments[i+1][1] THEN
      BEGIN
        Result := FALSE;
        ESCAPE;
      END;
	END_IF;
  END_REPEAT;

  RETURN (Result);
END_FUNCTION;

FUNCTION IfcConstraintsParamBSpline
( Degree, UpKnots, UpCp : INTEGER;
  KnotMult : LIST OF INTEGER;
  Knots : LIST OF IfcParameterValue ) 
: BOOLEAN;


  LOCAL
    Result : BOOLEAN := TRUE;
    K, Sum : INTEGER;
  END_LOCAL;

  (* Find sum of knot multiplicities. *)
  Sum := KnotMult[1];
  REPEAT i := 2 TO UpKnots;
    Sum := Sum + KnotMult[i];
  END_REPEAT;

  (* Check limits holding for all B-spline parametrisations *)
  IF (Degree < 1) OR (UpKnots < 2) OR (UpCp < Degree) OR
    (Sum <> (Degree + UpCp + 2)) THEN
    Result := FALSE;
    RETURN(Result);
  END_IF;

  K := KnotMult[1];
  IF (K < 1) OR (K > Degree + 1) THEN
    Result := FALSE;
    RETURN(Result);
  END_IF;

  REPEAT i := 2 TO UpKnots;
    IF (KnotMult[i] < 1) OR (Knots[i] <= Knots[i-1]) THEN
      Result := FALSE;
      RETURN(Result);
    END_IF;
    K := KnotMult[i];
    IF (i < UpKnots) AND (K > Degree) THEN
      Result := FALSE;
      RETURN(Result);
    END_IF;
    IF (i = UpKnots) AND (K > Degree + 1) THEN
      Result := FALSE;
      RETURN(Result);
    END_IF;
  END_REPEAT;

  RETURN(result);
END_FUNCTION;

FUNCTION IfcCorrectLocalPlacement
(AxisPlacement:IfcAxis2Placement; 
   RelPlacement : IfcObjectPlacement):LOGICAL;

  IF (EXISTS(RelPlacement)) THEN
    IF ('IFC4.IFCGRIDPLACEMENT' IN TYPEOF(RelPlacement)) THEN
      RETURN(?);
    END_IF;
    IF ('IFC4.IFCLOCALPLACEMENT' IN TYPEOF(RelPlacement)) THEN
      IF ('IFC4.IFCAXIS2PLACEMENT2D' IN TYPEOF(AxisPlacement)) THEN
        RETURN(TRUE);
      END_IF;
      IF ('IFC4.IFCAXIS2PLACEMENT3D' IN TYPEOF(AxisPlacement)) THEN
        IF (RelPlacement\IfcLocalPlacement.RelativePlacement.Dim = 3) THEN
          RETURN(TRUE);
        ELSE
          RETURN(FALSE);
        END_IF;
      END_IF;
    END_IF;
  ELSE
    RETURN(TRUE);  
  END_IF;
  RETURN(?);
END_FUNCTION;

FUNCTION IfcCrossProduct
(Arg1, Arg2 : IfcDirection) 
    : IfcVector;
LOCAL
  Mag : REAL;
  Res : IfcDirection;
  V1,V2  : LIST[3:3] OF REAL;
  Result : IfcVector;
END_LOCAL;

  IF (NOT EXISTS (Arg1) OR (Arg1.Dim = 2)) OR (NOT EXISTS (Arg2) OR (Arg2.Dim = 2)) THEN
    RETURN(?);
  ELSE
    BEGIN
      V1  := IfcNormalise(Arg1)\IfcDirection.DirectionRatios;

      V2  := IfcNormalise(Arg2)\IfcDirection.DirectionRatios;
      Res := IfcRepresentationItem() || IfcGeometricRepresentationItem () 
             || IfcDirection([(V1[2]*V2[3] - V1[3]*V2[2]), (V1[3]*V2[1] - V1[1]*V2[3]), (V1[1]*V2[2] - V1[2]*V2[1])]);
      Mag := 0.0;
      REPEAT i := 1 TO 3;
        Mag := Mag + Res.DirectionRatios[i]*Res.DirectionRatios[i];
      END_REPEAT;
      IF (Mag > 0.0) THEN
        Result := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcVector(Res, SQRT(Mag));
      ELSE
        Result := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcVector(Arg1, 0.0);
      END_IF;
      RETURN(Result);
    END;
  END_IF;
END_FUNCTION;

FUNCTION IfcCurveWeightsPositive
( B: IfcRationalBSplineCurveWithKnots)
: BOOLEAN;

  LOCAL
    Result : BOOLEAN := TRUE;
  END_LOCAL;

  REPEAT i := 0 TO B.UpperIndexOnControlPoints;
    IF B.Weights[i] <= 0.0  THEN
      Result := FALSE;
      RETURN(Result);
    END_IF;
  END_REPEAT;
  RETURN(Result);
END_FUNCTION;

FUNCTION IfcDotProduct
(Arg1, Arg2 : IfcDirection) 
    : REAL;
LOCAL
  Scalar : REAL;
  Vec1, Vec2 : IfcDirection;
  Ndim   : INTEGER;
END_LOCAL;

  IF NOT EXISTS (Arg1) OR NOT EXISTS (Arg2) THEN
    Scalar := ?;
  ELSE
    IF (Arg1.Dim <> Arg2.Dim) THEN
      Scalar := ?;
    ELSE
      BEGIN
        Vec1 := IfcNormalise(Arg1);
        Vec2 := IfcNormalise(Arg2);
        Ndim := Arg1.Dim;
        Scalar := 0.0;
        REPEAT i := 1 TO Ndim;
          Scalar := Scalar + Vec1.DirectionRatios[i]*Vec2.DirectionRatios[i];
        END_REPEAT;
      END;
    END_IF;
  END_IF;
  RETURN (Scalar);
END_FUNCTION;

FUNCTION IfcLoopHeadToTail
(ALoop : IfcEdgeLoop) : LOGICAL;
   LOCAL
     N : INTEGER;
     P : LOGICAL := TRUE;
   END_LOCAL;
     
     N := SIZEOF (ALoop.EdgeList);
     REPEAT i := 2 TO N;
       P := P AND (ALoop.EdgeList[i-1].EdgeEnd :=:
                   ALoop.EdgeList[i].EdgeStart);
     END_REPEAT;     
     RETURN (P);
END_FUNCTION;

FUNCTION IfcNormalise
(Arg : IfcVectorOrDirection) 
    : IfcVectorOrDirection;
LOCAL
  Ndim : INTEGER;
  V    : IfcDirection
         := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcDirection([1.,0.]); 
  Vec  : IfcVector 
         := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcVector (
            IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcDirection([1.,0.]), 1.);
  Mag  : REAL;
  Result : IfcVectorOrDirection
         := V;
END_LOCAL;

  IF NOT EXISTS (Arg) THEN
    RETURN (?);
  ELSE
    IF 'IFC4.IFCVECTOR' IN TYPEOF(Arg) THEN
      BEGIN
        Ndim := Arg\IfcVector.Dim;
	V.DirectionRatios := Arg\IfcVector.Orientation.DirectionRatios;
        Vec.Magnitude := Arg\IfcVector.Magnitude;
	Vec.Orientation := V;
        IF Arg\IfcVector.Magnitude = 0.0 THEN
          RETURN(?);
        ELSE
          Vec.Magnitude := 1.0;
        END_IF;
      END;
    ELSE
      BEGIN
        Ndim := Arg\IfcDirection.Dim;
        V.DirectionRatios := Arg\IfcDirection.DirectionRatios;
      END;
    END_IF;

    Mag := 0.0;
      REPEAT i := 1 TO Ndim;
        Mag := Mag + V.DirectionRatios[i]*V.DirectionRatios[i];
      END_REPEAT;
    IF Mag > 0.0 THEN
      Mag := SQRT(Mag);
      REPEAT i := 1 TO Ndim;
        V.DirectionRatios[i] := V.DirectionRatios[i]/Mag;
      END_REPEAT;
      IF 'IFC4.IFCVECTOR' IN TYPEOF(arg) THEN
        Vec.Orientation := V;
        Result := Vec;
      ELSE
        Result := V;
      END_IF;
    ELSE
      RETURN(?);
    END_IF;
  END_IF;
  RETURN (Result);
END_FUNCTION;

FUNCTION IfcShapeRepresentationTypes
(RepType : IfcLabel; Items : SET OF IfcRepresentationItem) : LOGICAL;
    
    LOCAL
      Count : INTEGER := 0;
    END_LOCAL;

    CASE RepType OF 
    'Point' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCPOINT' IN TYPEOF(temp))));
      END;

    'PointCloud' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCCARTESIANPOINTLIST3D' IN TYPEOF(temp))));
      END;

    'Curve' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCCURVE' IN TYPEOF(temp))));
      END;

    'Curve2D' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCCURVE' IN TYPEOF(temp)) 
                 AND (temp\IfcCurve.Dim = 2)));
      END;

    'Curve3D' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCCURVE' IN TYPEOF(temp)) 
                 AND (temp\IfcCurve.Dim = 3)));
      END;

    'Surface' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCSURFACE' IN TYPEOF(temp))));
      END;

    'Surface2D' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCSURFACE' IN TYPEOF(temp)) 
                 AND (temp\IfcSurface.Dim = 2)));
      END;

    'Surface3D' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCSURFACE' IN TYPEOF(temp)) 
                 AND (temp\IfcSurface.Dim = 3)));
      END;

    'FillArea' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCANNOTATIONFILLAREA' IN TYPEOF(temp))));
      END;

    'Text' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCTEXTLITERAL' IN TYPEOF(temp))));
      END;

    'AdvancedSurface' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | 'IFC4.IFCBSPLINESURFACE' IN TYPEOF(temp)));
      END;

    'Annotation2D' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | (
                  SIZEOF(TYPEOF(temp) * [
                   'IFC4.IFCPOINT',
                   'IFC4.IFCCURVE',
                   'IFC4.IFCGEOMETRICCURVESET',
                   'IFC4.IFCANNOTATIONFILLAREA',
                   'IFC4.IFCTEXTLITERAL']) = 1)
                 ));
      END;

    'GeometricSet' : 
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCGEOMETRICSET' IN TYPEOF(temp))
                 OR ('IFC4.IFCPOINT' IN TYPEOF(temp))
                 OR ('IFC4.IFCCURVE' IN TYPEOF(temp))
                 OR ('IFC4.IFCSURFACE' IN TYPEOF(temp))));
      END;

    'GeometricCurveSet' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCGEOMETRICCURVESET' IN TYPEOF(temp))
                 OR ('IFC4.IFCGEOMETRICSET' IN TYPEOF(temp))
                 OR ('IFC4.IFCPOINT' IN TYPEOF(temp))
                 OR ('IFC4.IFCCURVE' IN TYPEOF(temp))));
         REPEAT i:=1 TO HIINDEX(Items);  
           IF ('IFC4.IFCGEOMETRICSET' IN TYPEOF(Items[i]))
           THEN
             IF (SIZEOF(QUERY(temp <* Items[i]\IfcGeometricSet.Elements | 'IFC4.IFCSURFACE' IN TYPEOF(temp))) > 0)
             THEN
               Count := Count - 1;
             END_IF;
           END_IF;
         END_REPEAT;
      END;

    'Tessellation' :
      BEGIN 
        Count := SIZEOF(QUERY(temp <* Items | 'IFC4.IFCTESSELLATEDITEM' IN TYPEOF(temp)));
      END;

    'SurfaceOrSolidModel' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | SIZEOF([
                   'IFC4.IFCTESSELLATEDITEM',
                   'IFC4.IFCSHELLBASEDSURFACEMODEL',
                   'IFC4.IFCFACEBASEDSURFACEMODEL',
                   'IFC4.IFCSOLIDMODEL'] * TYPEOF(temp)) >= 1
                 ));      
      END;

    'SurfaceModel' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | SIZEOF([
                   'IFC4.IFCTESSELLATEDITEM',
                   'IFC4.IFCSHELLBASEDSURFACEMODEL',
                   'IFC4.IFCFACEBASEDSURFACEMODEL'] * TYPEOF(temp)) >= 1
                 ));      
      END;

    'SolidModel' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCSOLIDMODEL' IN TYPEOF(temp))));            
      END;

    'SweptSolid' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | (SIZEOF([
                   'IFC4.IFCEXTRUDEDAREASOLID',
                   'IFC4.IFCREVOLVEDAREASOLID'] * TYPEOF(temp)) >= 1
                   ) AND (SIZEOF([
                   'IFC4.IFCEXTRUDEDAREASOLIDTAPERED',
                   'IFC4.IFCREVOLVEDAREASOLIDTAPERED'] * TYPEOF(temp)) = 0
                   )
                 ));                             
      END;

    'AdvancedSweptSolid' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | SIZEOF([
                   'IFC4.IFCSWEPTAREASOLID',
                   'IFC4.IFCSWEPTDISKSOLID'] *  TYPEOF(temp)) >= 1
                 ));      
      END;

    'CSG' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | SIZEOF([
                   'IFC4.IFCBOOLEANRESULT',
                   'IFC4.IFCCSGPRIMITIVE3D',
                   'IFC4.IFCCSGSOLID'] *  TYPEOF(temp)) >= 1
                 ));            
      END;

    'Clipping' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | SIZEOF([
                   'IFC4.IFCCSGSOLID',
                   'IFC4.IFCBOOLEANCLIPPINGRESULT'] * TYPEOF(temp)) >= 1
                 )); 
      END;

    'Brep' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCFACETEDBREP' IN TYPEOF(temp))));      
      END;

    'AdvancedBrep' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCMANIFOLDSOLIDBREP' IN TYPEOF(temp))));      
      END;

    'BoundingBox' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCBOUNDINGBOX' IN TYPEOF(temp))));
        IF (SIZEOF(Items) > 1)
        THEN
          Count := 0;
        END_IF;   
      END;

    'SectionedSpine' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCSECTIONEDSPINE' IN TYPEOF(temp))));      
      END;

    'LightSource' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCLIGHTSOURCE' IN TYPEOF(temp))));      
      END;

    'MappedRepresentation' :
      BEGIN
        Count := SIZEOF(QUERY(temp <* Items | ('IFC4.IFCMAPPEDITEM' IN TYPEOF(temp))));  
      END;

     OTHERWISE : RETURN(?);
    END_CASE;
    RETURN (Count = SIZEOF(Items));
END_FUNCTION;

FUNCTION IfcSurfaceWeightsPositive
( B: IfcRationalBSplineSurfaceWithKnots) 
: BOOLEAN;

  LOCAL
    Result : BOOLEAN := TRUE;
  END_LOCAL;

  REPEAT i := 0 TO B\IfcBSplineSurface.UUpper;
    REPEAT j := 0 TO B\IfcBSplineSurface.VUpper;
      IF (B.Weights[i][j] <= 0.0) THEN
        Result := FALSE;
        RETURN(Result);
      END_IF;
    END_REPEAT;
  END_REPEAT;
  RETURN(Result);
END_FUNCTION;

FUNCTION IfcTaperedSweptAreaProfiles
(StartArea, EndArea : IfcProfileDef)
 : LOGICAL;

LOCAL
   Result : LOGICAL := FALSE;
END_LOCAL;
   
IF ('IFC4.IFCPARAMETERIZEDPROFILEDEF' IN TYPEOF(StartArea)) THEN
   IF ('IFC4.IFCDERIVEDPROFILEDEF' IN TYPEOF(EndArea)) THEN
      Result := (StartArea :=: EndArea\IfcDerivedProfileDef.ParentProfile);
   ELSE
      Result := (TYPEOF(StartArea) = TYPEOF(EndArea));
   END_IF;
ELSE
   IF ('IFC4.IFCDERIVEDPROFILEDEF' IN TYPEOF(EndArea)) THEN
      Result := (StartArea :=: EndArea\IfcDerivedProfileDef.ParentProfile);
   ELSE
      Result := FALSE;
   END_IF;
END_IF;

RETURN(Result);
END_FUNCTION;

FUNCTION IfcUniqueDefinitionNames
(Relations : SET [1:?] OF IfcRelDefinesByProperties)
:LOGICAL;

LOCAL
  Definition : IfcPropertySetDefinitionSelect;
  DefinitionSet : IfcPropertySetDefinitionSet;
  Properties : SET OF IfcPropertySetDefinition := [];
  Result : LOGICAL;
END_LOCAL;

IF SIZEOF(Relations) = 0 THEN
  RETURN(TRUE);
END_IF;

REPEAT i:=1 TO HIINDEX(Relations);
  Definition := Relations[i].RelatingPropertyDefinition;
  IF 'IFC4.IFCPROPERTYSETDEFINITION' IN TYPEOF(Definition) THEN
    Properties := Properties + Definition;
  ELSE 
    IF 'IFC4.IFCPROPERTYSETDEFINITIONSET' IN TYPEOF(Definition) THEN
      BEGIN
        DefinitionSet := Definition;
        REPEAT j:= 1 TO HIINDEX(DefinitionSet);
          Properties := Properties + DefinitionSet[j];
        END_REPEAT;
      END;
	END_IF;
  END_IF;
END_REPEAT;

Result := IfcUniquePropertySetNames(Properties);
RETURN (Result);
END_FUNCTION;

FUNCTION IfcUniquePropertyName
(Properties : SET [1:?] OF IfcProperty)
 :LOGICAL;

 LOCAL
   Names : SET OF IfcIdentifier := [];
 END_LOCAL;

 REPEAT i:=1 TO HIINDEX(Properties);
   Names := Names + Properties[i].Name;
 END_REPEAT;

 RETURN (SIZEOF(Names) = SIZEOF(Properties));
END_FUNCTION;

FUNCTION IfcUniquePropertySetNames
(Properties : SET [1:?] OF IfcPropertySetDefinition)
:LOGICAL;

LOCAL
  Names : SET OF IfcLabel := [];
  Unnamed : INTEGER := 0;
END_LOCAL;

REPEAT i:=1 TO HIINDEX(Properties);
  IF 'IFC4.IFCPROPERTYSET' IN TYPEOF(Properties[i]) THEN
    Names := Names + Properties[i]\IfcRoot.Name;
  ELSE
    Unnamed := Unnamed + 1;
  END_IF;
END_REPEAT;

RETURN (SIZEOF(Names) + Unnamed = SIZEOF(Properties));
END_FUNCTION;

FUNCTION IfcUniquePropertyTemplateNames
(Properties : SET [1:?] OF IfcPropertyTemplate)
:LOGICAL;

LOCAL
  Names : SET OF IfcLabel := [];
END_LOCAL;

REPEAT i:=1 TO HIINDEX(Properties);
  Names := Names + Properties[i].Name;
END_REPEAT;
RETURN (SIZEOF(Names) = SIZEOF(Properties));
END_FUNCTION;

RULE IfcRepresentationContextSameWCS FOR
	(IfcGeometricRepresentationContext);
LOCAL
  IsDifferent  : LOGICAL := FALSE;
END_LOCAL;
  IF (SIZEOF(IfcGeometricRepresentationContext) > 1)
  THEN
    REPEAT i := 2 TO HIINDEX(IfcGeometricRepresentationContext);
      IF (IfcGeometricRepresentationContext[1].WorldCoordinateSystem :<>: IfcGeometricRepresentationContext[i].WorldCoordinateSystem)
      THEN
        IsDifferent := (NOT(IfcSameValidPrecision(IfcGeometricRepresentationContext[1].Precision,
                                                  IfcGeometricRepresentationContext[i].Precision)))
                    OR (NOT(IfcSameAxis2Placement(IfcGeometricRepresentationContext[1].WorldCoordinateSystem,
                                                  IfcGeometricRepresentationContext[i].WorldCoordinateSystem,
                                                  IfcGeometricRepresentationContext[1].Precision)));
        IF (IsDifferent = TRUE) THEN
          ESCAPE;
        END_IF;
      END_IF;
    END_REPEAT;
  END_IF;
    WHERE
      WR1 : IsDifferent = FALSE;
END_RULE;

RULE IfcSingleProjectInstance FOR
	(IfcProject);

    WHERE
      WR1 : SIZEOF(IfcProject) <= 1;
END_RULE;

END_SCHEMA;
