JorgeDeJesus

Untitled

Nov 2nd, 2015
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 7.51 KB | None | 0 0
  1. <!-- See link between 1  SO_Soil and  multiple soHorizon
  2. 1 SO_Soil -> *soHorizon
  3.  
  4. FileName: soil_SO_Soil.xml
  5.  
  6. OUTPUT:
  7. <wfs:member>
  8. <soil:SO_Soil gml:id="soil.so_soil.45108">
  9. <gml:description>WOSIS profile code AO 1448_P227/59</gml:description>
  10. <gml:identifier codeSpace="http://www.landcareresearch.co.nz">http://lab.scinfo.org.nz/soil-data-ie/id/isric/soil/so_soil/45108</gml:identifier>
  11. <soil:soHorizon href="77612"/>
  12. <soil:soHorizon href="77613"/>
  13. <soil:soHorizon href="77614"/>
  14. <soil:soHorizon href="77615"/>
  15. <soil:soHorizon href="77616"/>
  16. <soil:soHorizon href="77617"/>
  17. </soil:SO_Soil></wfs:member>
  18.  
  19. DATABASE:
  20. profile_id[PK],dataset,code
  21. 45108;"AfSP-1.2";"AO SOTER_P.52/57"
  22. 45108;"AfSP-1.2";"AO 1448_P120/59"
  23. 45108;"AfSP-1.2";"AO 1446_P53/57"
  24.  
  25. Then the horizon table:
  26. profile_layer_id[PK],profile_id_fk,code,upper,lower
  27. 77612;45108;"Ap";0;21
  28. 77613;45108;"E1";21;35
  29. 77614;45108;"E2";35;56
  30.  
  31. PROBLEM:
  32. If this happen:
  33. wfs:member><soil:SO_Soil gml:id="profile_layer.1"/>
  34. </wfs:member><wfs:member><soil:SO_Soil gml:id="profile_layer.2"/>
  35. </wfs:member>
  36.  
  37. Make a service tomcat7 restart, this is probably caused by some problem reading the DB
  38. -->
  39. <?xml version="1.0" encoding="UTF-8"?>
  40. <as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.geotools.org/app-schema AppSchemaDataAccess.xsd">
  41. <namespaces>
  42.         <Namespace><prefix>gml</prefix><uri>http://www.opengis.net/gml/3.2</uri></Namespace>
  43.         <Namespace><prefix>om</prefix><uri>http://www.opengis.net/om/2.0</uri></Namespace>
  44.         <Namespace><prefix>sam</prefix><uri>http://www.opengis.net/sampling/2.0</uri></Namespace>
  45.         <Namespace><prefix>sams</prefix><uri>http://www.opengis.net/samplingSpatial/2.0</uri></Namespace>
  46.         <Namespace><prefix>xlink</prefix><uri>http://www.w3.org/1999/xlink</uri></Namespace>
  47.         <Namespace><prefix>xsi</prefix><uri>http://www.w3.org/2001/XMLSchema-instance</uri></Namespace>
  48.         <Namespace><prefix>soil</prefix><uri>http://www.opengis.net/soil-data-ie/0.1</uri></Namespace>
  49. </namespaces>
  50.  
  51.     <sourceDataStores>
  52.         <DataStore>
  53.             <id>datastore</id>
  54.             <parameters>
  55.             <Parameter><name>dbtype</name><value>postgisng</value></Parameter>
  56.             <!-- REMOVED DB PARAMETERS-->
  57.        
  58.             <Parameter><name>Expose primary keys</name><value>true</value></Parameter>
  59.             </parameters>
  60.         </DataStore>
  61.     </sourceDataStores>
  62.     <targetTypes>
  63.         <FeatureType>
  64.           <schemaUri>http://schemas.opengis.net/samplingSpatial/2.0/spatialSamplingFeature.xsd</schemaUri>
  65.           <schemaUri>http://schemas.opengis.net/om/2.0/observation.xsd</schemaUri>
  66.           <schemaUri>http://schemas.opengis.net/sampling/2.0/samplingFeature.xsd</schemaUri>
  67.           <schemaUri>http://lab.scinfo.org.nz/static/schema/soil-data-ie/0.1/soil-data-ie.xsd</schemaUri>
  68.                   <schemaUri>http://schemas.opengis.net/gml/3.2.1/gml.xsd</schemaUri>
  69.         </FeatureType>
  70.     </targetTypes>
  71.     <typeMappings>
  72.         <FeatureTypeMapping>
  73.             <sourceDataStore>datastore</sourceDataStore>
  74.             <sourceType>soil</sourceType>
  75.             <targetElement>soil:SO_Soil</targetElement>
  76.             <attributeMappings>
  77.                 <AttributeMapping>
  78.                     <targetAttribute>soil:SO_Soil</targetAttribute>
  79.                     <idExpression> 
  80.                        <!--this works-->
  81.                        <!--<OCQL>strConCat('so_' , profile_code)</OCQL>-->
  82.                     <OCQL>strConCat('soil.so_soil.' , profile_id)</OCQL>
  83.                     </idExpression>
  84.                 </AttributeMapping>
  85.                 <AttributeMapping>
  86.                     <targetAttribute>gml:identifier</targetAttribute>
  87.                     <sourceExpression>
  88.                         <OCQL>strConCat('http://lab.scinfo.org.nz/soil-data-ie/id/isric/soil/so_soil/',profile_id)</OCQL>
  89.                     </sourceExpression>
  90.                     <ClientProperty>
  91.                             <name>codeSpace</name>
  92.                             <value>'http://www.landcareresearch.co.nz'</value>
  93.                         </ClientProperty>
  94.                 </AttributeMapping>
  95.  
  96.                   <AttributeMapping>
  97.                                         <targetAttribute>gml:description</targetAttribute>
  98.                                         <sourceExpression>
  99.                                                 <OCQL>strConCat('WOSIS profile code ',profile_code)</OCQL>
  100.                                         </sourceExpression>
  101.                                 </AttributeMapping>
  102.  
  103.                      <AttributeMapping>
  104.                     <encodeIfEmpty>true</encodeIfEmpty>
  105.                                         <targetAttribute>soil:soRelatedSamplingFeature</targetAttribute>
  106.                                      
  107.                                 </AttributeMapping>
  108.                 <AttributeMapping>
  109.                                     <encodeIfEmpty>true</encodeIfEmpty>
  110.                                     <targetAttribute>soil:soClassifier</targetAttribute>
  111.  
  112.  
  113.                                 </AttributeMapping>
  114.                
  115.                 <AttributeMapping>
  116.                                     <encodeIfEmpty>true</encodeIfEmpty>
  117.                                     <targetAttribute>soil:soAvailableWaterCapacity</targetAttribute>
  118.                 </AttributeMapping>
  119.  
  120.                 <AttributeMapping>
  121.                                     <encodeIfEmpty>true</encodeIfEmpty>
  122.                                     <targetAttribute>soil:soDrainage</targetAttribute>
  123.                                 </AttributeMapping>
  124.  
  125.                 <AttributeMapping>
  126.                                     <encodeIfEmpty>true</encodeIfEmpty>
  127.                                     <targetAttribute>soil:soDepthToRock</targetAttribute>
  128.                                 </AttributeMapping>
  129.            
  130.  
  131.                     <AttributeMapping>
  132.                         <targetAttribute>soil:soHorizon</targetAttribute>
  133.                 <encodeIfEmpty>true</encodeIfEmpty>
  134.                             <sourceExpression>
  135.                     <!--PK in soil table-->
  136.                                     <OCQL>profile_id</OCQL>
  137.                                         <linkElement>_sohorizon</linkElement>
  138.                                         <linkField>FEATURE_LINK</linkField>
  139.                                   </sourceExpression>
  140.                                    <isMultiple>true</isMultiple>
  141.  
  142.                                    <ClientProperty>
  143.                                        <name>xlink:href</name>
  144.                     <!-- PK in table profile_layer-->
  145.                                         <value>profile_layer_id</value>
  146.                                      </ClientProperty>        
  147.                                                          
  148.                                </AttributeMapping>         
  149.  
  150.             </attributeMappings>
  151.         </FeatureTypeMapping>
  152.  
  153.         <!-- ======================================== -->
  154.         <!-- link to gml_name datastore for multiple gml:name -->
  155.            
  156.         <!-- Feature Linking-->
  157.  
  158.         <FeatureTypeMapping>
  159.                        <mappingName>_sohorizon</mappingName>
  160.                         <sourceDataStore>datastore</sourceDataStore>
  161.                         <sourceType>profile_layer</sourceType>
  162.                     <targetElement>soil:SO_Soil</targetElement>
  163.            
  164.             <attributeMappings>
  165.                 <encodeIfEmpty>true</encodeIfEmpty>
  166.  
  167.                         <AttributeMapping>
  168.                                 <targetAttribute>FEATURE_LINK</targetAttribute>
  169.                     <!-- FK in table profile_layer-->
  170.                                 <sourceExpression><OCQL>profile_id_fk</OCQL></sourceExpression>
  171.                         </AttributeMapping>  
  172.                                                                            
  173.                             <AttributeMapping>                  
  174.                                 <targetAttribute>soil:soHorizon</targetAttribute>
  175.                             </AttributeMapping>
  176.                                      
  177.             </attributeMappings>
  178.         </FeatureTypeMapping>  
  179.  
  180.     </typeMappings>
  181. </as:AppSchemaDataAccess>
Advertisement
Add Comment
Please, Sign In to add comment