Ignore:
Timestamp:
05/04/07 13:32:19 (12 years ago)
Author:
ko23
Message:

Fix to ObsStn? StubB

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/StubB/XQuery/NDG-ObsStnStubB.xquery

    r2367 r2384  
    1818{ 
    1919let $found := count(collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    20             moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    21             and moles:dgMetadataID/moles:localIdentifier=$locid]) 
    22 return   
    23     if ($found = 0) then  
    24         element {$out-element-name} { 
    25             element error {'not found'}, 
    26             element repositoryIdentifier {$repid}, 
    27             element localIdentifier {$locid} 
    28         }  
    29     else ( 
    30         for $SRAct in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    31             moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    32             and moles:dgMetadataID/moles:localIdentifier=$locid]  
    33         return  
    34             element  {$out-element-name} {  
    35                 ($SRAct/moles:dgMetadataID), 
    36                 ($SRAct/moles:dgMetadataDescription), 
    37                 ($SRAct/moles:name), 
    38                 ($SRAct/moles:abbreviation), 
    39                 element dgActivity { 
    40                     if (exists($SRAct/*/moles:dgActivityDataCollection)) then  
    41                         ($SRAct/*/moles:dgActivityDataCollection) 
    42                     else if (exists($SRAct/*/moles:dgActivityDataProject)) then  
    43                         ($SRAct/*/moles:dgActivityDataProject) 
    44                     else if (exists($SRAct/*/dgActivityDataCampaign)) then 
    45                         ($SRAct/moles:dgActivity/moles:dgActivityDataCampaign) 
    46                     else  
    47                         ($SRAct/moles:dgActivity/moles:dgActivityDataInvestigation),  
    48                     ($SRAct/moles:dgActivity/moles:dgActivityCoverage), 
    49                     ($SRAct/moles:dgActivity/moles:dgActivityDuration) 
    50                 } (: </dgActivity> :)  
    51             } (: </activity> :)  
    52     ) 
     20moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     21and moles:dgMetadataID/moles:localIdentifier=$locid]) 
     22return   
     23if ($found = 0) then  
     24element {$out-element-name} { 
     25element error {'not found'}, 
     26element repositoryIdentifier {$repid}, 
     27element localIdentifier {$locid} 
     28}  
     29else ( 
     30for $SRAct in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
     31moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     32and moles:dgMetadataID/moles:localIdentifier=$locid]  
     33return  
     34element  {$out-element-name} {  
     35($SRAct/moles:dgMetadataID), 
     36($SRAct/moles:dgMetadataDescription), 
     37($SRAct/moles:name), 
     38($SRAct/moles:abbreviation), 
     39element dgActivity { 
     40if (exists($SRAct/*/moles:dgActivityDataCollection)) then  
     41($SRAct/*/moles:dgActivityDataCollection) 
     42else if (exists($SRAct/*/moles:dgActivityDataProject)) then  
     43($SRAct/*/moles:dgActivityDataProject) 
     44else if (exists($SRAct/*/dgActivityDataCampaign)) then 
     45($SRAct/moles:dgActivity/moles:dgActivityDataCampaign) 
     46else  
     47($SRAct/moles:dgActivity/moles:dgActivityDataInvestigation),  
     48($SRAct/moles:dgActivity/moles:dgActivityCoverage), 
     49($SRAct/moles:dgActivity/moles:dgActivityDuration) 
     50} (: </dgActivity> :)  
     51} (: </activity> :)  
     52) 
    5353} ; 
    5454 
     
    5858{ 
    5959let $found := count(collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    60         moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    61         and moles:dgMetadataID/moles:localIdentifier=$locid]) 
    62 return   
    63     if ($found = 0) then  
    64         element {$out-element-name} { 
    65             element error {'not found'}, 
    66             element repositoryIdentifier {$repid}, 
    67             element localIdentifier {$locid} 
    68         }  
    69     else ( 
    70         for $SRDE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    71             moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    72             and moles:dgMetadataID/moles:localIdentifier=$locid]  
    73         return   
    74             element {$out-element-name} { 
    75                 ($SRDE/moles:dgMetadataID), 
    76                 ($SRDE/moles:dgMetadataDescription), 
    77                 ($SRDE/moles:name), 
    78                 ($SRDE/moles:abbreviation), 
    79                 element dgDataEntity { 
    80                     ($SRDE/moles:dgDataEntity/moles:dgDataSetType), 
    81                     ($SRDE/moles:dgDataEntity/moles:dgDataGranule), 
    82                     ($SRDE/moles:dgDataEntity/moles:dgDataSummary) 
    83                 } (: </dgDataEntity> :)         
    84             } 
    85     ) 
     60moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     61and moles:dgMetadataID/moles:localIdentifier=$locid]) 
     62return   
     63if ($found = 0) then  
     64element {$out-element-name} { 
     65element error {'not found'}, 
     66element repositoryIdentifier {$repid}, 
     67element localIdentifier {$locid} 
     68}  
     69else ( 
     70for $SRDE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
     71moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     72and moles:dgMetadataID/moles:localIdentifier=$locid]  
     73return   
     74element {$out-element-name} { 
     75($SRDE/moles:dgMetadataID), 
     76($SRDE/moles:dgMetadataDescription), 
     77($SRDE/moles:name), 
     78($SRDE/moles:abbreviation), 
     79element dgDataEntity { 
     80($SRDE/moles:dgDataEntity/moles:dgDataSetType), 
     81($SRDE/moles:dgDataEntity/moles:dgDataGranule), 
     82($SRDE/moles:dgDataEntity/moles:dgDataSummary) 
     83} (: </dgDataEntity> :)         
     84} 
     85) 
    8686} ; 
    8787 
     
    9191{ 
    9292let $found := count(collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    93         moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    94         and moles:dgMetadataID/moles:localIdentifier=$locid]) 
    95 return   
    96     if ($found = 0) then  
    97         element {$out-element-name} { 
    98             element error {'not found'}, 
    99             element repositoryIdentifier {$repid}, 
    100             element localIdentifier {$locid} 
    101         }  
    102     else ( 
    103         for $SRDPT in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    104                 moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    105                 and moles:dgMetadataID/moles:localIdentifier=$locid] 
    106         return   
    107             element {$out-element-name} { 
    108                 $SRDPT/moles:dgMetadataID, 
    109                 $SRDPT/moles:dgMetadataDescription, 
    110                 $SRDPT/moles:name, 
    111                 $SRDPT/moles:abbreviation, 
    112                 $SRDPT/moles:logos, 
    113                 element dgDataProductionTool { 
    114                     $SRDPT/moles:dgDataProductionTool/moles:contactDetails, 
    115                     if (exists($SRDPT/moles:dgDataProductionTool/moles:dgModel)) then 
    116                         $SRDPT/moles:dgDataProductionTool/moles:dgModel 
    117                     else (), 
    118                     if (exists($SRDPT/moles:dgDataProductionTool/moles:dgInstrument)) then 
    119                         $SRDPT/moles:dgDataProductionTool/moles:dgInstrument 
    120                     else () 
    121                     } (: </dgDataProductionTool> :) 
    122                 } (: </dataproductiontool> :) 
    123     ) 
     93moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     94and moles:dgMetadataID/moles:localIdentifier=$locid]) 
     95return   
     96if ($found = 0) then  
     97element {$out-element-name} { 
     98element error {'not found'}, 
     99element repositoryIdentifier {$repid}, 
     100element localIdentifier {$locid} 
     101}  
     102else ( 
     103for $SRDPT in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
     104moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     105and moles:dgMetadataID/moles:localIdentifier=$locid] 
     106return   
     107element {$out-element-name} { 
     108$SRDPT/moles:dgMetadataID, 
     109$SRDPT/moles:dgMetadataDescription, 
     110$SRDPT/moles:name, 
     111$SRDPT/moles:abbreviation, 
     112$SRDPT/moles:logos, 
     113element dgDataProductionTool { 
     114$SRDPT/moles:dgDataProductionTool/moles:contactDetails, 
     115if (exists($SRDPT/moles:dgDataProductionTool/moles:dgModel)) then 
     116$SRDPT/moles:dgDataProductionTool/moles:dgModel 
     117else (), 
     118if (exists($SRDPT/moles:dgDataProductionTool/moles:dgInstrument)) then 
     119$SRDPT/moles:dgDataProductionTool/moles:dgInstrument 
     120else () 
     121} (: </dgDataProductionTool> :) 
     122} (: </dataproductiontool> :) 
     123) 
    124124} ; 
    125125 
     
    129129{ 
    130130let $found := count(collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    131             moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    132             and moles:dgMetadataID/moles:localIdentifier=$locid]) 
    133 return   
    134     if ($found = 0) then  
    135         element {$out-element-name} { 
    136             element error {'not found'}, 
    137             element repositoryIdentifier {$repid}, 
    138             element localIdentifier {$locid} 
    139         }  
    140     else ( 
    141         for $SRObsStn in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    142             moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    143             and moles:dgMetadataID/moles:localIdentifier=$locid]  
    144         return 
    145             element {$out-element-name} { 
    146                 ($SRObsStn/moles:dgMetadataID), 
    147                 ($SRObsStn/moles:dgMetadataDescription), 
    148                 ($SRObsStn/moles:name), 
    149                 ($SRObsStn/moles:abbreviation), 
    150                 element dgObservationStation { 
    151                     ($SRObsStn/moles:dgObservationStation/moles:contactDetails), 
    152                     if (exists($SRObsStn/moles:dgObservationStation/moles:dgStationaryPlatform)) then 
    153                         element dgStationaryPlatform { 
    154                             $SRObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:position, 
    155                             if (exists($SRObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/dgLandStation)) then element dgLandStation {''} 
    156                             else if (exists($SRObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/dgMooring)) then element dgMooring {''} 
    157                             else if (exists($SRObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/dgStationGroup)) then element dgStationGroup {''} 
    158                             else () 
    159                             } 
    160                     else if (exists($SRObsStn/moles:dgObservationStation/moles:dgMovingPlatform)) then  
    161                         $SRObsStn/moles:dgObservationStation/moles:dgMovingPlatform 
    162                     else () 
    163                 } (: </dgObservationStation> :) 
    164             } 
    165     ) 
     131moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     132and moles:dgMetadataID/moles:localIdentifier=$locid]) 
     133return   
     134if ($found = 0) then  
     135element {$out-element-name} { 
     136element error {'not found'}, 
     137element repositoryIdentifier {$repid}, 
     138element localIdentifier {$locid} 
     139}  
     140else ( 
     141for $SRObsStn in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
     142moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     143and moles:dgMetadataID/moles:localIdentifier=$locid]  
     144return 
     145element {$out-element-name} { 
     146($SRObsStn/moles:dgMetadataID), 
     147($SRObsStn/moles:dgMetadataDescription), 
     148($SRObsStn/moles:name), 
     149($SRObsStn/moles:abbreviation), 
     150element dgObservationStation { 
     151($SRObsStn/moles:dgObservationStation/moles:contactDetails), 
     152if (exists($SRObsStn/moles:dgObservationStation/moles:dgStationaryPlatform)) then 
     153element dgStationaryPlatform { 
     154$SRObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:position, 
     155if (exists($SRObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/dgLandStation)) then element dgLandStation {''} 
     156else if (exists($SRObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/dgMooring)) then element dgMooring {''} 
     157else if (exists($SRObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/dgStationGroup)) then element dgStationGroup {''} 
     158else () 
     159} 
     160else if (exists($SRObsStn/moles:dgObservationStation/moles:dgMovingPlatform)) then  
     161$SRObsStn/moles:dgObservationStation/moles:dgMovingPlatform 
     162else () 
     163} (: </dgObservationStation> :) 
     164} 
     165) 
    166166} ; 
    167167 
     
    171171{ 
    172172let $found := count(collection($targetCollection)/moles:dgMetadata/moles:dgPerson[ 
    173             moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    174             and moles:dgMetadataID/moles:localIdentifier=$locid]) 
    175 return   
    176     if ($found = 0) then  
    177         element {$out-element-name} { 
    178             element error {'not found'}, 
    179             element repositoryIdentifier {$repid}, 
    180             element localIdentifier {$locid} 
    181         }  
    182     else ( 
    183     for $person in collection($targetCollection)/moles:dgMetadata/moles:dgPerson[ 
    184         moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    185         and moles:dgMetadataID/moles:localIdentifier=$locid]  
    186     return  
    187         element  {$out-element-name}  
    188         { 
    189             ($person/moles:name), 
    190             ($person/moles:contactDetails), 
    191             ($person/moles:dgMetadataID) 
    192         } 
    193     ) 
     173moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     174and moles:dgMetadataID/moles:localIdentifier=$locid]) 
     175return   
     176if ($found = 0) then  
     177element {$out-element-name} { 
     178element error {'not found'}, 
     179element repositoryIdentifier {$repid}, 
     180element localIdentifier {$locid} 
     181}  
     182else ( 
     183for $person in collection($targetCollection)/moles:dgMetadata/moles:dgPerson[ 
     184moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     185and moles:dgMetadataID/moles:localIdentifier=$locid]  
     186return  
     187element  {$out-element-name}  
     188{ 
     189($person/moles:name), 
     190($person/moles:contactDetails), 
     191($person/moles:dgMetadataID) 
     192} 
     193) 
    194194} ; 
    195195 
     
    198198(: Security not implemented yet :) 
    199199{ 
    200     let $found := count(collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation[ 
    201                 moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    202                 and moles:dgMetadataID/moles:localIdentifier=$locid]) 
    203     return   
    204         if ($found = 0) then  
    205             element {$out-element-name} { 
    206                 element error {'not found'}, 
    207                 element repositoryIdentifier {$repid}, 
    208                 element localIdentifier {$locid} 
    209             }  
    210         else ( 
    211             for $org in collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation[ 
    212                 moles:dgMetadataID/moles:repositoryIdentifier=$repid  
    213                 and moles:dgMetadataID/moles:localIdentifier=$locid]  
    214             return  
    215                 element  {$out-element-name} { 
    216                     $org/moles:dgMetadataID, 
    217                     $org/moles:name, 
    218                     $org/moles:abbreviation, 
    219                     $org/moles:contactDetails, 
    220                     $org/moles:logos 
    221                 } 
    222         ) 
     200let $found := count(collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation[ 
     201moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     202and moles:dgMetadataID/moles:localIdentifier=$locid]) 
     203return   
     204if ($found = 0) then  
     205element {$out-element-name} { 
     206element error {'not found'}, 
     207element repositoryIdentifier {$repid}, 
     208element localIdentifier {$locid} 
     209}  
     210else ( 
     211for $org in collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation[ 
     212moles:dgMetadataID/moles:repositoryIdentifier=$repid  
     213and moles:dgMetadataID/moles:localIdentifier=$locid]  
     214return  
     215element  {$out-element-name} { 
     216$org/moles:dgMetadataID, 
     217$org/moles:name, 
     218$org/moles:abbreviation, 
     219$org/moles:contactDetails, 
     220$org/moles:logos 
     221} 
     222) 
    223223} ; 
    224224 
    225225for $ObsStn in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    226     moles:dgObservationStation!=''  
    227     and moles:dgMetadataID[ 
    228     moles:schemeIdentifier='NDG-B0'  
    229     and moles:repositoryIdentifier=$repositoryIdentifier 
    230     and moles:localIdentifier=$localIdentifier]] 
    231     return 
    232     utillib:strip-namespace( 
    233     element dgMetadataRecord { 
    234         element dgMetadataID { 
    235             element schemeIdentifier {'NDG-B1', 
    236             $ObsStn/moles:dgMetadataID/moles:repositoryIdentifier, 
    237             $ObsStn/moles:dgMetadataID/moles:localIdentifier 
    238         } (: End </dgMetadataID> :),  
    239         $ObsStn/moles:dgMetadataDescription, 
    240         $ObsStn/moles:name, 
    241         $ObsStn/moles:abbreviation, 
    242         element dgObservationStation {  
    243             $ObsStn/moles:dgObservationStation/moles:contactDetails, 
    244             if (exists($ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform)) then  
    245                 element dgStationaryPlatform {  
    246                 $ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:position, 
    247                 if (exists($ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring)) then    
    248                     element dgMooring {  
    249                         $ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring/moles:dateStart, 
    250                         $ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring/moles:dateEnd, 
    251                         for $DepositingCruise in $ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring/moles:DepositingCruise 
    252                         return  
    253                             f:return-stub-activity('depositingcruise', data($DepositingCruise/moles:dgMetadataID/moles:repositoryIdentifier), data($DepositingCruise/moles:dgMetadataID/moles:localIdentifier)), 
    254                             if (exists($ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring/moles:dgStationGrouping)) then    
    255                                 for $StationGrouping in $ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring/dgStationGrouping  
    256                                 return   
    257                                     f:return-stub-obsstn('stationgrouping', data($StationGrouping/moles:dgMetadataID/moles:repositoryIdentifier), data($StationGrouping/moles:dgMetadataID/moles:localIdentifier)) 
    258                             else () 
    259                     } (: End </dgMooring> :)   
    260                 else if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup)) then    
    261                     element dgStationGroup {  
    262                         element dgGroupedStations {  
    263                             if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStations)) then 
    264                                 for $GroupedStation in $ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStation/dgGroupedStations 
    265                                 return f:return-stub-obsstn('dgGroupedStation', data($GroupedStation/moles:dgMetadataID/moles:repositoryIdentifier), data($GroupedStation/moles:dgMetadataID/moles:localIdentifier)) 
    266                             else () 
    267                         } (: End </dgGroupedStations> :) 
    268                     } (: End </dgStationGroup> :)  
    269                 else $ObsStn/moles:dgObservationStation/moles:dgLandStation 
    270                 } (: End </dgStationaryPlatform>  :)   
    271                 else $ObsStn/moles:dgObservationStation/moles:dgMovingPlatform  
    272             } ,  
    273             for $RelDep in $ObsStn/moles:dgObservationStation/moles:ObsStationDeployment  
    274             return  
    275                 element ObsStationDeployment { 
    276                 $RelDep/moles:DateStart, 
    277                 $RelDep/moles:DateEnd, 
    278                 $RelDep/moles:dgMetadataID, 
    279                 f:return-stub-activity('activity', data($RelDep/moles:ActivityID/moles:repositoryIdentifier), data($RelDep/moles:ActivityID/moles:localIdentifier)), 
    280                 f:return-stub-dpt('dataproductiontool', data($RelDep/moles:DataProductionToolID/moles:repositoryIdentifier), data($RelDep/moles:DataProductionToolID/moles:localIdentifier)),  
    281                 for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord 
    282                     where $DE/moles:dgDataEntity/moles:RelatedDeployment/moles:dgMetadataID/moles:repositoryIdentifier=$RelDep/moles:dgMetadataID/moles:repositoryIdentifier 
    283                             and $DE/moles:dgDataEntity/moles:RelatedDeployment/moles:dgMetadataID/moles:localIdentifier=$RelDep/moles:dgMetadataID/moles:localIdentifier 
    284                 return 
    285                     f:return-stub-dataentity('dataentity', data($DE/moles:dgMetadataID/moles:repositoryIdentifier), data($DE/moles:dgMetadataID/moles:localIdentifier)), 
    286                 $RelDep/moles:Coverage 
    287             } (: </RelatedDeployment> :)  
    288         } (: </dgObservationStation> :),  
    289     for $strkwrd in $ObsStn/moles:dgStructuredKeyword return $strkwrd, 
    290     if (exists($ObsStn/moles:dgMetadataProvenance)) then $ObsStn/moles:dgMetadataProvenance else (), 
    291     if (exists($ObsStn/moles:dgMetadataSecurity)) then $ObsStn/moles:dgMetadataSecurity else () 
    292     } (: End </dgMetadataRecord> :) 
     226moles:dgObservationStation!=''  
     227and moles:dgMetadataID[ 
     228moles:schemeIdentifier='NDG-B0'  
     229and moles:repositoryIdentifier=$repositoryIdentifier 
     230and moles:localIdentifier=$localIdentifier]] 
     231return 
     232utillib:strip-namespace( 
     233element dgMetadataRecord { 
     234element dgMetadataID { 
     235element schemeIdentifier {'NDG-B1'}, 
     236$ObsStn/moles:dgMetadataID/moles:repositoryIdentifier, 
     237$ObsStn/moles:dgMetadataID/moles:localIdentifier 
     238} (: End </dgMetadataID> :),  
     239$ObsStn/moles:dgMetadataDescription, 
     240$ObsStn/moles:name, 
     241$ObsStn/moles:abbreviation, 
     242element dgObservationStation {  
     243$ObsStn/moles:dgObservationStation/moles:contactDetails, 
     244if (exists($ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform)) then  
     245element dgStationaryPlatform {  
     246$ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:position, 
     247if (exists($ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring)) then    
     248element dgMooring {  
     249$ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring/moles:dateStart, 
     250$ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring/moles:dateEnd, 
     251for $DepositingCruise in $ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring/moles:DepositingCruise 
     252return  
     253f:return-stub-activity('depositingcruise', data($DepositingCruise/moles:dgMetadataID/moles:repositoryIdentifier), data($DepositingCruise/moles:dgMetadataID/moles:localIdentifier)), 
     254if (exists($ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring/moles:dgStationGrouping)) then    
     255for $StationGrouping in $ObsStn/moles:dgObservationStation/moles:dgStationaryPlatform/moles:dgMooring/dgStationGrouping  
     256return   
     257f:return-stub-obsstn('stationgrouping', data($StationGrouping/moles:dgMetadataID/moles:repositoryIdentifier), data($StationGrouping/moles:dgMetadataID/moles:localIdentifier)) 
     258else () 
     259} (: End </dgMooring> :)   
     260else if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup)) then    
     261element dgStationGroup {  
     262element dgGroupedStations {  
     263if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStations)) then 
     264for $GroupedStation in $ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStation/dgGroupedStations 
     265return f:return-stub-obsstn('dgGroupedStation', data($GroupedStation/moles:dgMetadataID/moles:repositoryIdentifier), data($GroupedStation/moles:dgMetadataID/moles:localIdentifier)) 
     266else () 
     267} (: End </dgGroupedStations> :) 
     268} (: End </dgStationGroup> :)  
     269else $ObsStn/moles:dgObservationStation/moles:dgLandStation 
     270} (: End </dgStationaryPlatform>  :)   
     271else $ObsStn/moles:dgObservationStation/moles:dgMovingPlatform ,  
     272for $RelDep in $ObsStn/moles:dgObservationStation/moles:ObsStationDeployment  
     273return  
     274element ObsStationDeployment { 
     275$RelDep/moles:DateStart, 
     276$RelDep/moles:DateEnd, 
     277$RelDep/moles:dgMetadataID, 
     278f:return-stub-activity('activity', data($RelDep/moles:ActivityID/moles:repositoryIdentifier), data($RelDep/moles:ActivityID/moles:localIdentifier)), 
     279f:return-stub-dpt('dataproductiontool', data($RelDep/moles:DataProductionToolID/moles:repositoryIdentifier), data($RelDep/moles:DataProductionToolID/moles:localIdentifier)),  
     280for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord 
     281where $DE/moles:dgDataEntity/moles:RelatedDeployment/moles:dgMetadataID/moles:repositoryIdentifier=$RelDep/moles:dgMetadataID/moles:repositoryIdentifier 
     282and $DE/moles:dgDataEntity/moles:RelatedDeployment/moles:dgMetadataID/moles:localIdentifier=$RelDep/moles:dgMetadataID/moles:localIdentifier 
     283return 
     284f:return-stub-dataentity('dataentity', data($DE/moles:dgMetadataID/moles:repositoryIdentifier), data($DE/moles:dgMetadataID/moles:localIdentifier)), 
     285$RelDep/moles:Coverage 
     286} (: </RelatedDeployment> :)  
     287} (: </dgObservationStation> :),  
     288for $strkwrd in $ObsStn/moles:dgStructuredKeyword return $strkwrd, 
     289if (exists($ObsStn/moles:dgMetadataProvenance)) then $ObsStn/moles:dgMetadataProvenance else (), 
     290if (exists($ObsStn/moles:dgMetadataSecurity)) then $ObsStn/moles:dgMetadataSecurity else () 
     291} (: End </dgMetadataRecord> :) 
    293292) (: End namespace strip :) 
Note: See TracChangeset for help on using the changeset viewer.