Polymorphism in application-schema
Support for polymorphism is included in Geoserver 2.0.2. Why do we need polymorphism support in app-schema? Some complex attributes are polymorphic by nature, which means they can have different types for different features.
Before polymorphism was supported, attribute types had to be specified in the mapping file, so could not vary across features. With polymorphism support, filter functions can now be used to specify conditions when determining the encoded type.
For example:
If MaterialCode is “rock”, er:material should be encoded as gsml:RockMaterial, otherwise it should be encoded as gsml:Mineral.
This can be expressed in the mapping file like this:
<AttributeMapping>
<targetAttribute>er:material</targetAttribute>
<sourceExpression>
<linkElement>
if_then_else(equalTo(MaterialCode, 'rock'), 'gsml:RockMaterial', 'gsml:Mineral')
</linkElement>
</sourceExpression>
</AttributeMapping>
Another common example is replacing null values with an xlink:href to a URI representing missing values:
<AttributeMapping>
<targetAttribute>er:startDate</targetAttribute>
<sourceExpression>
<linkElement>if_then_else(isNull(START_DATE), toXlinkHref('urn:ogc:def:nil:OGC::missing'),
'gml:TimeInstantPropertyType')
</linkElement>
</sourceExpression>
</AttributeMapping>
Read more about app-schema polymorphism support: polymorphism.
Developer notes
- GeoServer repository transition to main branch
- FOSS4G 2018 GeoServer Developers Workshop
- GeoServer at FOSS4G 2017 Boston
- REST API Code Sprint Prep
- Nov 18th Bug Stomp
- Online GeoServer Bug Stomp - July 2016 Results
- Online GeoServer Bug Stomp
- GeoServer Explorer Plugin for QGIS
- New repository and release delay
- GeoServer FOSS4G 2015 Activities