Rollback Mechanism
Schema Management
Creating and Editing a GML Schema File
FDO XML Format
FDO feature schemas can be written to an
XML file. The FdoFeatureSchema and FdoFeatureSchemaCollection classes
support the FdoXmlSerializable interface. The sample code shows
an FdoFeatureSchema object calling the WriteXml() method to generate
an XML file containing the feature schema created by the sample
code.
FDO feature schemas can also be read from an
XML file. The FdoFeatureSchemaCollection class supports the FdoXmlDeserializable
interface. The sample code shows an FdoFeatureSchemaCollection object
calling the ReadXml() method to read a set of feature schemas into
memory from an XML file. The code shows the desired schema being
retrieved from the collection and applied to the data store.
The XML format used by FDO is a subset of the
Geography Markup Language (GML) standardized by the Open GIS Consortium
(OGC). One thing shown in the sample code is a round-trip conversion
from FDO feature schema to GML schema back to FDO feature schema.
To accomplish this round-trip, the ReadXml() method supports a superset
of the GML that is written by the WriteXml() method.
The following table specifies the mapping of
FDO feature schema elements to GML elements and attributes. This
mapping is sufficient to understand the XML file generated from
the schema defined by the sample code. It also provides a guide
for writing a GML schema file by hand. This file can then be read
in and applied to a data store. For more information, see Example: Creating a Schema Read In from an XML
File.
Another form of round-trip translation would
be from a GML schema produced by another vendor’s tool to an FDO
feature schema, and then back to a GML schema. However, the resemblance
the of resulting GML schema to the original GML schema might vary
from only roughly equivalent to being exactly the same.
Map FDO Element to GML Schema Fragment
FDO Element |
GML Schema Fragment |
FeatureSchema
|
<xs:schema xmlns:xs=”http://www.w3.org/2001/XMLSchema”
targetNamespace=”http://<customer_url>/<FeatureSchemaName>”
xmlns:fdo=”http://fdo.osgeo.org/isd/schema”
xmlns:gml=”http://www.opengis.net/gml”
xmlns:<FeatureSchemaName>=”http://<customer_url>/<FeatureSchemaName>”
elementFormDefault=”qualified”
attributeFormDefault=”unqualified”
>
{ see <MetaData> }
{ optional xs:import element to enable schema validation
<xs:import namespace="http://fdo.osgeo.org/schema" schemaLocation="<FDO SDK Install Location>/docs/XmlSchema/FdoDocument.xsd"/>
}
{ <one xs:element and/or xs:complexType per class> }
</xs:schema>
|
ClassDefinition (with identity properties)
|
<xs:element name=”<className>”
type=”<className>Type”
abstract=”<true | false>”
substitutionGroup=”gml:_Feature”
>
<xs:key name=”<className>Key”>
<xs:selector xpath=”.//<className>”/>
<xs:field xpath=”<identityProperty1Name>”/>
<xs:field xpath=”...”/>
<xs:field xpath=”<identityProperty<n>Name>”
</xs:key>
</xs:element>
|
FeatureClass
|
<xs:element ...see ClassDefinition (with identity properties)...</xs:element>
<xs:complexType name=”<className>Type”
abstract=”<true | false>”/>
{ see FeatureClass.GeometryProperty }
>
{ see <MetaData> }
<xs:complexContent>
<xs:extension base=”{baseClass} ?
{baseClass.schema.name}:{baseClass.name} :
‘gml:AbstractFeatureType’ “
>
<xs:sequence>
{ list of properties; see DataProperty, GeometricProperty }
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
|
FeatureClass. GeometryProperty
|
<!-- these attributes belong to the xs:complexType element -->
fdo:geometryName=”<geometryPropertyName>”
fdo:geometricTypes=”<list of FdoGeometricTypes>”
fdo:geometryReadOnly=”<true | false>”
fdo:hasMeasure=”<true | false>”
fdo:hasElevation=”<true | false>”
fdo:srsName=”<spatialContextName>”/>
|
DataProperty (decimal or string)
|
<!--
minOccurs attribute generated only if value is 1
default attribute generated only if a default value exists
fdo:readOnly attribute generated only if value is true
-->
<xs:element name=”<propertyName>”
minOccurs=”{isNullable ? 0 : 1}”
default=”<defaultValue>”
fdo:readOnly=”<true | false>”
>
{ see <MetaData> }
<xs:simpleType>
{ see DataType String or DataType Decimal }
</xs:simpleType>
</xs:element>
|
DataProperty (other type)
|
<xs:element name=”<propertyName>”
type=”<datatype>”
minOccurs=”{isNullable ? 0 : 1}”
default=”<defaultValue>”
fdo:readOnly=”<true | false>”
>
{ see <MetaData> }
</xs:element>
|
DataType String
|
<xs:restriction base=”xs:string”>
<xs:maxLength value=”<length>”/>
</xs:restriction>
|
DataType Decimal
|
<xs:restriction base=”xs:decimal”>
<xs:totalDigits value=”<precision>”/>
<xs:fractionDigits value=”<scale>”/>
</xs:restriction>
|
GeometricProperty (not a defining FeatureClass GeometryProperty)
|
<xs:element name=”<propertyName>”
type=”gml:AbstractGeometryType”
fdo:geometryName=”<propertyName>”
fdo:geometricTypes=”<list of FdoGeometricTypes>”
fdo:geometryReadOnly=”<true | false>”
fdo:hasMeasure=”<true | false>”
fdo:hasElevation=”<true | false>”
fdo:srsName=”<spatialContextName>”/>
>
{ see <MetaData> }
</xs:element>
|
MetaData
|
<!-- the pattern referenced in the xs:schema element for FeatureSchema-->
<xs:annotation>
<xs:documentation>{description arg to static FdoFeatureSchema::Create()}</xs:documentation>
</xs:annotation>
<!-- the pattern referenced in the xs:element element for DataProperty -->
<xs:annotation>
<xs:documentation>{description arg to static FdoDataPropertyDefinition::Create()}</xs:documentation>
</xs:annotation>
<!--
the pattern referenced in the xs:element element for a non-feature-defining
GeometricProperty
-->
<xs:annotation>
<xs:documentation>{description arg to static FdoGeometricPropertyDefinition::Create()}</xs:documentation>
</xs:annotation>
<!-- the pattern referenced in the xs:complexType element for FeatureClass -->
<xs:annotation>
<xs:documentation>{description arg to static FdoFeatureClass::Create()}</xs:documentation>
<xs:appinfo source=”<uri>”/>
<xs:documentation>{description arg to static FdoGeometricPropertyDefinition::Create()}</xs:documentation>
</xs:annotation>
|
Map FDO Datatype to GML Type
FDO Datatype |
GML Type |
Boolean
|
xs:boolean
|
Byte
|
fdo:Byte
|
DateTime
|
xs:dateTime
|
Double
|
xs:double
|
Int16
|
fdo:Int16
|
Int32
|
fdo:Int32
|
Int64
|
fdo:Int64
|
Single
|
xs:float
|
BLOB
|
xs:base64Binary
|
CLOB
|
xs:string
|