Introduction GML application schemas

Copyright © 2007 Open Geospatial Consortium, Inc. All Rights Reserved. 227 EXAMPLE 6 An application wants to prohibit the use of multiple names in their feature types. This may be achieved by deriving an application-specific root feature type by restriction from gml:AbstractFeatureType that sets the maximum occurrence of the gml:name to ―1‖. An application schema may declare new elements that are assigned to a substitution group whose head is an abstract or concrete GML element. The element declared in the application schema may then appear in instance documents in place of the substitution group head and be conformant to the content model that refers to the substitution group head. Note that in order to be a valid member of a substitution group, the type of the element shall be validly derived from the type of the element which is the head of the substitution group. All abstract elements in the GML schema are only useful acting as the heads of substitution groups. EXAMPLE 7 gml:AbstractGML, gml:AbstractFeature, gml:AbstractGeometry, gml:AbstractCoverage may all serve as the head of a substitution group for elements in an application schema . An application schema may declare new elements, attributes and types in its own namespace using types it has defined to give vocabulary-specific names to their content models. EXAMPLE 8 Application-specific data types or enumerations. All GML application schemas are constructed, using the general rules of this Clause, from one or more of the GML schema components defined in Error Reference source not found. to Clause 19. GML allows the derivation of many other kinds of elements such as new units of measure, new geometry properties and new geometries. While these elements may be packaged into separate schemas they are viewed as subordinate to the schema categories of this Clause. Any GML application schema shall be of at least one of the schema types described in 21.3 through 21.11, and comply to the rules from the respective subclauses in addition to 21.2. It is thus permissible to create a GML application schema that defines Features, Coverages and Values, so long as this schema satisfies the rules of 21.2, 21.3, 21.8 and 21.9.

21.2.2 Target namespace

An application schema shall declare a target namespace. This is the namespace in which the terms for objects and properties of the vocabulary defined by the application schema live. This shall not be the GML namespace http:www.opengis.netgml3.2. It is conventional for the namespace identifier to be a URL controlled by the application schema author‘s organization. A target namespace is declared in an application schema using the targetNamespace attribute of the schema element from XML Schema. An application schema may be comprised of multiple schema documents that all declare the same target namespace. NOTE It is recommended that a top-level schema document in such a modularized application schema should directly or indirectly include the other documents to avoid the XML application processing limitations discussed in Annex J.

21.2.3 Import GML schema

A GML application schema shall import the full GML schema. It may identify GML profiles that include all of the components from GML that it directly or indirectly uses to define its vocabulary as specified in 20.5. The required import of the GML schema components may be provided indirectly via the import of another schema in the namespace of GML that includes the required GML schema documents. EXAMPLE 1 The import of gml.xsd from Annex C would satisfy any of these schema import requirements. import namespace=http:www.opengis.netgml3.2 schemaLocation=..gml.xsd 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,