[Geoserver-users] Recode vocabulary function (app schema mapping)

Hi to all

I am trying to use the function Recode (also tried with Vocab and a file) for translation of terms on app-schema mapping

In the documentation http://docs.geoserver.org/latest/en/user/data/app-schema/cql-functions.html we have the following example:

<OCQL>Recode(ABBREVIATION, '1GRAV', 'urn:cgi:classifier:CGI:SimpleLithology:2008:gravel',
            '6ALLU', 'urn:cgi:classifier:CGI:SimpleLithology:2008:sediment')
 </OCQL>

I tried to run an example but with white spaces on a , something like this:


xlink:href
Recode(attribute,‘Organic Carbon’,‘http://registry.it.csiro.au/sandbox/soil-data-ie/def/property/soOrganicCarbon

But it doest work, I was wondering if it caused by whitespaces in ‘Organic Carbon’ since it is not an acronym

Thank you and happy seasons
Jorge de Jesus

Running server
OS: Linux 14.0.4
Geoserver: 2.7.4
Geotools: 13.4

···
-- 
ISRIC - World Soil Information 
Post: PO box 353, 6700 AJ, Wageningen,
The Netherlands Visiting Address: Droevendaalsesteeg 3, 6708 PB
Wageningen (Bdg. 101), 
Office: C.013 
Office Phone: +31 (0) 317 4 83715
Mobile Phone: +31 (0) 613 9 06950
Skype: jorge.de.jesus (Jorge Samuel Mendes de Jesus) 
OpenPGPKey: 0xA3D0065A

Jorge,

you have a missing closing ")" just before </value> in <ClientProperty>.

The Recode function is defined by the OGC Symbology Encoding (SE) 1.1 specification and is not specific to app-schema. It is implemented here:
https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/filter/function/RecodeFunction.java

I have tested Recode in the app-schema-tutorial configuration in sourceExpression and in ClientProperty for both codeSpace and xlink:href and it worked as expected for me in each case. Each test used a space in the key. For the xlink:href test, I changed this attribute mapping in gsml_MappedFeature.xml (mapping NAME which contains a space):

<AttributeMapping>
<targetAttribute>
gsml:specification
</targetAttribute>
<ClientProperty>
<name>xlink:href</name>
<value>Recode(NAME, 'Some mudstone', 'http://example.org/')</value>
</ClientProperty>
</AttributeMapping>

The test response for gsml:MappedFeature contains as expected:

<gsml:specification xlink:href="http://example.org/&quot;/&gt;

There could be something else wrong:

- What is your data source? Are your identifiers lowercase?

- Try removing line breaks from string literals.

- Do you get any error messages in your log?

Kind regards,
Ben.

On 29/12/15 01:54, Jorge Samuel Mendes de Jesus wrote:

Hi to all

I am trying to use the function Recode (also tried with Vocab and a
file) for translation of terms on app-schema mapping

In the documentation
http://docs.geoserver.org/latest/en/user/data/app-schema/cql-functions.html
we have the following example:

<OCQL>Recode(ABBREVIATION, '1GRAV', 'urn:cgi:classifier:CGI:SimpleLithology:2008:gravel',
             '6ALLU', 'urn:cgi:classifier:CGI:SimpleLithology:2008:sediment')
  </OCQL>

I tried to run an example but with white spaces on a <ClientProperty>,
something like this:

<ClientProperty>
<name>xlink:href</name>
<value>Recode(attribute,'Organic
Carbon','http://registry.it.csiro.au/sandbox/soil-data-ie/def/property/soOrganicCarbon’</value>
<ClientProperty>

But it doest work, I was wondering if it caused by whitespaces in
'Organic Carbon' since it is not an acronym

Thank you and happy seasons
Jorge de Jesus

Running server
OS: Linux 14.0.4
Geoserver: 2.7.4
Geotools: 13.4

------------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Ben Caradoc-Davies <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/&gt;
New Zealand