<?xml version="1.0" encoding="UTF-8"?>
<!-- CityGML Profil der AdV, LoD 2, Version 11.10.2014-->
<!-- Editor: Ulrich Gruber, Kreis Recklinghausen, Kurt-Schumacher-Allee 1,  45657 Recklinghausen -->
<!-- Weitere Informationen unter www.adv-online.de -->
<xs:schema xmlns="http://www.opengis.net/citygml/building/1.0" xmlns:core="http://www.opengis.net/citygml/1.0"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml"
    targetNamespace="http://www.opengis.net/citygml/building/1.0" elementFormDefault="qualified"
    attributeFormDefault="unqualified">
  	<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd" /> 
	<xs:import namespace="http://www.opengis.net/citygml/1.0" schemaLocation="http://repository.gdi-de.org/schemas/adv/citygml/1.0/cityGMLBaseLoD2.xsd"/>
    <!-- ========================================================================================= -->
    <!-- ===================================CityGML Building module ================================== -->
    <!-- ========================================================================================= -->
    <xs:complexType name="AbstractBuildingType" abstract="true">
        <xs:annotation>
            <xs:documentation>Type describing the thematic and geometric attributes and the associations of buildings. It is an
                abstract type, only its subclasses Building and BuildingPart can be instantiated. An _AbstractBuilding may consist
                of BuildingParts, which are again _AbstractBuildings by inheritance. Thus an aggregation hierarchy between
                _AbstractBuildings of arbitrary depth may be specified. In such an hierarchy, top elements are Buildings, while
                all other elements are BuildingParts. Each element of such a hierarchy may have all attributes and geometries of
                _AbstractBuildings. It must, however, be assured than no inconsistencies occur (for example, if the geometry of a
                Building does not correspond to the geometries of its parts, or if the roof type of a Building is saddle roof,
                while its parts have an hip roof). As subclass of _CityObject, an _AbstractBuilding inherits all attributes and
                relations, in particular an id, names, external references, and generalization relations. </xs:documentation>
        </xs:annotation>
        <xs:complexContent>
            <xs:extension base="core:AbstractSiteType">
                <xs:sequence>
                    <xs:annotation>
                        <xs:documentation> The name will be represented by gml:name (inherited from _GML) . list order for
                            storeyHeightsAboveground: first floor, second floor,... list order for storeyHeightsBelowground: first
                            floor below ground, second floor below ground,... The lodXMultiSurface must be used, if the geometry
                            of a building is just a collection of surfaces bounding a solid, but not a topologically clean solid
                            boundary necessary for GML3 solid boundaries. </xs:documentation>
                    </xs:annotation>
                    <xs:element name="function" type="BuildingFunctionType" minOccurs="0"/>
                    <xs:element name="roofType" type="RoofTypeType" minOccurs="0"/>
                    <xs:element name="measuredHeight" type="gml:LengthType" minOccurs="0"/>
                    <xs:element name="storeysAboveGround" type="xs:nonNegativeInteger" minOccurs="0"/>
                    <xs:element name="storeysBelowGround" type="xs:nonNegativeInteger" minOccurs="0"/>
                    <xs:element name="lod2Solid" type="gml:SolidPropertyType" minOccurs="0"/>
                    <xs:element name="lod2TerrainIntersection" type="gml:MultiCurvePropertyType" minOccurs="0"/>
                    <xs:element name="outerBuildingInstallation" type="BuildingInstallationPropertyType" minOccurs="0"
                        maxOccurs="unbounded"/>
                    <xs:element name="boundedBy" type="BoundarySurfacePropertyType" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element name="consistsOfBuildingPart" type="BuildingPartPropertyType" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element name="address" type="core:AddressPropertyType" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element ref="_GenericApplicationPropertyOfAbstractBuilding" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- ========================================================================================= -->
    <xs:element name="_AbstractBuilding" type="AbstractBuildingType" abstract="true" substitutionGroup="core:_Site"/>
    <!-- ========================================================================================= -->
    <xs:element name="_GenericApplicationPropertyOfAbstractBuilding" type="xs:anyType" abstract="true"/>
    <!-- ========================================================================================= -->
    <xs:simpleType name="BuildingFunctionType">
        <xs:annotation>
            <xs:documentation> Intended function of a building. The values of this type are defined in the XML file
                BuildingFunctionType.xml, according to the dictionary concept of GML3. The values may be adopted from ALKIS, the
                german standard for cadastre modelling. If the cadastre models from other countries differ in the building
                functions, these values may be compiled in another codelist to be used with CityGML. </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string"/>
    </xs:simpleType>
    <!-- ========================================================================================= -->
    <xs:simpleType name="RoofTypeType">
        <xs:annotation>
            <xs:documentation>Roof Types. The values of this type are defined in the XML file RoofTypeType.xml, according to the
                dictionary concept of GML3.</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string"/>
    </xs:simpleType>
    <!-- ========================================================================================= -->
    <xs:complexType name="BuildingType">
        <xs:complexContent>
            <xs:extension base="AbstractBuildingType">
                <xs:sequence>
                    <xs:element ref="_GenericApplicationPropertyOfBuilding" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- ========================================================================================= -->
    <xs:element name="Building" type="BuildingType" substitutionGroup="_AbstractBuilding"/>
    <!-- ========================================================================================= -->
    <xs:element name="_GenericApplicationPropertyOfBuilding" type="xs:anyType" abstract="true"/>
    <!-- ========================================================================================= -->
    <xs:complexType name="BuildingPartType">
        <xs:complexContent>
            <xs:extension base="AbstractBuildingType">
                <xs:sequence>
                    <xs:element ref="_GenericApplicationPropertyOfBuildingPart" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- ========================================================================================= -->
    <xs:element name="BuildingPart" type="BuildingPartType" substitutionGroup="_AbstractBuilding"/>
    <!-- ========================================================================================= -->
    <xs:element name="_GenericApplicationPropertyOfBuildingPart" type="xs:anyType" abstract="true"/>
    <!-- ========================================================================================= -->
    <xs:complexType name="BuildingPartPropertyType">
        <xs:annotation>
            <xs:documentation>Denotes the relation of an _AbstractBuilding to its building parts. The BuildingPartPropertyType
                element must either carry a reference to a BuildingPart object or contain a BuildingPart object inline, but
                neither both nor none.</xs:documentation>
        </xs:annotation>
        <xs:complexContent>
            <xs:restriction base="gml:AssociationType">
                <xs:sequence minOccurs="0">
                    <xs:element ref="BuildingPart"/>
                </xs:sequence>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>
    <!-- ========================================================================================= -->
    <xs:complexType name="BuildingInstallationType">
        <xs:annotation>
            <xs:documentation>A BuildingInstallation is a part of a Building which has not the significance of a BuildingPart.
                Examples are stairs, antennas, balconies or small roofs. As subclass of _CityObject, a BuildingInstallation
                inherits all attributes and relations, in particular an id, names, external references, and generalization
                relations. </xs:documentation>
        </xs:annotation>
        <xs:complexContent>
            <xs:extension base="core:AbstractCityObjectType">
                <xs:sequence>
                    <xs:element name="function" type="BuildingInstallationFunctionType" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element name="lod2Geometry" type="gml:GeometryPropertyType" minOccurs="0"/>
                    <xs:element ref="_GenericApplicationPropertyOfBuildingInstallation" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- ========================================================================================= -->
    <xs:element name="BuildingInstallation" type="BuildingInstallationType" substitutionGroup="core:_CityObject"/>
    <!-- ========================================================================================= -->
    <xs:element name="_GenericApplicationPropertyOfBuildingInstallation" type="xs:anyType" abstract="true"/>
    <!-- ========================================================================================= -->
    <xs:simpleType name="BuildingInstallationFunctionType">
        <xs:annotation>
            <xs:documentation>Function of a building installation. The values of this type are defined in the XML file
                BuildingInstallationFunctionType.xml, according to the dictionary concept of GML3. </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string"/>
    </xs:simpleType>
    <!-- ========================================================================================= -->
    <xs:complexType name="BuildingInstallationPropertyType">
        <xs:annotation>
            <xs:documentation>Denotes the relation of an _AbstractBuilding to its building installations. The
                BuildingInstallationPropertyType element must either carry a reference to a BuildingInstallation object or contain
                a BuildingInstallation object inline, but neither both nor none. </xs:documentation>
        </xs:annotation>
        <xs:complexContent>
            <xs:restriction base="gml:AssociationType">
                <xs:sequence minOccurs="0">
                    <xs:element ref="BuildingInstallation"/>
                </xs:sequence>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>
    <!-- ========================================================================================= -->
    <!-- ========================SURFACES OF BUILDINGS AND ROOMS( LOD2 to LOD4)====================-->
    <!-- ========================================================================================= -->
    <xs:complexType name="AbstractBoundarySurfaceType" abstract="true">
        <xs:annotation>
            <xs:documentation>A BoundarySurface is a thematic object which classifies surfaces bounding a building or a room. The
                geometry of a BoundarySurface is given by MultiSurfaces. As it is a subclass of _CityObject, it inherits all
                atributes and relations, in particular the external references, and the generalization relations.
            </xs:documentation>
        </xs:annotation>
        <xs:complexContent>
            <xs:extension base="core:AbstractCityObjectType">
                <xs:sequence>
                    <xs:element name="lod2MultiSurface" type="gml:MultiSurfacePropertyType" minOccurs="0"/>
                    <xs:element ref="_GenericApplicationPropertyOfBoundarySurface" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- ========================================================================================== -->
    <xs:element name="_BoundarySurface" type="AbstractBoundarySurfaceType" abstract="true" substitutionGroup="core:_CityObject"/>
    <!-- ========================================================================================== -->
    <xs:element name="_GenericApplicationPropertyOfBoundarySurface" type="xs:anyType" abstract="true"/>
    <!-- ========================================================================================== -->
    <xs:complexType name="RoofSurfaceType">
        <xs:complexContent>
            <xs:extension base="AbstractBoundarySurfaceType">
                <xs:sequence>
                    <xs:element ref="_GenericApplicationPropertyOfRoofSurface" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- ========================================================================================== -->
    <xs:element name="RoofSurface" type="RoofSurfaceType" substitutionGroup="_BoundarySurface"/>
    <!-- ========================================================================================== -->
    <xs:element name="_GenericApplicationPropertyOfRoofSurface" type="xs:anyType" abstract="true"/>
    <!-- ========================================================================================== -->
    <xs:complexType name="WallSurfaceType">
        <xs:complexContent>
            <xs:extension base="AbstractBoundarySurfaceType">
                <xs:sequence>
                    <xs:element ref="_GenericApplicationPropertyOfWallSurface" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- ========================================================================================= -->
    <xs:element name="WallSurface" type="WallSurfaceType" substitutionGroup="_BoundarySurface"/>
    <!-- ========================================================================================= -->
    <xs:element name="_GenericApplicationPropertyOfWallSurface" type="xs:anyType" abstract="true"/>
    <!-- ========================================================================================= -->
    <xs:complexType name="GroundSurfaceType">
        <xs:complexContent>
            <xs:extension base="AbstractBoundarySurfaceType">
                <xs:sequence>
                    <xs:element ref="_GenericApplicationPropertyOfGroundSurface" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- ========================================================================================= -->
    <xs:element name="GroundSurface" type="GroundSurfaceType" substitutionGroup="_BoundarySurface"/>
    <!-- ========================================================================================= -->
    <xs:element name="_GenericApplicationPropertyOfGroundSurface" type="xs:anyType" abstract="true"/>
    <!-- ========================================================================================= -->
    <xs:complexType name="ClosureSurfaceType">
        <xs:complexContent>
            <xs:extension base="AbstractBoundarySurfaceType">
                <xs:sequence>
                    <xs:element ref="_GenericApplicationPropertyOfClosureSurface" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <!-- ========================================================================================= -->
    <xs:element name="ClosureSurface" type="ClosureSurfaceType" substitutionGroup="_BoundarySurface"/>
    <!-- ========================================================================================= -->
    <xs:element name="_GenericApplicationPropertyOfClosureSurface" type="xs:anyType" abstract="true"/>
    <!-- ========================================================================================= -->
    <!-- =============================Relation of Buildings to its bounding Surfaces================== -->
    <!-- ========================================================================================= -->
    <xs:complexType name="BoundarySurfacePropertyType">
        <xs:annotation>
            <xs:documentation>Denotes the relation of an _AbstractBuilding to its bounding thematic surfaces (walls, roofs, ..).
                The BoundarySurfacePropertyType element must either carry a reference to a _BoundarySurface object or contain a
                _BoundarySurface object inline, but neither both nor none. There is no differentiation between interior surfaces
                bounding rooms and outer ones bounding buildings (one reason is, that ClosureSurfaces belong to both types). It
                has to be made sure by additional integrity constraints that, e.g. an _AbstractBuilding is not related to
                CeilingSurfaces or a room not to RoofSurfaces. </xs:documentation>
        </xs:annotation>
        <xs:complexContent>
            <xs:restriction base="gml:AssociationType">
                <xs:sequence minOccurs="0">
                    <xs:element ref="_BoundarySurface"/>
                </xs:sequence>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>
</xs:schema>
