[OSGeo-Discuss] Searching proper schema constructs in layered GML application schema

Krzysztof FF krzysztof.finowicki at tessel.pl
Thu Nov 12 03:21:15 PST 2009


Hi there,

I'm trying to define GML 3.2.1. based application schema for FM-related
software.

The concept is to create some intermediate base-level schema common to basic
software tools (e.g. universal XSLT processing), completed with specific
application-level schemas presenting actual application structure.

>From "GML Best Practices Guide"
(http://www.ogcnetwork.net/system/files/GML_Best_Practices_Guide.pdf) it is
advised not to use "type" attribute:

quote starts
If you wish to denote distinct semantic types such as river and road, it is
INVALID GML to use a type attribute as shown in the following examples.

Example of Invalid GML Using a Type Attribute

<app:GenericFeature gml:id = "p2" type = "Canal">
  <app:material>water</app:material>
  <app:age>90</app:age>
  <gml:centerLineOf> … </app:centerLineOf>
</app:GenericFeature>

You can "narrow" the type denoted by the feature type name element (<app:
GenericFeature>) by using qualifying properties, as shown in the following
example.

<app:GenericFeature gml:id = "p2">
  <app:type>Canal</app:type>
  <app:material>water</app:material>
  <app:age>90</app:age>
  <gml:centerLineOf> ... </app:centerLineOf>
</app:GenericFeature>
quote ends

But from the other hand, from "XML Schema W3C Recommendation"
(http://www.w3.org/TR/xmlschema-0/#abstract) it results that using abstract
types makes constructs with "type" attribute perfectly legal:

quote starts
Declaring a type as abstract simply requires the use of a type derived from
it (and identified by the xsi:type attribute) in the instance document.

<schema xmlns="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://cars.example.com/schema"
           xmlns:target="http://cars.example.com/schema">

  <complexType name="Vehicle" abstract="true"/>

  <complexType name="Car">
    <complexContent>
      <extension base="target:Vehicle"/>
    </complexContent>
  </complexType>

  <element name="transport" type="target:Vehicle"/>
</schema>

The transport element is not abstract, therefore it can appear in instance
documents. However, because its type definition is abstract, it may never
appear in an instance document without an  xsi:type attribute that refers to
a derived type. That means the following is not schema-valid:

  <transport xmlns="http://cars.example.com/schema"/>

because the transport element's type is abstract. However, the following is
schema-valid:

<transport xmlns="http://cars.example.com/schema"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:type="Car"/>

because it uses a non-abstract type that is substitutable for Vehicle. 
quote ends

It results that using Galdos recommendation with <app:type> element is
somehow artificial and naive, disallowing for application-specific
specialization of concrete GenericFeatures.

On the other hand, W3C recommended xsi:type attribute is perfectly legal,
and allows using in the same time generic schema to describe specific
features.

Of course it requires further generalization by defining generic properties
for features in base-level schema with their concrete definitions in
application-level schema.


I wonder what is opinion of GML-gurus about proper constructs for layering
of GML-application schemas.


Regards,

Krzysztof
-- 
View this message in context: http://n2.nabble.com/Searching-proper-schema-constructs-in-layered-GML-application-schema-tp3992089p3992089.html
Sent from the OSGeo Discuss mailing list archive at Nabble.com.



More information about the Discuss mailing list