(*
 $Id$
 ISO TC184/SC4/WG12 N2573 - ISO/TS 10303-1144 Building item - EXPRESS MIM
 Supersedes ISO TC184/SC4/WG12 N1782
*)

SCHEMA Building_item_mim;

USE FROM Building_component_mim; -- ISO 10303-1143

USE FROM Building_structure_mim; -- ISO 10303-1145

USE FROM Product_view_definition_mim; -- ISO 10303-1019

ENTITY building_element
   SUBTYPE OF (product_definition);
WHERE
   WR1: SIZEOF (QUERY (pdr <* USEDIN(SELF, 'BUILDING_ITEM_MIM.' +
	'PRODUCT_DEFINITION_RELATIONSHIP.RELATED_PRODUCT_DEFINITION') |
	(('BUILDING_ITEM_MIM.BUILDING_SECTION' IN TYPEOF (pdr.relating_product_definition)) OR 
	('BUILDING_ITEM_MIM.SPACE_ELEMENT' IN TYPEOF (pdr.relating_product_definition)))
	)) = 1;
   WR2: SIZEOF (QUERY (pd <* USEDIN (SELF, 'BUILDING_ITEM_MIM.'+
	'PROPERTY_DEFINITION.DEFINITION') |
	SIZEOF (QUERY (sa <* USEDIN(pd, 'BUILDING_ITEM_MIM.'+
	'SHAPE_ASPECT.OF_SHAPE') |
	(('BUILDING_ITEM_MIM.POSITIVE_COMPONENT' IN TYPEOF (sa))
	AND
	(sa.description = 'main'))
	)) = 1
   )) = 1;
END_ENTITY;

ENTITY fixture_equipment_element
   SUBTYPE OF (product_definition);
WHERE
   WR1: SIZEOF (QUERY (pdr <* USEDIN(SELF, 'BUILDING_ITEM_MIM.' +
	'PRODUCT_DEFINITION_RELATIONSHIP.RELATED_PRODUCT_DEFINITION') |
	(('BUILDING_ITEM_MIM.BUILDING_SECTION' IN TYPEOF (pdr.relating_product_definition)) OR 
	('BUILDING_ITEM_MIM.SPACE_ELEMENT' IN TYPEOF (pdr.relating_product_definition)))
	)) = 1;
   WR2: SIZEOF (QUERY (pds <* QUERY (pd <* USEDIN (SELF,
	'BUILDING_ITEM_MIM.PROPERTY_DEFINITION.DEFINITION') |
	'BUILDING_ITEM_MIM.PRODUCT_DEFINITION_SHAPE' IN TYPEOF (pd)) |
	SIZEOF (QUERY (sa <* USEDIN (pds, 'BUILDING_ITEM_MIM.' +
	'SHAPE_ASPECT.OF_SHAPE') |
	('BUILDING_ITEM_MIM.POSITIVE_COMPONENT' IN TYPEOF (sa))
	AND
	(sa.description = 'main'))) = 1)) = 1;
END_ENTITY;

ENTITY service_element
   SUBTYPE OF (product_definition);
WHERE
   WR1: SIZEOF (QUERY (pdr <* USEDIN(SELF, 'BUILDING_ITEM_MIM.' +
	'PRODUCT_DEFINITION_RELATIONSHIP.RELATED_PRODUCT_DEFINITION') |
	(('BUILDING_ITEM_MIM.BUILDING_SECTION' IN TYPEOF (pdr.relating_product_definition)) OR 
	('BUILDING_ITEM_MIM.SPACE_ELEMENT' IN TYPEOF (pdr.relating_product_definition)))
	)) = 1;
   WR2: SIZEOF (QUERY (pds <* QUERY (pd <* USEDIN (SELF,
	'BUILDING_ITEM_MIM.PROPERTY_DEFINITION.DEFINITION') |
	'BUILDING_ITEM_MIM.PRODUCT_DEFINITION_SHAPE' IN
	TYPEOF (pd)) |
	SIZEOF (QUERY (sa <* USEDIN(pds, 'BUILDING_ITEM_MIM.'+
	'SHAPE_ASPECT.OF_SHAPE') |
	('BUILDING_ITEM_MIM.POSITIVE_COMPONENT' IN TYPEOF (sa))
	AND
	(sa.description = 'main'))) = 1)) = 1;
END_ENTITY;

ENTITY space_element
   SUBTYPE OF (product_definition);
WHERE
   WR1: SIZEOF (QUERY (pdr <* USEDIN (SELF, 'BUILDING_ITEM_MIM.' +
	'PRODUCT_DEFINITION_RELATIONSHIP.RELATED_PRODUCT_DEFINITION') |
	'BUILDING_ITEM_MIM.BUILDING_SECTION' IN
	TYPEOF (pdr.relating_product_definition))) = 1;
END_ENTITY;

ENTITY structure_enclosure_element
   SUBTYPE OF (product_definition);
WHERE
   WR1: SIZEOF (QUERY (pdr <* USEDIN (SELF, 'BUILDING_ITEM_MIM.' +
	'PRODUCT_DEFINITION_RELATIONSHIP.RELATED_PRODUCT_DEFINITION') |
	(('BUILDING_ITEM_MIM.BUILDING_SECTION' IN TYPEOF (pdr.relating_product_definition)) OR 
	('BUILDING_ITEM_MIM.SPACE_ELEMENT' IN TYPEOF (pdr.relating_product_definition)))
	)) = 1;
   WR2: SIZEOF (QUERY (pds <* QUERY (pd <* USEDIN (SELF,
	'BUILDING_ITEM_MIM.PROPERTY_DEFINITION.DEFINITION') |
	'BUILDING_ITEM_MIM.PRODUCT_DEFINITION_SHAPE' IN TYPEOF (pd)) |
	SIZEOF (QUERY (sa <* USEDIN (pds, 'BUILDING_ITEM_MIM.'+
	'SHAPE_ASPECT.OF_SHAPE') |
	('BUILDING_ITEM_MIM.POSITIVE_COMPONENT' IN TYPEOF (sa))
	AND
	(sa.description = 'main'))) = 1)) = 1;
END_ENTITY;

END_SCHEMA;
