app-schema nested feature

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

app-schema nested feature

Florent gravin-2
Hi,

I'm trying to configure an app-schema and get a bit lost with nested features and link parameters.
The first case i will introduce looks pretty simple, and maybe help me to figure out how does it work.

in my main mapping file, i have a feature type, <targetElement>au:AdministrativeUnit</targetElement>, mapping a postgis table.
in this feature, i have an attribute name, mapping the name field of the DB table1.

                <AttributeMapping>
                    <targetAttribute>au:name/gn:GeographicalName/gn:spelling/gn:SpellingOfName/gn:text</targetAttribute>
                    <sourceExpression>
                        <OCQL>name</OCQL>
                    </sourceExpression>
                </AttributeMapping>

this gives me :

<au:name>
  <gn:GeographicalName>
    <gn:spelling>
      <gn:SpellingOfName>
        <gn:text>FR2100000000</gn:text>
      </gn:SpellingOfName>
    </gn:spelling>
  </gn:GeographicalName>
</au:name>

but actually, i have another postgis table2 that contains
id                        |       text
FR2100000000     |    Paris

and what i would like to have is

<au:name>
  <gn:GeographicalName>
    <gn:spelling>
      <gn:SpellingOfName>
        <gn:text>Paris</gn:text>
      </gn:SpellingOfName>
    </gn:spelling>
  </gn:GeographicalName>
</au:name>

so what i did is another mapping file, for a non feature type, but needed datas, to configure au:name

here my spellingOfName.xml mapping file :

<targetElement>au:name</targetElement>
            <groupBy />
            <attributeMappings>
                <AttributeMapping>
                    <targetAttribute>au:name</targetAttribute>
                    <sourceExpression>
                        <OCQL>getID()</OCQL>
                    </sourceExpression>
                </AttributeMapping>
            </attributeMappings>
            <attributeMappings>
                <AttributeMapping>
                    <targetAttribute>FEATURE_LINK</targetAttribute>
                    <sourceExpression>
                        <OCQL>id</OCQL>
                    </sourceExpression>
                </AttributeMapping>
            </attributeMappings>
            <attributeMappings>
                <AttributeMapping>
                    <targetAttribute>au:name/gn:GeographicalName/gn:spelling/gn:SpellingOfName/gn:text</targetAttribute>
                    <sourceExpression>
                        <OCQL>text</OCQL>
                    </sourceExpression>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>

then, in my root mapping file i added
    <includedTypes>spellingOfName.xml</includedTypes>

and i tried to link with (replacing uppon au:name definition) :

<AttributeMapping>
                    <targetAttribute>au:AdministrativeUnit</targetAttribute>
                    <sourceExpression>
                        <OCQL>getID()</OCQL>
                        <linkElement>au:name</linkElement>
                        <linkField>FEATURE_lINK</linkField>
                    </sourceExpression>
                </AttributeMapping>


(au:AdministrativeUnit is the parent element of au:name)

the last definition is what i would like to discuss about ... cause i admit to be quite lost with the use of the linkElement and linkField tags...

if anyone could spend time on this case, and discuss a bit about the linking process of app-schema, i would really appreciate.

the funny thing is that if i remove the <includedTypes>spellingOfName.xml</includedTypes>, it doesn't give anyerror and give the same result : no tag au:name in my response.

thanks


--
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
Reply | Threaded
Open this post in threaded view
|

Re: app-schema nested feature

Rini Angreani
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
Reply | Threaded
Open this post in threaded view
|

Re: app-schema nested feature

Florent gravin-2
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 <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel



--
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
Reply | Threaded
Open this post in threaded view
|

Re: app-schema nested feature

Rini Angreani

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:[hidden email]]
Sent: Tuesday, 4 September 2012 9:42 PM
To: Angreani, Rini (CESRE, Kensington)
Cc: [hidden email]
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 <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel




--
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
Reply | Threaded
Open this post in threaded view
|

Re: app-schema nested feature

Florent gravin-2
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, <[hidden email]> 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:[hidden email]]
Sent: Tuesday, 4 September 2012 9:42 PM
To: Angreani, Rini (CESRE, Kensington)
Cc: [hidden email]
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 <[hidden email]> 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
[hidden email]
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel