Hi Florent,

This should really go to geoserver-users mailing list.
Try this:
  <AttributeMapping>
         <targetAttribute>au:admUnit</targetAttribute>
          <ClientProperty>
                    <name>xlink:href</name>
                    
<value>strConcat('urn:x-inspire:specification:gmlas:AdministrativeUnits:3.0:', 
if_then_else(isNull(inspireid),'missing', strTrim(inspireid)))</value>
          </ClientProperty>
          <ClientProperty>
                    <name>nilReason</name>
                    <value> if_then_else(isNull(inspireid), 'unknown', 
Expression.NIL)</value>
          </ClientProperty>
  </AttributeMapping>

You should either get:
<au:admUnit 
xlink:href="urn:x-inspire:specification:gmlas:AdministrativeUnits:3.0:FR2100000000">
or

<au:admUnit 
href="urn:x-inspire:specification:gmlas:AdministrativeUnits:3.0:missing" 
nilReason="unknown"/>


Cheers
Rini

From: Florent Gravin [mailto:florent.gra...@camptocamp.com]
Sent: Wednesday, 5 September 2012 5:10 PM
To: Angreani, Rini (CESRE, Kensington)
Cc: geoserver-de...@lists.sourceforge.net
Subject: Re: [Geoserver-devel] app-schema nested feature

Hi,

Yes thank you, the sourceExpression was messing things out you are right cause 
if no link is found, it won't encode the element.
Your way is better and i can get the behavior i want. The only difference i 
found is that, if the "inspireid" is not null, but doesn't refer to any linked 
feature, it will be encoded while whith the linkElement, if no link was found 
it could know it and don't encode the element.
But whatever, source data should be populated correctly and have a foreign key 
to avoid mistake anyway.

Last thing maybe you could help is about encoding attribute with ClientProperty

<ClientProperty>
      <name>nilReason</name>
      <value>if_then_else(isNull(inspireid), 'unknown', '')</value>
</ClientProperty>

i would like that if inspireid is not null, that the attribute nilReason won't 
be encoded..
The way i found below still encode attribute with nilReason=""

Thanks for your help

Cheers
On Wed, Sep 5, 2012 at 10:06 AM, 
<rini.angre...@csiro.au<mailto:rini.angre...@csiro.au>> wrote:
Hi Florent,

Try this:
                    <AttributeMapping>
                    <targetAttribute>au:admUnit</targetAttribute>
                    <ClientProperty>

                        <name>xlink:href</name>
                        
<value>strConcat('urn:x-inspire:specification:gmlas:AdministrativeUnits:3.0:', 
if_then_else(isNull(inspireid),'missing', strTrim(inspireid)))</value>
                    </ClientProperty>
                </AttributeMapping>
The one you had didn't work because it has <sourceExpression> with linkElement. 
This means the element will only be encoded if there's a match in the linked 
feature.
The element would have some content from the linked/chained feature, and 
xlink:href from the ClientProperty.
It would look like something like this:

<au:admUnit 
xlink:href="urn:x-inspire:specification:gmlas:AdministrativeUnits:3.0:FR2100000000">
    <au:AdministrativeUnit>
        .....
   </au:AdministrativeUnit>
</au:admUnit>

If you only need to encode xlink:href, then you don't need to specify 
sourceExpression.
Normally xlink:href is only used if there is no content in the element anyway.

Cheers
Rini


From: Florent Gravin 
[mailto:florent.gra...@camptocamp.com<mailto:florent.gra...@camptocamp.com>]
Sent: Tuesday, 4 September 2012 9:42 PM
To: Angreani, Rini (CESRE, Kensington)
Cc: 
geoserver-de...@lists.sourceforge.net<mailto:geoserver-de...@lists.sourceforge.net>
Subject: Re: [Geoserver-devel] app-schema nested feature

Hi Rini,

thks for reply, it was actually right that my mapping file contained errors.
now it's better, even thouh i can't figure out some behavior ...

for example, if i have a xlink:href element :
<au:admUnit 
href="urn:x-inspire:specification:gmlas:AdministrativeUnits:3.0:FR2100000000"/>

the element is added if the link is found, but hidden if no link is found
what i would like, if no link is found, is that the element is still there with 
:
<au:admUnit 
href="urn:x-inspire:specification:gmlas:AdministrativeUnits:3.0:missing"/>

my definition :
<AttributeMapping>
                    <targetAttribute>au:admUnit</targetAttribute>
                    <sourceExpression>
                        <OCQL>strTrim(admunit)</OCQL>
                        <linkElement>au:AdministrativeUnit</linkElement>
                        <linkField>FEATURE_LINK</linkField>
                    </sourceExpression>
                    <isMultiple>true</isMultiple>
                    <encodeIfEmpty>true</encodeIfEmpty>
                    <ClientProperty>
                        <name>xlink:href</name>
                        
<value>strConcat('urn:x-inspire:specification:gmlas:AdministrativeUnits:3.0:', 
if_then_else(isNull(inspireid),'missing', strTrim(inspireid)))</value>
                    </ClientProperty>
                </AttributeMapping>

On Tue, Sep 4, 2012 at 6:37 AM, Rini Angreani 
<rini.angre...@csiro.au<mailto:rini.angre...@csiro.au>> wrote:
Hi Florent,

Sorry for the late reply. I missed this one.
You are missing an <Include> tag inside <includedTypes>.
It should look like this:

<includedTypes>
        <Include>spellingOfName.xml</Include>
</includedTypes>

To make things easier, you can copy AppSchemaDataAccess.xsd into the same
directory with your mapping file and validate your mapping file against it.
The latest schema can be found here:
https://github.com/geotools/geotools/blob/master/modules/extension/app-schema/app-schema/src/test/resources/test-data/AppSchemaDataAccess.xsd

Cheers
Rini



--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/app-schema-nested-feature-tp4997275p4999582.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-devel mailing list
geoserver-de...@lists.sourceforge.net<mailto:geoserver-de...@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geoserver-devel



--
Florent Gravin
CampToCamp - Chambéry
0479444492



--
Florent Gravin
CampToCamp - Chambéry
0479444492
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to