Hi Andrea,
I have assigned GEOT-2570 for you to review, as you're the module maintainer.
The code I changed is:
- RecodeFunction, which originally only worked for "raster data" as the lookup
value
It's changed so it can be more generic, and can be used for vocabulary function
in app-schema mapping file.
Syntax: Recode(COLUMN_NAME, key1, value1, key2, value2,...)
eg. App-schema mapping file:
<AttributeMapping>
<targetAttribute>gml:name</targetAttribute>
<sourceExpression>
<OCQL>
Recode(ABBREVIATION, '1GRAV',
'urn:cgi:classifier:CGI:SimpleLithology:2008:gravel',
'1TILL',
'urn:cgi:classifier:CGI:SimpleLithology:2008:diamictite',
'6ALLU',
'urn:cgi:classifier:CGI:SimpleLithology:2008:sediment')
</OCQL>
</sourceExpression>
</AttributeMapping>
will map the gml:name value to
'urn:cgi:classifier:CGI:SimpleLithology:2008:gravel' if the ABBREVIATION column
value is '1GRAV'.
This removes the need for an extra lookup-table view in the database that
serves the same purpose.
It's a more primitive form of Jody's VocabFunction, which takes a URI to a
properties file that serves as the lookup table, eg.
<AttributeMapping>
<targetAttribute>gml:name</targetAttribute>
<sourceExpression>
<OCQL>
Vocab(ABBREVIATION,
'src/test/java/org/geotools/filter/test-data/minoc_lithology_mapping.properties')
</OCQL>
</sourceExpression>
</AttributeMapping>
I also put in your suggestion to make the cache in VocabFunction (in
app-schema) a WeakHashMap in the patch.
The patch is attached in the JIRA issue with test cases.
Thank you
Rini
------------------------------------------------------------------------------
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel