(*
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 IFCPRODUCTEXTENSION;

REFERENCE FROM IFCMEASURERESOURCE
(
  IfcLengthMeasure,
  IfcPositiveLengthMeasure,
  IfcCompoundPlaneAngleMeasure,
  IfcUnit,
  IfcDerivedUnit,
  IfcNamedUnit,
  IfcContextDependentUnit,
  IfcConversionBasedUnit,
  IfcSiUnit,
  IfcIdentifier,
  IfcLabel
);

REFERENCE FROM IFCGEOMETRYRESOURCE
(
  IfcLine,
  IfcConic,
  IfcGeometricRepresentationItem,
  IfcAxis2Placement,
  IfcAxis2Placement2D,
  IfcAxis2Placement3D,
  IfcTrimmedCurve,
  IfcCompositeCurve,
  IfcPolyline
);

REFERENCE FROM IFCGEOMETRICMODELRESOURCE
(
  IfcBoundingBox,
  IfcGeometricSet
);

REFERENCE FROM IFCMATERIALRESOURCE
(
  IfcMaterialSelect,
  IfcMaterial,
  IfcMaterialList,
  IfcMaterialLayerSet
);

REFERENCE FROM IFCACTORRESOURCE
(
  IfcActorSelect,
  IfcPerson,
  IfcPersonAndOrganization,
  IfcPostalAddress
);

REFERENCE FROM IFCPROPERTYRESOURCE
(
  IfcPropertySingleValue
);

REFERENCE FROM IFCKERNEL
(
  IfcGroup,
  IfcRelAssignsToGroup,
  IfcProxy,
  IfcObject,
  IfcProduct,
  IfcRelConnects,
  IfcQuantitySet,
  IfcRelAggregates,
  IfcRelAssociates,
  IfcRoot,
  IfcTypeProduct,
  IfcRelDecomposes
);

REFERENCE FROM IFCSHAREDBLDGELEMENTS
(
  IfcBeam,
  IfcColumn,
  IfcCurtainWall,
  IfcDoor,
  IfcMember,
  IfcRailing,
  IfcRamp,
  IfcRampFlight,
  IfcRoof,
  IfcSlab,
  IfcStair,
  IfcStairFlight,
  IfcWall,
  IfcWindow,
  IfcBeamType,
  IfcColumnType,
  IfcMemberType,
  IfcWallType,
  IfcSlabType,
  IfcStairFlightType,
  IfcRampFlightType,
  IfcCurtainWallType,
  IfcRailingType,
  IfcPlate,
  IfcPlateType,
  IfcRelConnectsPathElements,
  IfcChimney,
  IfcCovering,
  IfcBuildingElementProxy,
  IfcRelCoversSpaces,
  IfcRelCoversBldgElements,
  IfcBuildingSystem
);

REFERENCE FROM IFCSHAREDBLDGSERVICEELEMENTS
(
  IfcDistributionFlowElement,
  IfcDistributionControlElement,
  IfcDistributionControlElementType,
  IfcDistributionFlowElementType,
  IfcDistributionSystem
);

REFERENCE FROM IFCSHAREDFACILITIESELEMENTS
(
  IfcFurnitureType,
  IfcSystemFurnitureElementType
);

REFERENCE FROM IFCGEOMETRICCONSTRAINTRESOURCE
(
  IfcConnectionGeometry,
  IfcConnectionSurfaceGeometry,
  IfcGridAxis
);

REFERENCE FROM IFCQUANTITYRESOURCE
(
  IfcPhysicalQuantity,
  IfcUniqueQuantityNames
);

REFERENCE FROM IFCSTRUCTURALELEMENTSDOMAIN
(
  IfcFooting,
  IfcPile
);

REFERENCE FROM IFCSHAREDCOMPONENTELEMENTS
(
);

REFERENCE FROM IFCREPRESENTATIONRESOURCE
(
  IfcShapeRepresentation
);

REFERENCE FROM IFCEXTERNALREFERENCERESOURCE
(
  IfcClassificationReference
);

REFERENCE FROM IFCPRESENTATIONAPPEARANCERESOURCE
(
  IfcNullStyle
);

TYPE IfcAssemblyPlaceEnum = ENUMERATION OF
	(SITE
	,FACTORY
	,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 IfcElementCompositionEnum = ENUMERATION OF
	(COMPLEX
	,ELEMENT
	,PARTIAL);
END_TYPE;

TYPE IfcExternalSpatialElementTypeEnum = ENUMERATION OF
	(EXTERNAL
	,EXTERNAL_EARTH
	,EXTERNAL_WATER
	,EXTERNAL_FIRE
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcGeographicElementTypeEnum = ENUMERATION OF
	(TERRAIN
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcGridTypeEnum = ENUMERATION OF
	(RECTANGULAR
	,RADIAL
	,TRIANGULAR
	,IRREGULAR
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcInternalOrExternalEnum = ENUMERATION OF
	(INTERNAL
	,EXTERNAL
	,EXTERNAL_EARTH
	,EXTERNAL_WATER
	,EXTERNAL_FIRE
	,NOTDEFINED);
END_TYPE;

TYPE IfcOpeningElementTypeEnum = ENUMERATION OF
	(OPENING
	,RECESS
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcPhysicalOrVirtualEnum = ENUMERATION OF
	(PHYSICAL
	,VIRTUAL
	,NOTDEFINED);
END_TYPE;

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

TYPE IfcSpaceTypeEnum = ENUMERATION OF
	(SPACE
	,PARKING
	,GFA
	,INTERNAL
	,EXTERNAL
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcSpatialZoneTypeEnum = ENUMERATION OF
	(CONSTRUCTION
	,FIRESAFETY
	,LIGHTING
	,OCCUPANCY
	,SECURITY
	,THERMAL
	,TRANSPORT
	,VENTILATION
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcTransportElementTypeEnum = ENUMERATION OF
	(ELEVATOR
	,ESCALATOR
	,MOVINGWALKWAY
	,CRANEWAY
	,LIFTINGGEAR
	,USERDEFINED
	,NOTDEFINED);
END_TYPE;

TYPE IfcSpaceBoundarySelect = SELECT
	(IfcExternalSpatialElement
	,IfcSpace);
END_TYPE;

ENTITY IfcAnnotation
 SUBTYPE OF (IfcProduct);
 INVERSE
	ContainedInStructure : SET [0:1] OF IfcRelContainedInSpatialStructure FOR RelatedElements;
END_ENTITY;

ENTITY IfcBuilding
 SUBTYPE OF (IfcSpatialStructureElement);
	ElevationOfRefHeight : OPTIONAL IfcLengthMeasure;
	ElevationOfTerrain : OPTIONAL IfcLengthMeasure;
	BuildingAddress : OPTIONAL IfcPostalAddress;
END_ENTITY;

ENTITY IfcBuildingElement
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBeam
    ,IfcBuildingElementProxy
    ,IfcChimney
    ,IfcColumn
    ,IfcCovering
    ,IfcCurtainWall
    ,IfcDoor
    ,IfcFooting
    ,IfcMember
    ,IfcPile
    ,IfcPlate
    ,IfcRailing
    ,IfcRamp
    ,IfcRampFlight
    ,IfcRoof
    ,IfcShadingDevice
    ,IfcSlab
    ,IfcStair
    ,IfcStairFlight
    ,IfcWall
    ,IfcWindow))
 SUBTYPE OF (IfcElement);
 WHERE
	MaxOneMaterialAssociation : SIZEOF (QUERY(temp <* SELF\IfcObjectDefinition.HasAssociations |
  'IFCPRODUCTEXTENSION.IFCRELASSOCIATESMATERIAL' IN TYPEOF(temp)
  )) <= 1;
END_ENTITY;

ENTITY IfcBuildingElementType
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBeamType
    ,IfcBuildingElementProxyType
    ,IfcChimneyType
    ,IfcColumnType
    ,IfcCoveringType
    ,IfcCurtainWallType
    ,IfcDoorType
    ,IfcFootingType
    ,IfcMemberType
    ,IfcPileType
    ,IfcPlateType
    ,IfcRailingType
    ,IfcRampFlightType
    ,IfcRampType
    ,IfcRoofType
    ,IfcShadingDeviceType
    ,IfcSlabType
    ,IfcStairFlightType
    ,IfcStairType
    ,IfcWallType
    ,IfcWindowType))
 SUBTYPE OF (IfcElementType);
END_ENTITY;

ENTITY IfcBuildingStorey
 SUBTYPE OF (IfcSpatialStructureElement);
	Elevation : OPTIONAL IfcLengthMeasure;
END_ENTITY;

ENTITY IfcCivilElement
 SUBTYPE OF (IfcElement);
END_ENTITY;

ENTITY IfcCivilElementType
 SUBTYPE OF (IfcElementType);
END_ENTITY;

ENTITY IfcDistributionElement
 SUPERTYPE OF (ONEOF
    (IfcDistributionControlElement
    ,IfcDistributionFlowElement))
 SUBTYPE OF (IfcElement);
 INVERSE
	HasPorts : SET [0:?] OF IfcRelConnectsPortToElement FOR RelatedElement;
END_ENTITY;

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

ENTITY IfcElement
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBuildingElement
    ,IfcCivilElement
    ,IfcDistributionElement
    ,IfcElementAssembly
    ,IfcElementComponent
    ,IfcFeatureElement
    ,IfcFurnishingElement
    ,IfcGeographicElement
    ,IfcTransportElement
    ,IfcVirtualElement))
 SUBTYPE OF (IfcProduct);
	Tag : OPTIONAL IfcIdentifier;
 INVERSE
	FillsVoids : SET [0:1] OF IfcRelFillsElement FOR RelatedBuildingElement;
	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;
	ReferencedInStructures : SET [0:?] OF IfcRelReferencedInSpatialStructure FOR RelatedElements;
	HasOpenings : SET [0:?] OF IfcRelVoidsElement FOR RelatingBuildingElement;
	IsConnectionRealization : SET [0:?] OF IfcRelConnectsWithRealizingElements FOR RealizingElements;
	ProvidesBoundaries : SET [0:?] OF IfcRelSpaceBoundary FOR RelatedBuildingElement;
	ConnectedFrom : SET [0:?] OF IfcRelConnectsElements FOR RelatedElement;
	ContainedInStructure : SET [0:1] OF IfcRelContainedInSpatialStructure FOR RelatedElements;
	HasCoverings : SET [0:?] OF IfcRelCoversBldgElements FOR RelatingBuildingElement;
END_ENTITY;

ENTITY IfcElementAssembly
 SUBTYPE OF (IfcElement);
	AssemblyPlace : OPTIONAL IfcAssemblyPlaceEnum;
	PredefinedType : OPTIONAL IfcElementAssemblyTypeEnum;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR
 (PredefinedType <> IfcElementAssemblyTypeEnum.USERDEFINED) OR
 ((PredefinedType = IfcElementAssemblyTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFCPRODUCTEXTENSION.IFCELEMENTASSEMBLYTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
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 IfcElementQuantity
 SUBTYPE OF (IfcQuantitySet);
	MethodOfMeasurement : OPTIONAL IfcLabel;
	Quantities : SET [1:?] OF IfcPhysicalQuantity;
 WHERE
	UniqueQuantityNames : IfcUniqueQuantityNames(Quantities);
END_ENTITY;

ENTITY IfcElementType
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBuildingElementType
    ,IfcCivilElementType
    ,IfcDistributionElementType
    ,IfcElementAssemblyType
    ,IfcElementComponentType
    ,IfcFurnishingElementType
    ,IfcGeographicElementType
    ,IfcTransportElementType))
 SUBTYPE OF (IfcTypeProduct);
	ElementType : OPTIONAL IfcLabel;
END_ENTITY;

ENTITY IfcExternalSpatialElement
 SUBTYPE OF (IfcExternalSpatialStructureElement);
	PredefinedType : OPTIONAL IfcExternalSpatialElementTypeEnum;
 INVERSE
	BoundedBy : SET [0:?] OF IfcRelSpaceBoundary FOR RelatingSpace;
END_ENTITY;

ENTITY IfcExternalSpatialStructureElement
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcExternalSpatialElement))
 SUBTYPE OF (IfcSpatialElement);
END_ENTITY;

ENTITY IfcFeatureElement
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcFeatureElementAddition
    ,IfcFeatureElementSubtraction
    ,IfcSurfaceFeature))
 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
    ,IfcVoidingFeature))
 SUBTYPE OF (IfcFeatureElement);
 INVERSE
	VoidsElements : IfcRelVoidsElement FOR RelatedOpeningElement;
 WHERE
	HasNoSubtraction : SIZEOF(SELF\IfcElement.HasOpenings) = 0;
	IsNotFilling : SIZEOF(SELF\IfcElement.FillsVoids) = 0;
END_ENTITY;

ENTITY IfcFurnishingElement
 SUPERTYPE OF (ONEOF
    (IfcFurniture
    ,IfcSystemFurnitureElement))
 SUBTYPE OF (IfcElement);
END_ENTITY;

ENTITY IfcFurnishingElementType
 SUPERTYPE OF (ONEOF
    (IfcFurnitureType
    ,IfcSystemFurnitureElementType))
 SUBTYPE OF (IfcElementType);
END_ENTITY;

ENTITY IfcGeographicElement
 SUBTYPE OF (IfcElement);
	PredefinedType : OPTIONAL IfcGeographicElementTypeEnum;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR
 (PredefinedType <> IfcGeographicElementTypeEnum.USERDEFINED) OR
 ((PredefinedType = IfcGeographicElementTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFCPRODUCTEXTENSION.IFCGEOGRAPHICELEMENTTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

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

ENTITY IfcGrid
 SUBTYPE OF (IfcProduct);
	UAxes : LIST [1:?] OF IfcGridAxis;
	VAxes : LIST [1:?] OF IfcGridAxis;
	WAxes : OPTIONAL LIST [1:?] OF IfcGridAxis;
	PredefinedType : OPTIONAL IfcGridTypeEnum;
 INVERSE
	ContainedInStructure : SET [0:1] OF IfcRelContainedInSpatialStructure FOR RelatedElements;
 WHERE
	HasPlacement : EXISTS(SELF\IfcProduct.ObjectPlacement);
END_ENTITY;

ENTITY IfcOpeningElement
 SUPERTYPE OF (ONEOF
    (IfcOpeningStandardCase))
 SUBTYPE OF (IfcFeatureElementSubtraction);
	PredefinedType : OPTIONAL IfcOpeningElementTypeEnum;
 INVERSE
	HasFillings : SET [0:?] OF IfcRelFillsElement FOR RelatingOpeningElement;
END_ENTITY;

ENTITY IfcOpeningStandardCase
 SUBTYPE OF (IfcOpeningElement);
END_ENTITY;

ENTITY IfcPort
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcDistributionPort))
 SUBTYPE OF (IfcProduct);
 INVERSE
	ContainedIn : SET [0:1] OF IfcRelConnectsPortToElement FOR RelatingPort;
	ConnectedFrom : SET [0:1] OF IfcRelConnectsPorts FOR RelatedPort;
	ConnectedTo : SET [0:1] OF IfcRelConnectsPorts FOR RelatingPort;
END_ENTITY;

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

ENTITY IfcRelAssociatesMaterial
 SUBTYPE OF (IfcRelAssociates);
	RelatingMaterial : IfcMaterialSelect;
 WHERE
	NoVoidElement : SIZEOF(QUERY(temp <* SELF\IfcRelAssociates.RelatedObjects | 
  ('IFCPRODUCTEXTENSION.IFCFEATUREELEMENTSUBTRACTION' IN TYPEOF(temp)) OR 
  ('IFCPRODUCTEXTENSION.IFCVIRTUALELEMENT' IN TYPEOF(temp)) 
)) = 0;
	AllowedElements : SIZEOF(QUERY(temp <* SELF\IfcRelAssociates.RelatedObjects | (
  SIZEOF(TYPEOF(temp) * [   
    'IFCPRODUCTEXTENSION.IFCELEMENT', 
    'IFCPRODUCTEXTENSION.IFCELEMENTTYPE',
    'IFCSHAREDBLDGELEMENTS.IFCWINDOWSTYLE',
    'IFCSHAREDBLDGELEMENTS.IFCDOORSTYLE',
    'IFCSTRUCTURALANALYSISDOMAIN.IFCSTRUCTURALMEMBER',
    'IFCPRODUCTEXTENSION.IFCPORT']) = 0) 
)) = 0;
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 IfcRelConnectsPortToElement
 SUBTYPE OF (IfcRelConnects);
	RelatingPort : IfcPort;
	RelatedElement : IfcDistributionElement;
END_ENTITY;

ENTITY IfcRelConnectsPorts
 SUBTYPE OF (IfcRelConnects);
	RelatingPort : IfcPort;
	RelatedPort : IfcPort;
	RealizingElement : OPTIONAL IfcElement;
 WHERE
	NoSelfReference : RelatingPort :<>: RelatedPort;
END_ENTITY;

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

ENTITY IfcRelContainedInSpatialStructure
 SUBTYPE OF (IfcRelConnects);
	RelatedElements : SET [1:?] OF IfcProduct;
	RelatingStructure : IfcSpatialElement;
 WHERE
	WR31 : SIZEOF(QUERY(temp <* RelatedElements | 'IFCPRODUCTEXTENSION.IFCSPATIALSTRUCTUREELEMENT' IN TYPEOF(temp))) = 0;
END_ENTITY;

ENTITY IfcRelFillsElement
 SUBTYPE OF (IfcRelConnects);
	RelatingOpeningElement : IfcOpeningElement;
	RelatedBuildingElement : IfcElement;
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 IfcRelProjectsElement
 SUBTYPE OF (IfcRelDecomposes);
	RelatingElement : IfcElement;
	RelatedFeatureElement : IfcFeatureElementAddition;
END_ENTITY;

ENTITY IfcRelReferencedInSpatialStructure
 SUBTYPE OF (IfcRelConnects);
	RelatedElements : SET [1:?] OF IfcProduct;
	RelatingStructure : IfcSpatialElement;
 WHERE
	AllowedRelatedElements : SIZEOF(QUERY(temp <* RelatedElements | ('IFCPRODUCTEXTENSION.IFCSPATIALSTRUCTUREELEMENT' IN TYPEOF(temp)) AND (NOT ('IFCPRODUCTEXTENSION.IFCSPACE' IN TYPEOF(temp)))
)) = 0;
END_ENTITY;

ENTITY IfcRelServicesBuildings
 SUBTYPE OF (IfcRelConnects);
	RelatingSystem : IfcSystem;
	RelatedBuildings : SET [1:?] OF IfcSpatialElement;
END_ENTITY;

ENTITY IfcRelSpaceBoundary
 SUPERTYPE OF (ONEOF
    (IfcRelSpaceBoundary1stLevel))
 SUBTYPE OF (IfcRelConnects);
	RelatingSpace : IfcSpaceBoundarySelect;
	RelatedBuildingElement : IfcElement;
	ConnectionGeometry : OPTIONAL IfcConnectionGeometry;
	PhysicalOrVirtualBoundary : IfcPhysicalOrVirtualEnum;
	InternalOrExternalBoundary : IfcInternalOrExternalEnum;
 WHERE
	CorrectPhysOrVirt : ((PhysicalOrVirtualBoundary = IfcPhysicalOrVirtualEnum.Physical) 
  AND (NOT('IFCPRODUCTEXTENSION.IFCVIRTUALELEMENT' IN TYPEOF(RelatedBuildingElement)))) 
OR 
((PhysicalOrVirtualBoundary = IfcPhysicalOrVirtualEnum.Virtual) 
  AND (('IFCPRODUCTEXTENSION.IFCVIRTUALELEMENT' IN TYPEOF(RelatedBuildingElement)) 
  OR   ('IFCPRODUCTEXTENSION.IFCOPENINGELEMENT' IN TYPEOF(RelatedBuildingElement)))) 
OR 
(PhysicalOrVirtualBoundary = IfcPhysicalOrVirtualEnum.NotDefined);
END_ENTITY;

ENTITY IfcRelSpaceBoundary1stLevel
 SUPERTYPE OF (ONEOF
    (IfcRelSpaceBoundary2ndLevel))
 SUBTYPE OF (IfcRelSpaceBoundary);
	ParentBoundary : OPTIONAL IfcRelSpaceBoundary1stLevel;
 INVERSE
	InnerBoundaries : SET [0:?] OF IfcRelSpaceBoundary1stLevel FOR ParentBoundary;
END_ENTITY;

ENTITY IfcRelSpaceBoundary2ndLevel
 SUBTYPE OF (IfcRelSpaceBoundary1stLevel);
	CorrespondingBoundary : OPTIONAL IfcRelSpaceBoundary2ndLevel;
 INVERSE
	Corresponds : SET [0:1] OF IfcRelSpaceBoundary2ndLevel FOR CorrespondingBoundary;
END_ENTITY;

ENTITY IfcRelVoidsElement
 SUBTYPE OF (IfcRelDecomposes);
	RelatingBuildingElement : IfcElement;
	RelatedOpeningElement : IfcFeatureElementSubtraction;
END_ENTITY;

ENTITY IfcSite
 SUBTYPE OF (IfcSpatialStructureElement);
	RefLatitude : OPTIONAL IfcCompoundPlaneAngleMeasure;
	RefLongitude : OPTIONAL IfcCompoundPlaneAngleMeasure;
	RefElevation : OPTIONAL IfcLengthMeasure;
	LandTitleNumber : OPTIONAL IfcLabel;
	SiteAddress : OPTIONAL IfcPostalAddress;
END_ENTITY;

ENTITY IfcSpace
 SUBTYPE OF (IfcSpatialStructureElement);
	PredefinedType : OPTIONAL IfcSpaceTypeEnum;
	ElevationWithFlooring : OPTIONAL IfcLengthMeasure;
 INVERSE
	HasCoverings : SET [0:?] OF IfcRelCoversSpaces FOR RelatingSpace;
	BoundedBy : SET [0:?] OF IfcRelSpaceBoundary FOR RelatingSpace;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR
 (PredefinedType <> IfcSpaceTypeEnum.USERDEFINED) OR
 ((PredefinedType = IfcSpaceTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFCPRODUCTEXTENSION.IFCSPACETYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcSpaceType
 SUBTYPE OF (IfcSpatialStructureElementType);
	PredefinedType : IfcSpaceTypeEnum;
	LongName : OPTIONAL IfcLabel;
 WHERE
	CorrectPredefinedType : (PredefinedType <> IfcSpaceTypeEnum.USERDEFINED) OR 
((PredefinedType = IfcSpaceTypeEnum.USERDEFINED) AND EXISTS(SELF\IfcSpatialElementType.ElementType));
END_ENTITY;

ENTITY IfcSpatialElement
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcExternalSpatialStructureElement
    ,IfcSpatialStructureElement
    ,IfcSpatialZone))
 SUBTYPE OF (IfcProduct);
	LongName : OPTIONAL IfcLabel;
 INVERSE
	ContainsElements : SET [0:?] OF IfcRelContainedInSpatialStructure FOR RelatingStructure;
	ServicedBySystems : SET [0:?] OF IfcRelServicesBuildings FOR RelatedBuildings;
	ReferencesElements : SET [0:?] OF IfcRelReferencedInSpatialStructure FOR RelatingStructure;
END_ENTITY;

ENTITY IfcSpatialElementType
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcSpatialStructureElementType
    ,IfcSpatialZoneType))
 SUBTYPE OF (IfcTypeProduct);
	ElementType : OPTIONAL IfcLabel;
END_ENTITY;

ENTITY IfcSpatialStructureElement
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcBuilding
    ,IfcBuildingStorey
    ,IfcSite
    ,IfcSpace))
 SUBTYPE OF (IfcSpatialElement);
	CompositionType : OPTIONAL IfcElementCompositionEnum;
 WHERE
	WR41 : (HIINDEX(SELF\IfcObjectDefinition.Decomposes) = 1) 
AND
('IFCKERNEL.IFCRELAGGREGATES' IN TYPEOF(SELF\IfcObjectDefinition.Decomposes[1])) 
AND
(('IFCKERNEL.IFCPROJECT' IN TYPEOF (SELF\IfcObjectDefinition.Decomposes[1].RelatingObject)) OR
 ('IFCPRODUCTEXTENSION.IFCSPATIALSTRUCTUREELEMENT' IN TYPEOF (SELF\IfcObjectDefinition.Decomposes[1].RelatingObject))
);
END_ENTITY;

ENTITY IfcSpatialStructureElementType
 ABSTRACT SUPERTYPE OF (ONEOF
    (IfcSpaceType))
 SUBTYPE OF (IfcSpatialElementType);
END_ENTITY;

ENTITY IfcSpatialZone
 SUBTYPE OF (IfcSpatialElement);
	PredefinedType : OPTIONAL IfcSpatialZoneTypeEnum;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR
 (PredefinedType <> IfcSpatialZoneTypeEnum.USERDEFINED) OR
 ((PredefinedType = IfcSpatialZoneTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFCPRODUCTEXTENSION.IFCSPATIALZONETYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

ENTITY IfcSpatialZoneType
 SUBTYPE OF (IfcSpatialElementType);
	PredefinedType : IfcSpatialZoneTypeEnum;
	LongName : OPTIONAL IfcLabel;
 WHERE
	CorrectPredefinedType : (PredefinedType <> IfcSpatialZoneTypeEnum.USERDEFINED) OR 
((PredefinedType = IfcSpatialZoneTypeEnum.USERDEFINED) AND EXISTS(SELF\IfcSpatialElementType.ElementType));
END_ENTITY;

ENTITY IfcSystem
 SUPERTYPE OF (ONEOF
    (IfcBuildingSystem
    ,IfcDistributionSystem
    ,IfcStructuralAnalysisModel
    ,IfcZone))
 SUBTYPE OF (IfcGroup);
 INVERSE
	ServicesBuildings : SET [0:1] OF IfcRelServicesBuildings FOR RelatingSystem;
END_ENTITY;

ENTITY IfcTransportElement
 SUBTYPE OF (IfcElement);
	PredefinedType : OPTIONAL IfcTransportElementTypeEnum;
 WHERE
	CorrectPredefinedType : NOT(EXISTS(PredefinedType)) OR
 (PredefinedType <> IfcTransportElementTypeEnum.USERDEFINED) OR
 ((PredefinedType = IfcTransportElementTypeEnum.USERDEFINED) AND EXISTS (SELF\IfcObject.ObjectType));
	CorrectTypeAssigned : (SIZEOF(IsTypedBy) = 0) OR
  ('IFCPRODUCTEXTENSION.IFCTRANSPORTELEMENTTYPE' IN TYPEOF(SELF\IfcObject.IsTypedBy[1].RelatingType));
END_ENTITY;

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

ENTITY IfcVirtualElement
 SUBTYPE OF (IfcElement);
END_ENTITY;

ENTITY IfcZone
 SUBTYPE OF (IfcSystem);
	LongName : OPTIONAL IfcLabel;
 WHERE
	WR1 : (SIZEOF(SELF\IfcGroup.IsGroupedBy) = 0) OR
	(SIZEOF (QUERY (temp <* SELF\IfcGroup.IsGroupedBy[1].RelatedObjects |  
		NOT(('IFCPRODUCTEXTENSION.IFCZONE' IN TYPEOF(temp)) OR 
		('IFCPRODUCTEXTENSION.IFCSPACE' IN TYPEOF(temp)) OR
		('IFCPRODUCTEXTENSION.IFCSPATIALZONE' IN TYPEOF(temp))
	))) = 0);
END_ENTITY;

END_SCHEMA;
