Import GML schema GML application schemas

228 Copyright © 2007 Open Geospatial Consortium, Inc. All Rights Reserved. The import element specifies that the components described in the imported GML schema document are associated with the GML namespace http:www.opengis.netgml3.2. This namespace identifier shall match the target namespace specified in the schema being imported in order to ensure XML Schema validity. The path schemaLocation to the imported GML schema document shall be provided and may be to a local copy of the document, or may be a URI reference to a copy of the schema document in some remote repository. EXAMPLE 2 Examples for such repositories are http:www.iso.orgittfISO_19136_Schemas on the ISO web site or http:schemas.opengis.net on the OGC web site. NOTE According to the W3C XML Schema specification, the schemaLocation attribute is only a hint to the physical location and may be disregarded by XML parsers.

21.2.4 Object type derivation

An object type declared by a GML application schema shall not violate any XML Schema derivation restrictions imposed by a final attribute on its base GML type nor any other XML Schema rules. The content model of an object type defined by a GML application schema shall derive directly from the most specialized GML object type that may serve as the base for its content model while preserving semantic consistency and increasing type specialization.

21.2.5 Elements representing objects

A GML application schema shall declare a global element for any object type that is to serve as the root element in a GML document.

21.2.6 Property type derivation

A property type defined by a GML application schema to contain inline or reference a single GML object may be derived from gml:AssociationRoleType or may follow the pattern of this type. A property type defined by a GML application schema to contain inline a single GML object may be derived from gml:InlinePropertyType or may follow the pattern of this type. A property type defined by a GML application schema to reference a single GML object may be derived from gml:ReferenceType or may follow the pattern of this type. A property type defined by an application schema to contain a homogeneous collection of GML objects shall follow the pattern of gml:InlinePropertyType, but may change the minOccurs and maxOccurs values in the sequence element. NOTE As derivation-by-restriction of property types has created problems with commonly used XML parsers in the past, all instances of such derivations have been removed from the GML schema. It is recommended to avoid derivation-by- restriction in property types in application schemas, too.

21.2.7 Elements representing properties

Elements representing properties of GML objects may be declared as global elements in an application schema, or they may be declared locally within object content models type definitions. NOTE Elements in the content of complex types that are defined with local names in an application schema will prevent derivation by restriction in another namespace . Such complex types are appropriate for elements intended for use ―as is‖ in their own namespace, and may be declared to be final=restriction. Elements in the content of complex types defined by reference to global elements support derivation by restriction in another namespace, allowing restriction of cardinality, Copyright © 2007 Open Geospatial Consortium, Inc. All Rights Reserved. 229 andor replacement by a member of a substitution group. Such complex types designed for derivation by restriction are appropriate ―library types‖ for elements in substitution groups that cross namespaces. If the value of the property is expected to be available elsewhere, the type of the property element shall support referencing the GML object that is the value of the property see 21.2.6. If the value of the property is expected to be represented inline, the type of the property element shall support this, either by having XML Schema simple content of the appropriate simple type or by containing the GML object that is the value of the property inline see 21.2.6. If the value of the property is expected to be available either elsewhere, or represented inline, then the type of the property element shall support both methods. In this case the type for the property element shall have the gml:AssociationAttributeGroup, in which all members are optional, and the child element shall have minOccurs=0 so that in an instance document the property element may be empty if it carries an xlink see 7.2.3. If it is desired to prohibit the possibility of both xlink attributes and content, or neither, then this constraint should be recorded as a normative directive in an annotation element on the element declaration in the GML application schema. The directive may be expressed as prose, or it may be expressed using a formal notation such as Schematron.

21.3 Schemas defining Features and Feature Collections

21.3.1 Introduction

Features and feature collections are the primary view of geospatial information supported by GML, and are particularly useful in modelling real world geography or in defining message types for geographic web services. A feature models a real world object or concept, see Clause 9. Feature application schemas define geographic features and feature collections for a specific application domain or community. These GML application schemas shall obey the additional rules described in the following subclauses.

21.3.2 Import GML schema components

The application schema shall import the GML schema as described in 21.2.3. Any GML profile referenced from the application schema shall include at least the gml:AbstractFeature element and all schema components used by this element.

21.3.3 Elements representing features

All geographic features and feature collections in the application schema shall be declared as global elements in the schema, i.e. they shall be immediate child elements of the XML Schema schema element. The name of an element that instantiates a GML feature shall be its feature type, in the sense described in ISO 19109. An element representing a feature shall be either directly or indirectly in the substitution group of gml:AbstractFeature. An element representing a feature collection type shall be either directly or indirectly in the substitution group of gml:AbstractFeature and have in its content model a property element whose content model is derived by extension from gml:AbstractFeatureMemberType. In a GML application schema, an object that is an abstraction of a real world phenomenon shall be modelled as a feature. All other objects shall be modelled as a GML object that is not a feature, i.e. the element representing the