FME Version
Service Configuration
Please see the CSW Metadata example for more information regarding the setup & configuration of a deegree csw service.
CSW GetRecords Queries
The attached query demo workspace demonstrates how FME can be used to perform a 'PropertyIsLike', and a 'BBOX' query. Each query is constructed, executed, processed to create a single FME feature per metadata record. Where possible, the bounding box of each metadata record is converted into a FME polygon geometry on the feature.The general form of a GetRecords request looks like this:
<GetRecords> <Query typeNames="csw:Record"> <Constraint version="1.1.0"> <ogc:Filter> </ogc:Filter> </Constraint> </Query> </GetRecords>
Each GetRecords query requires a single filter element that can contain a potentially complex filter expression. Potential filter operations include: PropertyIsEqualTo, PropertyIsNotEqualTo, PropertyIsLessThan, PropertyIsGreaterThan, PropertyIsLessThanOrEqualTo, PropertyIsGreaterThanOrEqualTo, PropertyIsLike, and BBOX. Additionally logical operators such as And, Or, and Not are also supported.
This workspace contains two custom transformers (see workspace attachment above) that can generate the XML corresponding to PropertyIsLike, and BBOX filter operators.
PropertyIsLike Filter Operator
The PropertyIsLike operator performs a wildcard match on a specified property. The following parameters can be specified:
- PropertyName: The name of the property
- Literal: The string to match against property values.
- wildChar: A character that is interpreted as 'match multiple' within the match string.
- singleChar: Similar to wildCard, but matches a single character only.
- escapeChar: The character used to escape the wildChar or singleChar if they occur within the match string for purposes other than matching.
The following is the XML representation of a PropertyIsLike operation
<ogc:PropertyIsLike wildCard="%" singleChar="_" escapeChar="\"> <ogc:PropertyName>AnyText</ogc:PropertyName> <ogc:Literal>%YourLiteral%</ogc:Literal> </ogc:PropertyIsLike>
BBOX Filter Operator
The BBOX operator perfroms a spatial bounding box match on records whose bounding box is enclosed by the specified bounding box.The following is the XML representation of a BBOX operation
<ogc:BBOX> <ogc:PropertyName>apiso:BoundingBox</ogc:PropertyName> <gml:Box> <gml:coordinates>1,0 19,56</gml:coordinates> </gml:Box> </ogc:BBOX>
Workspace Overview
The attached query demo workspace demonstrates how FME can be used to perform a 'PropertyIsLike', and a 'BBOX' query. Each query is constructed, executed, processed to create a single FME feature per metadata record. Where possible, the bounding box of each metadata record is converted into a FME polygon geometry on the feature.
The first query requests all records by using a '%' wildcard on the 'apiso:identifier' property. The bounding boxes of the return records are accumulated, resulting in a single bounding box that corresponds to the bounds of the entire area of query results. This bounding box is then used as the parameter for a bounding box query.
As one would expect, in this particular case the resulting records are identical.
The workspace has been broken in to several component custom transformers(LINK_TODO) to make it easier to understand the workflow & facilitiate reuse.
Note: This workspace implements a small subset of the CSW GetRecord query options, and only extracts a subset of the resulting metadata. As we dig through the details of how the workspace functions, it should become obvious how it could be easily extended as neccesary.
Custom Transformers
CSWPropertyIsLikeFilterOpCreator
This transformer generates the XML for a PropertyIsLike filter operation, and places the result in the specified feature attribute. In addition to the property name, and matching string, the wildcard, singlechar, and escapechar can also be specified. The name of a destination attribute must be specified.
Implementation
The transformer uses a PythonCaller to generate the XML fragment based on the specified parameters.
CSWBBOXFilterOpCreator
This transformer generates the XML for a BBOX filter operation, and places the result in the specified feature attribute. Other than the name of a destination attribute, there are no parameters; the transformer will use the calculated bounding box of the input feature.
Implementation
The transformer uses BoundsExtractor to calculate the input feature's bounding box, and generates the XML fragment using a PythonCaller.
CSWGetRecordsRequestor
This transformer builds the GetRecords request, and then creates features containing each metadata record,
Implementation
MetadataBoundsExtractor
Extracts the geographic extent from the metadata record, and creates a corresponding polygon geometry on the feature.
Implementation
MetadataFIDExtractor
Extracts the id from the metadata and creates a corresponding fme attribute.
Implementation
MetadataCRSExtractor
Extracts the coordinate system from the metadata, and attempts to set the coordinate system on the feature.
Note: This will only work if the metadata record and FME use the same CRS naming convention.
Implementation
MetadataTitleExtractor
Extracts the title property from the metadata and creates a corresponding fme attribute.
Comments
0 comments
Please sign in to leave a comment.