Hi,
Interesting use case indeed, er:MineralOccurrence is not a simple
property so it seems that App-Schema does handle it correctly.
Quick suggestion: give it a quick try with the recently introduced
syntax for SQL mappings with cardinality 0\2..N:
https://docs.geoserver.org/stable/en/user/data/app-schema/mapping-file.
html#attributes-with-cardinality-1-n
Best regards,
Nuno Oliveira
On Thu, 2018-12-13 at 02:25 +0000, Sexton Michael wrote:
> Hi
>  
> I’m following the example mapping file here to map a simple attribute
> field from another table multiple times:
>  
> https://github.com/geoserver/geoserver/blob/master/src/extension/app-
> schema/app-schema-test/src/test/resources/test-
> data/SimpleAttributeFeatureChainTest.xml
>  
> This is the mapping file:
>  
> <typeMappings>
>     <FeatureTypeMapping>
>         <sourceDataStore>datastore</sourceDataStore>
>         <sourceType>MV_ER_MINERALOCCURRENCE</sourceType>
>         <targetElement>er:MineralOccurrence</targetElement>
> 
>         <attributeMappings>
>             <AttributeMapping>
>                
> er:MineralOccurrence
>                 <idExpression>
>                     <OCQL>GML_ID</OCQL>
>                 </idExpression>
>             </AttributeMapping>
>             <AttributeMapping>
>                 <targetAttribute>gml:identifier</targetAttribute>
>                 <sourceExpression>
>                     <OCQL>IDENTIFIER</OCQL>
>                 </sourceExpression>
>                 <ClientProperty>
>                     <name>codeSpace</name>
>                     <value>IDENTIFIER_CODESPACE</value>
>                 </ClientProperty>
>             </AttributeMapping>
>             <AttributeMapping>
>                 <targetAttribute>gml:name</targetAttribute>
>                 <sourceExpression>
>                     <OCQL>NAME</OCQL>
>                 </sourceExpression>
>             </AttributeMapping>
> 
>             <AttributeMapping>
>                 <targetAttribute>er:sourceReference</targetAttribute>
>                 <sourceExpression>
>                     <OCQL>ENO</OCQL>
>                     <linkElement>SOURCEREFERENCE</linkElement>
>                     <linkField>FEATURE_LINK[2]</linkField>
>                 </sourceExpression>
>             </AttributeMapping>
> </attributeMappings>
> </FeatureTypeMapping>
> <FeatureTypeMapping>
>     <mappingName>SOURCEREFERENCE</mappingName>
>     <sourceDataStore>datastore</sourceDataStore>
>     <sourceType>MV_ER_SOURCEREFERENCE</sourceType>
>     <targetElement>er:sourceReference</targetElement>
>     <attributeMappings>
> 
>         <AttributeMapping>
>             <targetAttribute>er:sourceReference</targetAttribute>
>             <ClientProperty>
>                 <name>xlink:href</name>
>                 <value>URI</value>
>             </ClientProperty>
> 
>             <ClientProperty>
>                 <name>xlink:title</name>
>                 <value>TITLE</value>
>             </ClientProperty>
>         </AttributeMapping>
>         <AttributeMapping>
>             <targetAttribute>FEATURE_LINK[2]</targetAttribute>
>             <sourceExpression>
>                 <OCQL>ENO</OCQL>
>             </sourceExpression>
>         </AttributeMapping>
>     </attributeMappings>
> </FeatureTypeMapping>
>  
>  
> The sourceReference attribute is defined in http://schemas.earthresou
> rceml.org/2.0/mineralOccurrence.xsd as:
>  
> 
> nillable="true">
>             <annotation>
>               <appinfo>
>                 
> >gmd2:CI_Citation;
>               </appinfo>
>             </annotation>
>             <complexType>
>               <complexContent>
>                 <extension base="gml:AbstractMetadataPropertyType">
>                   <sequence/>
>                   
> ref="gml:AssociationAttributeGroup"/>
>                 </extension>
>               </complexContent>
>             </complexType>
> </element>
>  
> But I get this error:
>  
> Error occurred getting featuresjava.util.NoSuchElementException: No
> top level element found in schemas: {http://xmlns.earthresourceml.org
> /EarthResource/2.0}sourceReferenceNo top level element found in
> schemas:
> {http://xmlns.earthresourceml.org/EarthResource/2.0}sourceReference
>  
> I’ve seen this error before, when trying to map gml:metadataProperty,
> which I managed to get around using the targetAttributeNode, eg:
>  
> <mappingName>METADATA</mappingName>
> <sourceDataStore>datastore</sourceDataStore>
> <sourceType>MV_CIT_CI_CITATION</sourceType>
> <targetElement>gml:metaDataProperty</targetElement>
> <attributeMappings>
> 
>     <AttributeMapping>
>    
> gml:metaDataProperty/gml:GenericMetaData
> ibute>
>    
> mrl:LI_Source_PropertyType
>     </AttributeMapping>
>  
>  
> But in the case of er:soruceReference, there is no node to map to.
> It’s a reference intended to have xlink:href and xlink:title
> attributes. Is there a solution here?
>  
> Thanks
>  
>  
> Michael Sexton
>  
> Geoscience Australia Disclaimer: This e-mail (and files transmitted
> with it) is intended only for the person or entity to which it is
> addressed. If you are not the intended recipient, then you have
> received this e-mail by mistake and any use, dissemination,
> forwarding, printing or copying of this e-mail and its file
> attachments is prohibited. The security of emails transmitted cannot
> be guaranteed; by forwarding or replying to this email, you
> acknowledge and accept these risks.
> -------------------------------------------------------------------
> ------------------------------------------------------
> _______________________________________________
> Geoserver-users mailing list
> 
> Please make sure you read the following two resources before posting
> to this list:
> - Earning your support instead of buying it, but Ian Turton: http://w
> ww.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines: http://geoserver.org/co
> mm/userlist-guidelines.html
> 
> If you want to request a feature or an improvement, also see this: ht
> tps://github.com/geoserver/geoserver/wiki/Successfully-requesting-
> and-integrating-new-features-and-improvements-in-GeoServer
> 
> 
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
-- 
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the
experts! 
Visit http://goo.gl/it488V for more information.
==

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

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

Con riferimento alla normativa sul trattamento dei dati 
personali (Reg. UE 2016/679 - Regolamento generale sulla 
protezione dei dati “GDPR”), si precisa che ogni 
circostanza inerente alla presente email (il suo contenuto, 
gli eventuali allegati, etc.) è un dato la cui conoscenza 
è riservata al/i solo/i destinatario/i indicati dallo 
scrivente. Se il messaggio Le è giunto per errore, è 
tenuta/o a cancellarlo, ogni altra operazione è illecita. 
Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to 
which it is addressed and may contain information that 
is privileged, confidential or otherwise protected from 
disclosure. We remind that - as provided by European 
Regulation 2016/679 “GDPR” - copying, dissemination or 
use of this e-mail or the information herein by anyone 
other than the intended recipient is prohibited. If you 
have received this email by mistake, please notify 
us immediately by telephone or e-mail.
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


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

Reply via email to