Changeset 1276


Ignore:
Timestamp:
04/07/06 08:01:47 (13 years ago)
Author:
ko23
Message:

Update queries + Java code

Location:
TI07-MOLES/trunk
Files:
3 added
2 deleted
8 edited

Legend:

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

    r811 r1276  
    1 for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='www.npm.ac.uk' and dgMetadataID/localIdentifier='recordID.0'] 
     1for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='badc.nerc.ac.uk' and dgMetadataID/localIdentifier='dataent1'] 
    22return 
    3         <DIF> 
     3        <DIF  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/' xsi:schemaLocation='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/ http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/dif_v9.4.xsd'> 
    44        <Entry_ID>{concat($DE/dgMetadataID/repositoryIdentifier, ':DIF:', $DE/dgMetadataID/localIdentifier)}</Entry_ID> 
    55        <Entry_Title>{string($DE/name)}</Entry_Title> 
    6         <Parameters> 
     6        {for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder[not(exists(endDate)) or endDate=''] 
     7                return  
     8                        for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' 
     9                                       and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier 
     10                                       and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] 
     11                                return  
     12                                <Dataset_Citation> 
     13                                        {element Data_Creator {if (exists($DataCreatorRoleHolder/name/initials)) then ( 
     14                                        string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName))) 
     15                                        ) 
     16                                        else ( 
     17                                                        string($DataCreatorRoleHolder/abbreviation) 
     18                                        )} 
     19                                        } 
     20 
     21                                        <Dataset_Title>{string($DE/name)}</Dataset_Title> 
     22 
     23                                </Dataset_Citation> 
     24        } 
     25        <Personnel/> 
     26        <Discipline/> 
     27         
    728        {for $StructuredKeyword in ($DE//(dgStructuredKeyword | dgStdParameterMeasured)[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and ListLevel = 0]) 
    829                return if (exists($StructuredKeyword/*/dgValidTerm)) then ( 
    9                 <Parameter> 
    10                         <Category>{string($StructuredKeyword/*/dgValidTerm)}</Category> 
     30                <Parameters> 
     31                        {element Category {string($StructuredKeyword/*/dgValidTerm)}} 
    1132                        {if (exists($StructuredKeyword//dgValidSubterm)  
    1233                                and $StructuredKeyword//dgValidSubterm != ''  
     
    1637                                order by $Subterm/ListLevel 
    1738                                return  
    18                                         if ($Subterm/ListLevel=1) then (<Topic>{string($Subterm/dgValidSubterm/dgValidTerm)}</Topic>)  
    19                                         else ( 
    20                                         if ($Subterm/ListLevel=2) then (<Term>{string($Subterm/dgValidSubterm/dgValidTerm)}</Term>)  
    21                                         else ( 
    22                                         if ($Subterm/ListLevel=3) then (<Variable>{string($Subterm/dgValidSubterm/dgValidTerm)}</Variable>)  
    23                                         else ( 
    24                                         if ($Subterm/ListLevel=4) then (<Detailed_Variable>{string($Subterm/dgValidSubterm/dgValidTerm)}</Detailed_Variable>)  
    25                                         else (<GCMD_Science_Valid>{string($Subterm/dgValidSubterm/dgValidTerm)}</GCMD_Science_Valid>)))) 
     39                                        if ($Subterm/ListLevel=1) then (element Topic {string($Subterm/dgValidSubterm/dgValidTerm)})  
     40                                        else ( 
     41                                        if ($Subterm/ListLevel=2) then (element Term {string($Subterm/dgValidSubterm/dgValidTerm)})  
     42                                        else ( 
     43                                        if ($Subterm/ListLevel=3) then (element Variable {string($Subterm/dgValidSubterm/dgValidTerm)})  
     44                                        else ( 
     45                                        if ($Subterm/ListLevel=4) then (element Detailed_Variable {string($Subterm/dgValidSubterm/dgValidTerm)})  
     46                                        else (element GCMD_Science_Valid {string($Subterm/dgValidSubterm/dgValidTerm)})))) 
    2647                                )        
    2748                        else()} 
    28                 </Parameter> 
     49                </Parameters> 
    2950                ) 
    3051                else() 
    3152        } 
    32         </Parameters> 
    3353        {for $ISOTopicCategory in ($DE/dgStructuredKeyword[dgValidTermID/ParentListID='ISO 19115 Topic Category']) 
    3454                return  
    35                         <ISO_Topic_Category>{$ISOTopicCategory/dgValidTerm}</ISO_Topic_Category> 
    36         } 
     55                        element ISO_Topic_Category {string($ISOTopicCategory/dgValidTerm)} 
     56        } 
     57        {for $Keyword in distinct-values($DE//dgStructuredKeyword[ 
     58        dgValidTermID/ParentListID!='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html'   
     59        and  
     60        dgValidTermID/ParentListID!='ISO 19115 Topic Category'   
     61        ]/dgValidTerm) 
     62        return element Keyword {string($Keyword)}  
     63        } 
     64            
     65        {for $DepDPT in ($DE/dgDataEntity/RelatedDeployment/DataProductionToolID)   
     66        return  
     67            <Sensor_Name> 
     68                {for $DepDPTAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/abbreviation)) 
     69                    return element Short_Name {data($DepDPTAbbrev)}} 
     70                {for $DepDPTName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/name)) 
     71                    return element Long_Name {data($DepDPTName)} 
     72                } 
     73            </Sensor_Name> 
     74        } 
     75        {for $DepObsStn in ($DE/dgDataEntity/RelatedDeployment/ObservationStationID) 
     76        return  
     77            <Source_Name> 
     78                {for $DepObsStnAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/abbreviation)) 
     79                    return <Short_Name>{data($DepObsStnAbbrev)}</Short_Name>} 
     80                {for $DepObsStnName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/name)) 
     81                    return <Long_Name>{data($DepObsStnName)}</Long_Name>} 
     82            </Source_Name> 
     83            } 
     84        {for $TemporalRange in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgDateRange) 
     85                return <Temporal_Coverage>  
     86                    {element Start_Date {data($TemporalRange/DateRangeStart)}} 
     87                    {element End_Date {data($TemporalRange/DateRangeEnd)}} 
     88                 </Temporal_Coverage> 
     89                } 
     90        {for $TemporalTerm in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea/dgValidTerm) 
     91                return element Paleo_Temporal_Coverage { 
     92                element Chronostratigraphic_Unit {data($TemporalTerm)} 
     93                    }  
     94                } 
     95        {for $Data_Set_Progress in ($DE/dgDataEntity/dgDataSummary/dgDataStatus/dgDatasetClosure) 
     96                return element Data_Set_Progress {$Data_Set_Progress} 
     97                    }  
     98        {for $BoundingBox in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/BoundingBox) 
     99        return <Spatial_Coverage>  
     100            {element Southernmost_Latitude {data($BoundingBox/LimitSouth)}} 
     101            {element Northernmost_Latitude {data($BoundingBox/LimitNorth)}} 
     102            {element Westernmost_Longitude {data($BoundingBox/LimitWest)}} 
     103            {element Easternmost_Longitude {data($BoundingBox/LimitEast)}} 
     104            </Spatial_Coverage> 
     105        } 
     106        {for $Location in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_locations.html']) 
     107                return element Location {$Location}  
     108                } 
     109        <Data_Resolution/> 
     110        {for $DepAct in ($DE/dgDataEntity/RelatedDeployment/ActivityID) 
     111        return  
     112            <Project> 
     113                {for $DepActAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/abbreviation)) 
     114                    return <Short_Name>{data($DepActAbbrev)}</Short_Name>} 
     115                {for $DepActName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/name)) 
     116                    return <Long_Name>{data($DepActName)}</Long_Name>} 
     117            </Project> 
     118            } 
     119        <Quality/> 
     120        {if (exists($DE/dgDataEntity/dgDataGranule/accessControlPolicy)) then ( 
     121            element Access_Constraints {''} 
     122            ) 
     123                else () 
     124            } 
     125        <Use_Constraints/> 
     126        <Data_Set_Language/> 
     127        <Originating_Center/> 
     128 
    37129        {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[not(exists(endDate)) or endDate=''] 
    38130                return  
    39                         <Data_Center> 
    40                                 {if (exists($DataCuratorRole/dgPersonID)) then 
    41                                         for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgPerson[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] 
    42                                                 return  
    43                                                 string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) 
    44                                 else if (exists($DataCuratorRole/dgOrganisationID)) then 
    45                                         for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgOrganisation[(dgMetadataID/schemeIdentifier='NDG-B0'  
    46                                                 and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier  
    47                                                 and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] 
    48                                                 return  
    49                                                 string($DataCuratorRoleHolder/name) 
    50                                 else () 
    51                                 } 
    52                         </Data_Center> 
    53                 } 
     131                        for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' 
     132                                       and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier 
     133                                       and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] 
     134                                return  
     135                                <Data_Center> 
     136                                        <Data_Center_Name> 
     137                                        {element Short_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( 
     138                                        string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) 
     139                                        ) 
     140                                        else ( 
     141                                                        string($DataCuratorRoleHolder/abbreviation) 
     142                                        )} 
     143                                        } 
     144                                        {element Long_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( 
     145                                        string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) 
     146                                        ) 
     147                                        else (string($DataCuratorRoleHolder/name))} 
     148                                        } 
     149                                        </Data_Center_Name> 
     150                                        {if (exists($DataCuratorRoleHolder/contactDetails/URI)) then ( 
     151                                        element Data_Center_URL {data($DataCuratorRoleHolder/contactDetails/URI)} 
     152                                        ) 
     153                                        else ()} 
     154                                        {for $DGID in $DE/dgDataEntity/dgDataGranule/dataModelID 
     155                                        return element Data_Set_ID {concat($DGID/repositoryIdentifier, ':', $DGID/schemeIdentifier, ':', $DGID/localIdentifier)} 
     156                                        } 
     157                                        <Personnel> 
     158                                        {element Role {'Data Center Contact'}} 
     159                                        {if (exists($DataCuratorRoleHolder/name/knownAs)) then ( 
     160                                        element First_Name {string($DataCuratorRoleHolder/name/knownAs)} 
     161                                        ) 
     162                                        else if (exists($DataCuratorRoleHolder/name/initials)) then ( 
     163                                        element First_Name {string($DataCuratorRoleHolder/name/initials)} 
     164                                        ) 
     165                                        else ()}                                         
     166                                        {element Last_Name {if (exists($DataCuratorRoleHolder/name/familyName)) then ( 
     167                                        string($DataCuratorRoleHolder/name/familyName) 
     168                                        ) 
     169                                        else (string($DataCuratorRoleHolder/name))} 
     170                                        } 
     171                                        {if (exists($DataCuratorRole/contactDetails/eMail)) then ( 
     172                                        element Email {string($DataCuratorRole/contactDetails/eMail)} 
     173                                        ) 
     174                                        else ( 
     175                                        if (exists($DataCuratorRoleHolder/contactDetails/eMail)) then ( 
     176                                        element Email {string($DataCuratorRoleHolder/contactDetails/eMail)} 
     177                                        ) 
     178                                        else () 
     179                                        )} 
     180                                        {if (exists($DataCuratorRole/contactDetails/telephone)) then ( 
     181                                        element Phone {string($DataCuratorRole/contactDetails/telephone)} 
     182                                        ) 
     183                                        else ( 
     184                                        if (exists($DataCuratorRoleHolder/contactDetails/telephone)) then ( 
     185                                        element Phone {string($DataCuratorRoleHolder/contactDetails/telephone)} 
     186                                        ) 
     187                                        else () 
     188                                        )} 
     189                                        {if (exists($DataCuratorRole/contactDetails/fax)) then ( 
     190                                        element Fax {string($DataCuratorRole/contactDetails/fax)} 
     191                                        ) 
     192                                        else ( 
     193                                        if (exists($DataCuratorRoleHolder/contactDetails/fax)) then ( 
     194                                        element Fax {string($DataCuratorRoleHolder/contactDetails/fax)} 
     195                                        ) 
     196                                        else () 
     197                                        )} 
     198                                        {if (exists($DataCuratorRole/contactDetails/address/addressline)) then ( 
     199                                        for $addressline in $DataCuratorRole/contactDetails/address/addressline 
     200                                        return element address {$addressline} 
     201                                        ) 
     202                                        else ( 
     203                                        if (exists($DataCuratorRoleHolder/contactDetails/addressline)) then ( 
     204                                        for $addressline in $DataCuratorRoleHolder/contactDetails/address/addressline 
     205                                        return element address {$addressline} 
     206                                        ) 
     207                                        else () 
     208                                        )} 
     209                                        {if (exists($DataCuratorRole/contactDetails/address/city)) then ( 
     210                                        element City {string($DataCuratorRole/contactDetails/city)} 
     211                                        ) 
     212                                        else ( 
     213                                        if (exists($DataCuratorRoleHolder/contactDetails/city)) then ( 
     214                                        element Cityl {string($DataCuratorRoleHolder/contactDetails/city)} 
     215                                        ) 
     216                                        else () 
     217                                        )} 
     218                                        {if (exists($DataCuratorRole/contactDetails/address/postcode)) then ( 
     219                                        element Postal_Code {string($DataCuratorRole/contactDetails/postcode)} 
     220                                        ) 
     221                                        else ( 
     222                                        if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( 
     223                                        element email {string($DataCuratorRoleHolder/contactDetails/postcode)} 
     224                                        ) 
     225                                        else () 
     226                                        )} 
     227                                        {if (exists($DataCuratorRole/contactDetails/address/country)) then ( 
     228                                        element Postal_Code {string($DataCuratorRole/contactDetails/country)} 
     229                                        ) 
     230                                        else ( 
     231                                        if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( 
     232                                        element Postal_Code {string($DataCuratorRoleHolder/contactDetails/eMail)} 
     233                                        ) 
     234                                        else () 
     235                                                                         )} 
     236                                        </Personnel>  
     237                                </Data_Center> 
     238        } 
     239 
     240        <Distribution/> 
     241        <Multimedia_Sample/> 
     242        <Reference/> 
     243 
    54244        <Summary>{string($DE/dgMetadataDescription/abstract/abstractText)}</Summary> 
     245 
     246        <Related_URL> 
     247            {element URL_Content_Type {'NDG_B_SERVICE'}} 
     248            {element URL {data($DE/dgMetadataID/repositoryIdentifier)}} 
     249            {element Description {'The NDG service for browsing metadata.'}} 
     250        </Related_URL> 
     251 
     252        {for $DG in $DE/dgDataEntity/dgDataGranule 
     253            return  
     254            if ($DG/dataModelID/schemeIdentifier='NDG-A0') then ( 
     255            <Related_URL> 
     256            {element URL_Content_Type {'NDG_A_SERVICE'}} 
     257            {element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&amp;datasetID=', true())}} 
     258            {element Description {'The NDG service delivering data via NDG A metadata.'}} 
     259            </Related_URL> 
     260            ) 
     261            else if ($DG/dataModelID/schemeIdentifier='CSML-0') then ( 
     262            <Related_URL> 
     263            {element URL_Content_Type {'NDG_A_SERVICE'}} 
     264            {element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())}} 
     265            {element Description {'The NDG service delivering data via NDG A metadata.'}} 
     266            </Related_URL> 
     267            ) 
     268            else if ($DG/dataModelID/schemeIdentifier='URI') then ( 
     269            <Related_URL> 
     270            {element URL {data($DG/instance/URI)}} 
     271            {if (exists($DG/instance/instanceComment)) then ( 
     272            element Description {data($DG/instance/instanceComment)}         
     273            ) 
     274            else ( 
     275            element Description {'URL to aid in delivering data. Note that this may point directly to the data or, more likely, point to the web site of the curators.'} 
     276            ) 
     277            } 
     278            </Related_URL> 
     279            ) 
     280            else () 
     281        } 
     282        <Parent_DIF/> 
     283        <IDN_Node/> 
     284        <Originating_Metadata_Node/>     
    55285        <Metadata_Name>[CEOS IDN DIF]</Metadata_Name> 
    56         <Metadata_Version>9.4</Metadata_Version> 
     286        {element Metadata_Version {'9.4'}} 
     287 
     288        {if  (exists($DE/dgMetadataProvenance/RecordCreation)) then ( 
     289        element DIF_Creation_Date {data($DE/dgMetadataProvenance/RecordCreation/CreatedDate)} 
     290        ) 
     291        else () 
     292        } 
     293        {for $MDUpdt in $DE/dgMetadataProvenance/RecordUpdate 
     294        return  element DIF_Revision_History {concat(data($MDUpdt/UpdateDate), ' - ', data($MDUpdt/UpdateSummary), ' - ', data($MDUpdt/UpdatedBy))} 
     295        } 
     296        {if  (exists($DE/dgMetadataProvenance/RecordReview)) then ( 
     297        element Future_DIF_Review_Date {data($DE/dgMetadataProvenance/RecordReview/ReviewDate)} 
     298        ) 
     299        else () 
     300        } 
    57301        </DIF> 
    58 (: Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved. 
    59 <metaInformation> 
    60 <scenarios ><scenario default="yes" name="StubB" userelativepaths="yes" externalpreview="no" url="..\..\..\..\..\..\..\My Documents\ndgBXML\ndgB.xml" outputurl="" processortype="saxon" tcpport="2233" profilemode="7" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" host="" port="8000" user="" password=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition></MapperMetaTag> 
    61 </metaInformation> 
    62 :) 
  • TI07-MOLES/trunk/DublinCore/XQuery/NDG-DublinCore.xquery

    r648 r1276  
    1 declare namespace dc="http://purl.org/dc/elements/1.1/"; 
    2 declare namespace oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc"; 
    3 for $DE in //dgMetadataRecord[dgDataEntity!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='repositoryID' and dgMetadataID/localIdentifier='localID'] 
     1declare namespace dc='http://purl.org/dc/elements/1.1/'; 
     2declare namespace oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc'; 
     3declare variable $gcmd_science_valids as xs:string {'http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html'}; 
     4declare variable $gcmd_project_valids as xs:string {'http://gcmd.gsfc.nasa.gov/Resources/valids/projects.html'}; 
     5declare variable $cf_standard_names as xs:string {'http://www.cgd.ucar.edu/cms/eaton/cf-metadata/standard_name.html'}; 
     6 
     7for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgDataEntity!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='badc.nerc.ac.uk' and dgMetadataID/localIdentifier='dataent3'] 
    48return  
    5 <oai_dc:dc> 
     9<oai_dc:dc xmlns:oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc/' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'> 
    610        <dc:title>{string($DE/name)}</dc:title> 
    711        <dc:type>Dataset</dc:type> 
    812        <dc:identifier>{concat($DE/dgMetadataID/repositoryIdentifier, ':DC:', $DE/dgMetadataID/localIdentifier)}</dc:identifier> 
    913        <dc:description>{string($DE/dgMetadataDescription/abstract/abstractText)}</dc:description> 
    10         {for $StructuredKeyword in $DE//(dgStructuredKeyword | dgStdParameterMeasured)[dgValidTermID/ParentListID='http://www.cgd.ucar.edu/cms/eaton/cf-metadata/standard_name.html'    or dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' or dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/projects.html']  
    11                 order by $StructuredKeyword/dgValidTerm 
     14        {for $StructuredKeyword in distinct-values($DE/dgStructuredKeyword [dgValidTermID/ParentListID=$cf_standard_names or dgValidTermID/ParentListID=$gcmd_science_valids or dgValidTermID/ParentListID=$gcmd_project_valids]//dgValidTerm)  
     15                order by $StructuredKeyword 
    1216                return  
    1317                <dc:subject> 
    14                         {string($StructuredKeyword/dgValidTerm)} 
     18                        {string($StructuredKeyword)} 
     19                </dc:subject> 
     20        } 
     21        {for $StructuredKeyword1 in distinct-values($DE/dgDataEntity/dgDataSummary/dgParameterSummary/dgStdParameterMeasured[dgValidTermID/ParentListID=$cf_standard_names or dgValidTermID/ParentListID=$gcmd_science_valids or dgValidTermID/ParentListID=$gcmd_project_valids]//dgValidTerm)  
     22                order by $StructuredKeyword1 
     23                return  
     24                <dc:subject> 
     25                        {string($StructuredKeyword1)} 
    1526                </dc:subject> 
    1627        } 
     
    1829        order by $DataCreatorRole/startDate empty least, $DataCreatorRole/endDate empty least 
    1930        return  
    20                 for $DataCreatorRoleHolder in /*/(dgOrganisation | dgPerson)[((not(exists($DataCreatorRole/endDate)) or empty($DataCreatorRole/endDate)) and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)]                 return  
     31                for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/(dgOrganisation | dgPerson)[((not(exists($DataCreatorRole/endDate)) or empty($DataCreatorRole/endDate)) and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)]           return  
    2132                <dc:creator> 
    2233                {if (string(local-name($DataCreatorRoleHolder))='dgOrganisation') then 
     
    3041        order by $DataCuratorRole/startDate empty least 
    3142        return  
    32                 for $DataCuratorRoleHolder in /*/(dgOrganisation | dgPerson)[((not(exists($DataCuratorRole/endDate)) or empty($DataCuratorRole/endDate)) and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)]  
     43                for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/(dgOrganisation | dgPerson)[((not(exists($DataCuratorRole/endDate)) or empty($DataCuratorRole/endDate)) and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)]  
    3344                return  
    3445                <dc:publisher> 
  • TI07-MOLES/trunk/JavaCode/bulkdestubbxmldb/ndg/services/bulkdestubb/Main.java

    r995 r1276  
    4343        static String test = "for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgDataEntity!='' and dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier='RepositoryID' and localIdentifier='LocalID']] return <empty/>"; 
    4444        static String RawDEMoles = "for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgDataEntity!='' and dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier='RepositoryID' and localIdentifier='LocalID']] return $DE"; 
    45         static String DublinCoreDEQuery = "xquery version '1.0'; declare default element namespace ''; declare namespace dc='http://purl.org/dc/elements/1.1/'; declare namespace oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc'; for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgDataEntity!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <oai_dc:dc> <dc:title>{string($DE/name)}</dc:title> <dc:type>Dataset</dc:type> <dc:identifier>{concat($DE/dgMetadataID/repositoryIdentifier, ':DC:', $DE/dgMetadataID/localIdentifier)}</dc:identifier> <dc:description>{string($DE/dgMetadataDescription/abstract/abstractText)}</dc:description> {for $StructuredKeyword in distinct-values($DE//(dgStructuredKeyword | dgStdParameterMeasured)/dgValidTerm) where ($DE//(dgStructuredKeyword | dgStdParameterMeasured)/dgValidTermID/ParentListID='http://www.cgd.ucar.edu/cms/eaton/cf-metadata/standard_name.html' or $DE//(dgStructuredKeyword | dgStdParameterMeasured)/dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' or $DE//(dgStructuredKeyword | dgStdParameterMeasured)/dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/projects.html') return <dc:subject> {string($StructuredKeyword)} </dc:subject> } {for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder return <dc:creator> {if (exists($DataCreatorRole/dgPersonID)) then for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgPerson[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName))) else if (exists($DataCreatorRole/dgOrganisationID)) then for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgOrganisation[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return string($DataCreatorRoleHolder/name) else (string('Not known')) } </dc:creator> } {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[not(exists(endDate)) or endDate=''] return <dc:publisher> {if (exists($DataCuratorRole/dgPersonID)) then for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgPerson[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) else if (exists($DataCuratorRole/dgOrganisationID)) then for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgOrganisation[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return string($DataCuratorRoleHolder/name) else (string('Not known')) } </dc:publisher> } </oai_dc:dc>"; 
    46         static String DIFQuery = "for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <DIF> <Entry_ID>{concat($DE/dgMetadataID/repositoryIdentifier, ':DIF:', $DE/dgMetadataID/localIdentifier)}</Entry_ID> <Entry_Title>{string($DE/name)}</Entry_Title> {for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return <Dataset_Citation> {element Data_Creator {if (exists($DataCreatorRoleHolder/name/initials)) then ( string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName))) ) else ( string($DataCreatorRoleHolder/abbreviation) )} } <Dataset_Title>{string($DE/name)}</Dataset_Title> </Dataset_Citation> } <Parameters> {for $StructuredKeyword in ($DE//(dgStructuredKeyword | dgStdParameterMeasured)[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and ListLevel = 0]) return if (exists($StructuredKeyword/*/dgValidTerm)) then ( <Parameter> {element Category {string($StructuredKeyword/*/dgValidTerm)}} {if (exists($StructuredKeyword//dgValidSubterm) and $StructuredKeyword//dgValidSubterm != '' and $StructuredKeyword//dgValidSubterm != ' ') then ( for $Subterm in $StructuredKeyword//dgValidSubterm[exists(dgValidTerm)] where exists($Subterm/dgValidSubterm) order by $Subterm/ListLevel return if ($Subterm/ListLevel=1) then (element Topic {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=2) then (element Term {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=3) then (element Variable {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=4) then (element Detailed_Variable {string($Subterm/dgValidSubterm/dgValidTerm)}) else (element GCMD_Science_Valid {string($Subterm/dgValidSubterm/dgValidTerm)})))) ) else()} </Parameter> ) else() } </Parameters> {for $ISOTopicCategory in ($DE/dgStructuredKeyword[dgValidTermID/ParentListID='ISO 19115 Topic Category']) return element ISO_Topic_Category {$ISOTopicCategory/dgValidTerm} } {for $Keyword in distinct-values($DE//dgStructuredKeyword[ dgValidTermID/ParentListID!='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and dgValidTermID/ParentListID!='ISO 19115 Topic Category' ]/dgValidTerm) return element Keyword {$Keyword} } {for $DepDPT in ($DE/dgDataEntity/RelatedDeployment/DataProductionToolID) return element Sensor_Name {(for $DepDPTName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/name)) return data($DepDPTName))} } {for $DepObsStn in ($DE/dgDataEntity/RelatedDeployment/ObservationStationID) return element Source_Name {(for $DepObsStnName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/name)) return data($DepObsStnName))} } {for $TemporalRange in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgDateRange) return <Temporal_Coverage> {element Start_Date {data($TemporalRange/DateRangeStart)}} {element End_Date {data($TemporalRange/DateRangeEnd)}} </Temporal_Coverage> } {for $TemporalTerm in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea/dgValidTerm) return element Paleo_Temporal_Coverage { element Chronostratigraphic_Unit {data($TemporalTerm)} } } {for $Data_Set_Progress in ($DE/dgDataEntity/dgDataSummary/dgDataStatus/dgDatasetClosure) return element Data_Set_Progress {$Data_Set_Progress} } {for $BoundingBox in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/BoundingBox) return <Spatial_Coverage> {element Southernmost_Latitude {data($BoundingBox/LimitSouth)}} {element Northernmost_Latitude {data($BoundingBox/LimitNorth)}} {element Westernmost_Latitude {data($BoundingBox/LimitWest)}} {element Easternmost_Latitude {data($BoundingBox/LimitEast)}} </Spatial_Coverage> } {for $Location in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_locations.html']) return element Location {$Location} } {for $DepAct in ($DE/dgDataEntity/RelatedDeployment/ActivityID) return element Project {(for $DepActName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/name)) return data($DepActName))} } {if (exists($DE/dgDataEntity/dgDataGranule/accessControlPolicy)) then ( element Access_Constraints {''} ) else () } {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return <Data_Center> <Data_Center_Name> {element Short_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) ) else ( string($DataCuratorRoleHolder/abbreviation) )} } {element Long_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) ) else (string($DataCuratorRoleHolder/name))} } </Data_Center_Name> {if (exists($DataCuratorRoleHolder/contactDetails/URI)) then ( element Data_Center_URL {data($DataCuratorRoleHolder/contactDetails/URI)} ) else ()} {for $DGID in $DE/dgDataEntity/dgDataGranule/dataModelID return element Data_Set_ID {concat($DGID/repositoryIdentifier, ':', $DGID/schemeIdentifier, ':', $DGID/localIdentifier)} } <Personnel> {element Role {'Data Center Contact'}} {if (exists($DataCuratorRoleHolder/name/knownAs)) then ( element First_Name {string($DataCuratorRoleHolder/name/knownAs)} ) else if (exists($DataCuratorRoleHolder/name/initials)) then ( element First_Name {string($DataCuratorRoleHolder/name/initials)} ) else ()} {element Last_Name {if (exists($DataCuratorRoleHolder/name/familyName)) then ( string($DataCuratorRoleHolder/name/familyName) ) else (string($DataCuratorRoleHolder/name))} } {if (exists($DataCuratorRole/contactDetails/eMail)) then ( element Email {string($DataCuratorRole/contactDetails/eMail)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/eMail)) then ( element Email {string($DataCuratorRoleHolder/contactDetails/eMail)} ) else () )} {if (exists($DataCuratorRole/contactDetails/telephone)) then ( element Phone {string($DataCuratorRole/contactDetails/telephone)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/telephone)) then ( element Phone {string($DataCuratorRoleHolder/contactDetails/telephone)} ) else () )} {if (exists($DataCuratorRole/contactDetails/fax)) then ( element Fax {string($DataCuratorRole/contactDetails/fax)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/fax)) then ( element Fax {string($DataCuratorRoleHolder/contactDetails/fax)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/addressline)) then ( for $addressline in $DataCuratorRole/contactDetails/address/addressline return element address {$addressline} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/addressline)) then ( for $addressline in $DataCuratorRoleHolder/contactDetails/address/addressline return element address {$addressline} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/city)) then ( element City {string($DataCuratorRole/contactDetails/city)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/city)) then ( element Cityl {string($DataCuratorRoleHolder/contactDetails/city)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/postcode)) then ( element Postal_Code {string($DataCuratorRole/contactDetails/postcode)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( element email {string($DataCuratorRoleHolder/contactDetails/postcode)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/country)) then ( element Postal_Code {string($DataCuratorRole/contactDetails/country)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( element Postal_Code {string($DataCuratorRoleHolder/contactDetails/eMail)} ) else () )} </Personnel> </Data_Center> } <Summary>{string($DE/dgMetadataDescription/abstract/abstractText)}</Summary> <Related_URL> {element URL_Content_Type {'NDG_B_SERVICE'}} {element URL {data($DE/dgMetadataID/repositoryIdentifier)}} {element Description {'The NDG service for browsing metadata.'}} </Related_URL> {for $DG in $DE/dgDataEntity/dgDataGranule return if ($DG/dataModelID/schemeIdentifier='NDG-A0') then ( <Related_URL> {element URL_Content_Type {'NDG_A_SERVICE'}} {element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&amp;datasetID=', true())}} {element Description {'The NDG service delivering data via NDG A metadata.'}} </Related_URL> ) else if ($DG/dataModelID/schemeIdentifier='CSML-0') then ( <Related_URL> {element URL_Content_Type {'NDG_A_SERVICE'}} {element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())}} {element Description {'The NDG service delivering data via NDG A metadata.'}} </Related_URL> ) else if ($DG/dataModelID/schemeIdentifier='URI') then ( <Related_URL> {element URL {$DG/instance/URI}} {if (exists($DG/instance/instanceComment)) then ( element Description {$DG/instance/instanceComment} ) else ( element Description {'URL to aid in delivering data. Note that this may point directly to the data or, more likely, point to the web site of the curators.'} ) } </Related_URL> ) else () } <Metadata_Name>[CEOS IDN DIF]</Metadata_Name> {element Metadata_Version {'9.4'}} {if (exists($DE/dgMetadataProvenance/RecordCreation)) then ( element DIF_Creation_Date {$DE/dgMetadataProvenance/RecordCreation/CreatedDate} ) else () } {for $MDUpdt in $DE/dgMetadataProvenance/RecordUpdate return element DIF_Revision_History {concat(data($MDUpdt/UpdateDate), ' - ', data($MDUpdt/UpdateSummary), ' - ', data($MDUpdt/UpdatedBy))} } {if (exists($DE/dgMetadataProvenance/RecordReview)) then ( element Future_DIF_Review_Date {$DE/dgMetadataProvenance/RecordReview/ReviewDate} ) else () } </DIF>"; 
    47         static String DIFQuery123 = "for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <DIF> <Entry_ID>{concat($DE/dgMetadataID/repositoryIdentifier, ':DIF:', $DE/dgMetadataID/localIdentifier)}</Entry_ID> <Entry_Title>{string($DE/name)}</Entry_Title> {for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return <Dataset_Citation> {element Data_Creator {if (exists($DataCreatorRoleHolder/name/initials)) then ( string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName))) ) else ( string($DataCreatorRoleHolder/abbreviation) )} } <Dataset_Title>{string($DE/name)}</Dataset_Title> </Dataset_Citation> } <Parameters> {for $StructuredKeyword in ($DE//(dgStructuredKeyword | dgStdParameterMeasured)[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and ListLevel = 0]) return if (exists($StructuredKeyword/*/dgValidTerm)) then ( <Parameter> {element Category {string($StructuredKeyword/*/dgValidTerm)}} {if (exists($StructuredKeyword//dgValidSubterm) and $StructuredKeyword//dgValidSubterm != '' and $StructuredKeyword//dgValidSubterm != ' ') then ( for $Subterm in $StructuredKeyword//dgValidSubterm[exists(dgValidTerm)] where exists($Subterm/dgValidSubterm) order by $Subterm/ListLevel return if ($Subterm/ListLevel=1) then (element Topic {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=2) then (element Term {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=3) then (element Variable {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=4) then (element Detailed_Variable {string($Subterm/dgValidSubterm/dgValidTerm)}) else (element GCMD_Science_Valid {string($Subterm/dgValidSubterm/dgValidTerm)})))) ) else()} </Parameter> ) else() } </Parameters> {for $ISOTopicCategory in ($DE/dgStructuredKeyword[dgValidTermID/ParentListID='ISO 19115 Topic Category']) return element ISO_Topic_Category {$ISOTopicCategory/dgValidTerm} } {for $Keyword in distinct-values($DE//dgStructuredKeyword[ dgValidTermID/ParentListID!='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and dgValidTermID/ParentListID!='ISO 19115 Topic Category' ]/dgValidTerm) return element Keyword {$Keyword} } {for $DepDPT in ($DE/dgDataEntity/RelatedDeployment/DataProductionToolID) return element Sensor_Name {(for $DepDPTName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/name)) return data($DepDPTName))} } {for $DepObsStn in ($DE/dgDataEntity/RelatedDeployment/ObservationStationID) return element Source_Name {(for $DepObsStnName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/name)) return data($DepObsStnName))} } {for $TemporalRange in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgDateRange) return <Temporal_Coverage> {element Start_Date {data($TemporalRange/DateRangeStart)}} {element End_Date {data($TemporalRange/DateRangeEnd)}} </Temporal_Coverage> } {for $TemporalTerm in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea/dgValidTerm) return element Paleo_Temporal_Coverage { element Chronostratigraphic_Unit {data($TemporalTerm)} } } {for $Data_Set_Progress in ($DE/dgDataEntity/dgDataSummary/dgDataStatus/dgDatasetClosure) return element Data_Set_Progress {$Data_Set_Progress} } {for $BoundingBox in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/BoundingBox) return <Spatial_Coverage> {element Southernmost_Latitude {data($BoundingBox/LimitSouth)}} {element Northernmost_Latitude {data($BoundingBox/LimitNorth)}} {element Westernmost_Latitude {data($BoundingBox/LimitWest)}} {element Easternmost_Latitude {data($BoundingBox/LimitEast)}} </Spatial_Coverage> } {for $Location in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_locations.html']) return element Location {$Location} } {for $DepAct in ($DE/dgDataEntity/RelatedDeployment/ActivityID) return element Project {(for $DepActName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/name)) return data($DepActName))} } {if (exists($DE/dgDataEntity/dgDataGranule/accessControlPolicy)) then ( element Access_Constraints {''} ) else () } {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return <Data_Center> <Data_Center_Name> {element Short_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) ) else ( string($DataCuratorRoleHolder/abbreviation) )} } {element Long_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) ) else (string($DataCuratorRoleHolder/name))} } </Data_Center_Name> {if (exists($DataCuratorRoleHolder/contactDetails/URI)) then ( element Data_Center_URL {data($DataCuratorRoleHolder/contactDetails/URI)} ) else ()} {for $DGID in $DE/dgDataEntity/dgDataGranule/dataModelID return element Data_Set_ID {concat($DGID/repositoryIdentifier, ':', $DGID/schemeIdentifier, ':', $DGID/localIdentifier)} } <Personnel> {element Role {'Data Center Contact'}} {if (exists($DataCuratorRoleHolder/name/knownAs)) then ( element First_Name {string($DataCuratorRoleHolder/name/knownAs)} ) else if (exists($DataCuratorRoleHolder/name/initials)) then ( element First_Name {string($DataCuratorRoleHolder/name/initials)} ) else ()} {element Last_Name {if (exists($DataCuratorRoleHolder/name/familyName)) then ( string($DataCuratorRoleHolder/name/familyName) ) else (string($DataCuratorRoleHolder/name))} } {if (exists($DataCuratorRole/contactDetails/eMail)) then ( element Email {string($DataCuratorRole/contactDetails/eMail)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/eMail)) then ( element Email {string($DataCuratorRoleHolder/contactDetails/eMail)} ) else () )} {if (exists($DataCuratorRole/contactDetails/telephone)) then ( element Phone {string($DataCuratorRole/contactDetails/telephone)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/telephone)) then ( element Phone {string($DataCuratorRoleHolder/contactDetails/telephone)} ) else () )} {if (exists($DataCuratorRole/contactDetails/fax)) then ( element Fax {string($DataCuratorRole/contactDetails/fax)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/fax)) then ( element Fax {string($DataCuratorRoleHolder/contactDetails/fax)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/addressline)) then ( for $addressline in $DataCuratorRole/contactDetails/address/addressline return element address {$addressline} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/addressline)) then ( for $addressline in $DataCuratorRoleHolder/contactDetails/address/addressline return element address {$addressline} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/city)) then ( element City {string($DataCuratorRole/contactDetails/city)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/city)) then ( element Cityl {string($DataCuratorRoleHolder/contactDetails/city)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/postcode)) then ( element Postal_Code {string($DataCuratorRole/contactDetails/postcode)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( element email {string($DataCuratorRoleHolder/contactDetails/postcode)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/country)) then ( element Postal_Code {string($DataCuratorRole/contactDetails/country)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( element Postal_Code {string($DataCuratorRoleHolder/contactDetails/eMail)} ) else () )} </Personnel> </Data_Center> } <Summary>{string($DE/dgMetadataDescription/abstract/abstractText)}</Summary> <Related_URL> {element URL_Content_Type {'NDG_B_SERVICE'}} {element URL {data($DE/dgMetadataID/repositoryIdentifier)}} {element Description {'The NDG service for browsing metadata.'}} </Related_URL> {for $DG in $DE/dgDataEntity/dgDataGranule return if ($DG/dataModelID/schemeIdentifier='NDG-A0') then ( <Related_URL> {element URL_Content_Type {'NDG_A_SERVICE'}} {element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&amp;datasetID=', true())}} {element Description {'The NDG service delivering data via NDG A metadata.'}} </Related_URL> ) else if ($DG/dataModelID/schemeIdentifier='CSML-0') then ( <Related_URL> {element URL_Content_Type {'NDG_A_SERVICE'}} {element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())}} {element Description {'The NDG service delivering data via NDG A metadata.'}} </Related_URL> ) else if ($DG/dataModelID/schemeIdentifier='URI') then ( <Related_URL> {element URL {$DG/instance/URI}} {if (exists($DG/instance/instanceComment)) then ( element Description {$DG/instance/instanceComment} ) else ( element Description {'URL to aid in delivering data. Note that this may point directly to the data or, more likely, point to the web site of the curators.'} ) } </Related_URL> ) else () } <Metadata_Name>[CEOS IDN DIF]</Metadata_Name> {element Metadata_Version {'9.4'}} {if (exists($DE/DataProvenance/RecordCreation)) then ( element DIF_Creation_Date {$DE/DataProvenance/RecordCreation/CreatedDate} ) else () } {for $MDUpdt in $DE/DataProvenance/RecordUpdate return element DIF_Revision_History {concat(data($MDUpdt/UpdateDate), ' - ', data($MDUpdt/UpdateSummary), ' - ', data($MDUpdt/UpdatedBy))} } {if (exists($DE/DataProvenance/RecordReview)) then ( element Future_DIF_Review_Date {$DE/DataProvenance/RecordReview/ReviewDate} ) else () } </DIF>"; 
    48    
     45        static String DublinCoreDEQuery = "declare namespace dc='http://purl.org/dc/elements/1.1/'; declare namespace oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc'; for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgDataEntity!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <oai_dc:dc xmlns:oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc/' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'> <dc:title>{string($DE/name)}</dc:title> <dc:type>Dataset</dc:type> <dc:identifier>{concat($DE/dgMetadataID/repositoryIdentifier, ':DC:', $DE/dgMetadataID/localIdentifier)}</dc:identifier> <dc:description>{string($DE/dgMetadataDescription/abstract/abstractText)}</dc:description> {for $StructuredKeyword in distinct-values($DE/dgStructuredKeyword [dgValidTermID/ParentListID='http://www.cgd.ucar.edu/cms/eaton/cf-metadata/standard_name.html' or dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' or dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/projects.html']//dgValidTerm) order by $StructuredKeyword return <dc:subject> {string($StructuredKeyword)} </dc:subject> } {for $StructuredKeyword1 in distinct-values($DE/dgDataEntity/dgDataSummary/dgParameterSummary/dgStdParameterMeasured[dgValidTermID/ParentListID='http://www.cgd.ucar.edu/cms/eaton/cf-metadata/standard_name.html' or dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' or dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/projects.html']//dgValidTerm) order by $StructuredKeyword1 return <dc:subject> {string($StructuredKeyword1)} </dc:subject> } {for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder order by $DataCreatorRole/startDate empty least, $DataCreatorRole/endDate empty least return for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/(dgOrganisation | dgPerson)[((not(exists($DataCreatorRole/endDate)) or empty($DataCreatorRole/endDate)) and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return <dc:creator> {if (string(local-name($DataCreatorRoleHolder))='dgOrganisation') then (string($DataCreatorRoleHolder/name)) else if (string(local-name($DataCreatorRoleHolder))='dgPerson') then (string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName)))) else ('empty content')} </dc:creator> } {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[empty(endDate)] order by $DataCuratorRole/startDate empty least return for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/(dgOrganisation | dgPerson)[((not(exists($DataCuratorRole/endDate)) or empty($DataCuratorRole/endDate)) and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return <dc:publisher> {if (string(local-name($DataCuratorRoleHolder))='dgOrganisation') then (string($DataCuratorRoleHolder/name)) else if (string(local-name($DataCuratorRoleHolder))='dgPerson') then (string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName)))) else ('empty content')} </dc:publisher> } </oai_dc:dc>"; 
     46        static String DIFQuery = "for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <DIF xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/' xsi:schemaLocation='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/ http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/dif_v9.4.xsd'> <Entry_ID>{concat($DE/dgMetadataID/repositoryIdentifier, ':DIF:', $DE/dgMetadataID/localIdentifier)}</Entry_ID> <Entry_Title>{string($DE/name)}</Entry_Title> {for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return <Dataset_Citation> {element Data_Creator {if (exists($DataCreatorRoleHolder/name/initials)) then ( string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName))) ) else ( string($DataCreatorRoleHolder/abbreviation) )} } <Dataset_Title>{string($DE/name)}</Dataset_Title> </Dataset_Citation> } {for $StructuredKeyword in ($DE//(dgStructuredKeyword | dgStdParameterMeasured)[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and ListLevel = 0]) return if (exists($StructuredKeyword/*/dgValidTerm)) then ( <Parameters> {element Category {string($StructuredKeyword/*/dgValidTerm)}} {if (exists($StructuredKeyword//dgValidSubterm) and $StructuredKeyword//dgValidSubterm != '' and $StructuredKeyword//dgValidSubterm != ' ') then ( for $Subterm in $StructuredKeyword//dgValidSubterm[exists(dgValidTerm)] where exists($Subterm/dgValidSubterm) order by $Subterm/ListLevel return if ($Subterm/ListLevel=1) then (element Topic {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=2) then (element Term {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=3) then (element Variable {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=4) then (element Detailed_Variable {string($Subterm/dgValidSubterm/dgValidTerm)}) else (element GCMD_Science_Valid {string($Subterm/dgValidSubterm/dgValidTerm)})))) ) else()} </Parameters> ) else() } {for $ISOTopicCategory in ($DE/dgStructuredKeyword[dgValidTermID/ParentListID='ISO 19115 Topic Category']) return element ISO_Topic_Category {string($ISOTopicCategory/dgValidTerm)} } {for $Keyword in distinct-values($DE//dgStructuredKeyword[ dgValidTermID/ParentListID!='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and dgValidTermID/ParentListID!='ISO 19115 Topic Category' ]/dgValidTerm) return element Keyword {string($Keyword)} } {for $DepDPT in ($DE/dgDataEntity/RelatedDeployment/DataProductionToolID) return <Sensor_Name> {for $DepDPTAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/abbreviation)) return element Short_Name {data($DepDPTAbbrev)}} {for $DepDPTName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/name)) return element Long_Name {data($DepDPTName)} } </Sensor_Name> } {for $DepObsStn in ($DE/dgDataEntity/RelatedDeployment/ObservationStationID) return <Source_Name> {for $DepObsStnAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/abbreviation)) return <Short_Name>{data($DepObsStnAbbrev)}</Short_Name>} {for $DepObsStnName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/name)) return <Long_Name>{data($DepObsStnName)}</Long_Name>} </Source_Name> } {for $TemporalRange in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgDateRange) return <Temporal_Coverage> {element Start_Date {data($TemporalRange/DateRangeStart)}} {element End_Date {data($TemporalRange/DateRangeEnd)}} </Temporal_Coverage> } {for $TemporalTerm in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea/dgValidTerm) return element Paleo_Temporal_Coverage { element Chronostratigraphic_Unit {data($TemporalTerm)} } } {for $Data_Set_Progress in ($DE/dgDataEntity/dgDataSummary/dgDataStatus/dgDatasetClosure) return element Data_Set_Progress {$Data_Set_Progress} } {for $BoundingBox in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/BoundingBox) return <Spatial_Coverage> {element Southernmost_Latitude {data($BoundingBox/LimitSouth)}} {element Northernmost_Latitude {data($BoundingBox/LimitNorth)}} {element Westernmost_Longitude {data($BoundingBox/LimitWest)}} {element Easternmost_Longitude {data($BoundingBox/LimitEast)}} </Spatial_Coverage> } {for $Location in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_locations.html']) return element Location {$Location} } {for $DepAct in ($DE/dgDataEntity/RelatedDeployment/ActivityID) return <Project> {for $DepActAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/abbreviation)) return <Short_Name>{data($DepActAbbrev)}</Short_Name>} {for $DepActName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/name)) return <Long_Name>{data($DepActName)}</Long_Name>} </Project> } {if (exists($DE/dgDataEntity/dgDataGranule/accessControlPolicy)) then ( element Access_Constraints {''} ) else () } {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return <Data_Center> <Data_Center_Name> {element Short_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) ) else ( string($DataCuratorRoleHolder/abbreviation) )} } {element Long_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) ) else (string($DataCuratorRoleHolder/name))} } </Data_Center_Name> {if (exists($DataCuratorRoleHolder/contactDetails/URI)) then ( element Data_Center_URL {data($DataCuratorRoleHolder/contactDetails/URI)} ) else ()} {for $DGID in $DE/dgDataEntity/dgDataGranule/dataModelID return element Data_Set_ID {concat($DGID/repositoryIdentifier, ':', $DGID/schemeIdentifier, ':', $DGID/localIdentifier)} } <Personnel> {element Role {'Data Center Contact'}} {if (exists($DataCuratorRoleHolder/name/knownAs)) then ( element First_Name {string($DataCuratorRoleHolder/name/knownAs)} ) else if (exists($DataCuratorRoleHolder/name/initials)) then ( element First_Name {string($DataCuratorRoleHolder/name/initials)} ) else ()} {element Last_Name {if (exists($DataCuratorRoleHolder/name/familyName)) then ( string($DataCuratorRoleHolder/name/familyName) ) else (string($DataCuratorRoleHolder/name))} } {if (exists($DataCuratorRole/contactDetails/eMail)) then ( element Email {string($DataCuratorRole/contactDetails/eMail)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/eMail)) then ( element Email {string($DataCuratorRoleHolder/contactDetails/eMail)} ) else () )} {if (exists($DataCuratorRole/contactDetails/telephone)) then ( element Phone {string($DataCuratorRole/contactDetails/telephone)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/telephone)) then ( element Phone {string($DataCuratorRoleHolder/contactDetails/telephone)} ) else () )} {if (exists($DataCuratorRole/contactDetails/fax)) then ( element Fax {string($DataCuratorRole/contactDetails/fax)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/fax)) then ( element Fax {string($DataCuratorRoleHolder/contactDetails/fax)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/addressline)) then ( for $addressline in $DataCuratorRole/contactDetails/address/addressline return element address {$addressline} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/addressline)) then ( for $addressline in $DataCuratorRoleHolder/contactDetails/address/addressline return element address {$addressline} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/city)) then ( element City {string($DataCuratorRole/contactDetails/city)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/city)) then ( element Cityl {string($DataCuratorRoleHolder/contactDetails/city)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/postcode)) then ( element Postal_Code {string($DataCuratorRole/contactDetails/postcode)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( element email {string($DataCuratorRoleHolder/contactDetails/postcode)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/country)) then ( element Postal_Code {string($DataCuratorRole/contactDetails/country)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( element Postal_Code {string($DataCuratorRoleHolder/contactDetails/eMail)} ) else () )} </Personnel> </Data_Center> } <Summary>{string($DE/dgMetadataDescription/abstract/abstractText)}</Summary> <Related_URL> {element URL_Content_Type {'NDG_B_SERVICE'}} {element URL {data($DE/dgMetadataID/repositoryIdentifier)}} {element Description {'The NDG service for browsing metadata.'}} </Related_URL> {for $DG in $DE/dgDataEntity/dgDataGranule return if ($DG/dataModelID/schemeIdentifier='NDG-A0') then ( <Related_URL> {element URL_Content_Type {'NDG_A_SERVICE'}} {element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&amp;datasetID=', true())}} {element Description {'The NDG service delivering data via NDG A metadata.'}} </Related_URL> ) else if ($DG/dataModelID/schemeIdentifier='CSML-0') then ( <Related_URL> {element URL_Content_Type {'NDG_A_SERVICE'}} {element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())}} {element Description {'The NDG service delivering data via NDG A metadata.'}} </Related_URL> ) else if ($DG/dataModelID/schemeIdentifier='URI') then ( <Related_URL> {element URL {data($DG/instance/URI)}} {if (exists($DG/instance/instanceComment)) then ( element Description {data($DG/instance/instanceComment)} ) else ( element Description {'URL to aid in delivering data. Note that this may point directly to the data or, more likely, point to the web site of the curators.'} ) } </Related_URL> ) else () } <Metadata_Name>[CEOS IDN DIF]</Metadata_Name> {element Metadata_Version {'9.4'}} {if (exists($DE/dgMetadataProvenance/RecordCreation)) then ( element DIF_Creation_Date {data($DE/dgMetadataProvenance/RecordCreation/CreatedDate)} ) else () } {for $MDUpdt in $DE/dgMetadataProvenance/RecordUpdate return element DIF_Revision_History {concat(data($MDUpdt/UpdateDate), ' - ', data($MDUpdt/UpdateSummary), ' - ', data($MDUpdt/UpdatedBy))} } {if (exists($DE/dgMetadataProvenance/RecordReview)) then ( element Future_DIF_Review_Date {data($DE/dgMetadataProvenance/RecordReview/ReviewDate)} ) else () } </DIF>"; 
    4947 
    5048        private static String getNamedParam(String paramName, String[] args) { 
     
    113111                 */ 
    114112        outputType = getNamedParam("format", args); 
    115         if (outputType == "") { 
    116                 user = DefaultUserID; 
    117             } 
     113 
    118114        eXistService = getNamedParam("repository", args); 
    119115        if (eXistService == "") { 
     
    300296                                                xquery = DIFQuery; 
    301297                                                } 
    302                                         else if (outputType.equals("oldDIF")) { 
    303                                                 xquery = DIFQuery123; 
    304                                                 } 
    305298                                        else if (outputType.equals("ISO19115")) {;} 
    306299                                         
  • TI07-MOLES/trunk/JavaCode/returnmolesxmldb/ndg/services/returnmoles/Main.java

    r967 r1276  
    2424        static String ObjectTypeQuery = "for $Obj in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID']  return <objectType>{if (exists($Obj/dgDataEntity)) then 4 else (if (exists($Obj/dgObservationStation)) then 3 else (if (exists($Obj/dgDataProductionTool)) then 2 else (if (exists($Obj/dgActivity)) then 1 else (0))))}</objectType>"; 
    2525        static String StubBDEQuery = "for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier='RepositoryID' and localIdentifier='LocalID']] return <dgMetadataRecord> <dgMetadataID> <schemeIdentifier>NDG-B1</schemeIdentifier> {$DE/dgMetadataID/repositoryIdentifier} {$DE/dgMetadataID/localIdentifier} </dgMetadataID> {$DE/dgMetadataDescription} {$DE/name} {$DE/abbreviation} <dgDataEntity> {$DE/dgDataEntity/dgDataSetType} {$DE/dgDataEntity/dgDataObjectType} {$DE/dgDataEntity/dgDataGranule} {$DE/dgDataEntity/dgDataSummary} <dgDataRoles> {if (exists($DE/dgDataEntity/dgDataRoles/dgDataCreator/dgMetadataID)) then ( <dgDataCreator> {$DE/dgDataEntity/dgDataRoles/dgDataCreator/dgMetadataID} {$DE/dgDataEntity/dgDataRoles/dgDataCreator/roleName} {$DE/dgDataEntity/dgDataRoles/dgDataCreator/abbreviation} {$DE/dgDataEntity/dgDataRoles/dgDataCreator/contactDetails} {for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder order by $DataCreatorRole/startDate empty least, $DataCreatorRole/endDate empty least return <dgRoleHolder> {if (exists($DataCreatorRole/dgOrganisationID)) then ( for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgOrganisation[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DataCreatorRole/dgOrganisationID/repositoryIdentifier and localIdentifier=$DataCreatorRole/dgOrganisationID/localIdentifier]] return $DataCreatorRoleHolder) else () } {if (exists($DataCreatorRole/dgPersonID)) then ( for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgPerson[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DataCreatorRole/dgPersonID/repositoryIdentifier and localIdentifier=$DataCreatorRole/dgPersonID/localIdentifier]] return $DataCreatorRoleHolder) else () } {$DataCreatorRole/startDate} {$DataCreatorRole/endDate} {$DataCreatorRole/localName} </dgRoleHolder> } </dgDataCreator>) else ()} {if (exists($DE/dgDataEntity/dgDataRoles/dgDataCurator/dgMetadataID)) then ( <dgDataCurator> {$DE/dgDataEntity/dgDataRoles/dgDataCurator/dgMetadataID} {$DE/dgDataEntity/dgDataRoles/dgDataCurator/roleName} {$DE/dgDataEntity/dgDataRoles/dgDataCurator/abbreviation} {$DE/dgDataEntity/dgDataRoles/dgDataCurator/contactDetails} {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder order by $DataCuratorRole/startDate empty least, $DataCuratorRole/endDate empty least return <dgRoleHolder> {if (exists($DataCuratorRole/dgOrganisationID)) then ( for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgOrganisation[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DataCuratorRole/dgOrganisationID/repositoryIdentifier and localIdentifier=$DataCuratorRole/dgOrganisationID/localIdentifier]] return $DataCuratorRoleHolder) else () } {if (exists($DataCuratorRole/dgPersonID)) then ( for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgPerson[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DataCuratorRole/dgPersonID/repositoryIdentifier and localIdentifier=$DataCuratorRole/dgPersonID/localIdentifier]] return $DataCuratorRoleHolder) else () } {$DataCuratorRole/startDate} {$DataCuratorRole/endDate} {$DataCuratorRole/localName} </dgRoleHolder>} </dgDataCurator>) else ()} {if (exists($DE/dgDataEntity/dgDataRoles/dgDataOtherRoles/dgMetadataID)) then ( <dgDataOtherRoles> {$DE/dgDataEntity/dgDataRoles/dgDataOtherRoles/dgMetadataID} {$DE/dgDataEntity/dgDataRoles/dgDataOtherRoles/roleName} {$DE/dgDataEntity/dgDataRoles/dgDataOtherRoles/abbreviation} {$DE/dgDataEntity/dgDataRoles/dgDataOtherRoles/contactDetails} {for $DataOtherRolesRole in $DE/dgDataEntity/dgDataRoles/dgDataOtherRoles/dgRoleHolder order by $DataOtherRolesRole/startDate empty least, $DataOtherRolesRole/endDate empty least return <dgRoleHolder> {if (exists($DataOtherRolesRole/dgOrganisationID)) then ( for $DataOtherRolesRoleHolder in /dgMetadata/dgOrganisation[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DataOtherRolesRole/dgOrganisationID/repositoryIdentifier and localIdentifier=$DataOtherRolesRole/dgOrganisationID/localIdentifier]] return $DataOtherRolesRoleHolder) else () } {if (exists($DataOtherRolesRole/dgPersonID)) then ( for $DataOtherRolesRoleHolder in /dgMetadata/dgPerson[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DataOtherRolesRole/dgPersonID/repositoryIdentifier and localIdentifier=$DataOtherRolesRole/dgPersonID/localIdentifier]] return $DataOtherRolesRoleHolder) else () } {$DataOtherRolesRole/startDate} {$DataOtherRolesRole/endDate} {$DataOtherRolesRole/localName} </dgRoleHolder>} </dgDataOtherRoles>) else ()} </dgDataRoles> {for $RelDep in $DE/dgDataEntity/RelatedDeployment return <RelatedDeployment> {$RelDep/DateStart} {$RelDep/DateEnd} {$RelDep/dgMetadataID} {for $SRAct in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$RelDep/ActivityID/repositoryIdentifier and localIdentifier=$RelDep/ActivityID/localIdentifier]] return <activity> {$SRAct/dgMetadataID} {$SRAct/dgMetadataDescription} {$SRAct/name} {$SRAct/abbreviation} <dgActivity> {$SRAct/dgActivity/dgActivityDataCollection} {$SRAct/dgActivity/dgActivityDataProject} {$SRAct/dgActivity/dgActivityDataCampaign} {$SRAct/dgActivity/dgActivityDataInvestigation} {$SRAct/dgActivity/dgActivityCoverage} {$SRAct/dgActivity/dgActivityDuration} </dgActivity> </activity> } {for $SRDPT in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$RelDep/DataProductionToolID/repositoryIdentifier and localIdentifier=$RelDep/DataProductionToolID/localIdentifier]] return <dataproductiontool> {$SRDPT/dgMetadataID} {$SRDPT/dgMetadataDescription} {$SRDPT/name} {$SRDPT/abbreviation} <dgDataProductionTool> {$SRDPT/dgDataProductionTool/contactDetails} {$SRDPT/dgDataProductionTool/dgModel} {$SRDPT/dgDataProductionTool/dgInstrument} </dgDataProductionTool> </dataproductiontool> } {for $SRObsStn in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$RelDep/ObservationStationID/repositoryIdentifier and localIdentifier=$RelDep/ObservationStationID/localIdentifier]] return <observationstation> {$SRObsStn/dgMetadataID} {$SRObsStn/dgMetadataDescription} {$SRObsStn/name} {$SRObsStn/abbreviation} <dgObservationStation> {$SRObsStn/dgObservationStation/contactDetails} {$SRObsStn/dgObservationStation/dgStationaryPlatform} {$SRObsStn/dgObservationStation/dgMovingPlatform} </dgObservationStation> </observationstation> } {$RelDep/Coverage} </RelatedDeployment> } {for $RelatedDataGranule in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DE/dgRelatedDataGranuleID/dgRelatedDataGranuleID/repositoryIdentifier and localIdentifier=$DE/dgRelatedDataGranuleID/RelatedDataGranuleID/localIdentifier]] return <relateddatagranule> <relation> {$RelatedDataGranule/RelationID/dgValidTerm} {$RelatedDataGranule/RelationID/dgValidTermID} </relation> {$RelatedDataGranule/dgMetadataID} {$RelatedDataGranule/dgMetadataDescription} {$RelatedDataGranule/name} {$RelatedDataGranule/abbreviation} <dgDataEntity> {$RelatedDataGranule/dgDataEntity/dgDataSetType} {$RelatedDataGranule/dgDataEntity/dgDataObjectType} {$DE/dgDataEntity/dgDataGranule} {$DE/dgDataEntity/dgDataSummary} </dgDataEntity> </relateddatagranule> } </dgDataEntity> {$DE/dgStructuredKeyword} {$DE/DataProvenance} {$DE/MetadataSecurity} </dgMetadataRecord>"; 
    26         static String StubBActQuery = "for $Act in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgActivity!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='badc.nerc.ac.uk' and dgMetadataID/localIdentifier='activity3'] return <dgMetadataRecord> <dgMetadataID> <schemeIdentifier>NDG-B1</schemeIdentifier> {$Act/dgMetadataID/repositoryIdentifier} {$Act/dgMetadataID/localIdentifier} </dgMetadataID> {$Act/dgMetadataDescription} {$Act/name} {$Act/abbreviation} <dgActivity> {for $RelatedActivities in $Act/dgActivity/relatedActivity for $RelatedActivity in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelatedActivities/relatedActivityID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelatedActivities/relatedActivityID/localIdentifier] return <relatedActivity> {$RelatedActivities/relatedActivityID} {$RelatedActivity/name} {$RelatedActivity/abbreviation} {$RelatedActivities/activityRelation} </relatedActivity> } {$Act/dgActivityDataCollection} {$Act/dgActivityDataProject} {$Act/dgActivityDataCollection} {$Act/dgActivityDataInvestigation} <dgActivityRole> <dgInvestigator> <dgPrincipalInvestigator> {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/dgMetadataID} {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/roleName} {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/abbreviation} {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/contactDetails} {for $PIRole in $Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/dgRoleHolder order by $PIRole/startDate empty least, $PIRole/endDate empty least return <dgRoleHolder> {if (exists($PIRole/dgOrganisationID)) then ( for $PIRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgOrganisation[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$PIRole/dgOrganisationID/repositoryIdentifier and localIdentifier=$PIRole/dgOrganisationID/localIdentifier]] return $PIRoleHolder) else () } {if (exists($PIRole/dgPersonID)) then ( for $PIRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgPerson[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$PIRole/dgPersonID/repositoryIdentifier and localIdentifier=$PIRole/dgPersonID/localIdentifier]] return $PIRoleHolder) else () } {$PIRole/startDate} {$PIRole/endDate} {$PIRole/localName} </dgRoleHolder> } </dgPrincipalInvestigator> {for $CI in $Act/dgActivity/dgActivityRole/dgInvestigator/dgCoInvestigator return <dgCoInvestigator> {$CI/dgMetadataID} {$CI/roleName} {$CI/abbreviation} {$CI/contactDetails} {for $CIRole in $CI/dgRoleHolder order by $CIRole/startDate empty least, $CIRole/endDate empty least return <dgRoleHolder> {if (exists($CIRole/dgOrganisationID)) then ( for $CIRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgOrganisation[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$CIRole/dgOrganisationID/repositoryIdentifier and localIdentifier=$CIRole/dgOrganisationID/localIdentifier]] return $CIRoleHolder) else () } {if (exists($CIRole/dgPersonID)) then ( for $CIRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgPerson[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$CIRole/dgPersonID/repositoryIdentifier and localIdentifier=$CIRole/dgPersonID/localIdentifier]] return $CIRoleHolder) else () } {$CIRole/startDate} {$CIRole/endDate} {$CIRole/localName} </dgRoleHolder> } </dgCoInvestigator> } </dgInvestigator> {if (exists($Act/dgActivity/dgActivityRole/dgTechnicalContact)) then ( <dgTechnicalContact> {$Act/dgActivity/dgActivityRole/dgTechnicalContact/dgMetadataID} {$Act/dgActivity/dgActivityRole/dgTechnicalContact/roleName} {$Act/dgActivity/dgActivityRole/dgTechnicalContact/abbreviation} {$Act/dgActivity/dgActivityRole/dgTechnicalContact/contactDetails} {for $TechConRole in $Act/dgActivity/dgActivityRole/dgTechnicalContact/dgRoleHolder order by $TechConRole/startDate empty least, $TechConRole/endDate empty least return <dgRoleHolder> {for $TechConRoleHolder in /*/(dgOrganisation | dgPerson)[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$TechConRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$TechConRole/*/localIdentifier)] return $TechConRoleHolder} {$TechConRole/startDate} {$TechConRole/endDate} {$TechConRole/localName} </dgRoleHolder>} </dgTechnicalContact> ) else () } {if (exists($Act/dgActivity/dgActivityRole/dgProjectManager)) then ( <dgProjectManager> {$Act/dgActivity/dgActivityRole/dgProjectManager/dgMetadataID} {$Act/dgActivity/dgActivityRole/dgProjectManager/roleName} {$Act/dgActivity/dgActivityRole/dgProjectManager/abbreviation} {$Act/dgActivity/dgActivityRole/dgProjectManager/contactDetails} {for $PMRole in $Act/dgActivity/dgActivityRole/dgProjectManager/dgRoleHolder order by $PMRole/startDate empty least, $PMRole/endDate empty least return <dgRoleHolder> {for $PMRoleHolder in /*/(dgOrganisation | dgPerson)[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$PMRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$PMRole/*/localIdentifier)] return $PMRoleHolder} {$PMRole/startDate} {$PMRole/endDate} {$PMRole/localName} </dgRoleHolder>} </dgProjectManager> ) else () } </dgActivityRole> {for $RelDep in $Act/dgActivity/ActivityDeployment return <ActivityDeployment> {$RelDep/DateStart} {$RelDep/DateEnd} {$RelDep/dgMetadataID} {for $SRDPT in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/DataProductionToolID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/DataProductionToolID/localIdentifier)] return <dataproductiontool> {$SRDPT/dgMetadataID} {$SRDPT/dgMetadataDescription} {$SRDPT/name} {$SRDPT/abbreviation} <dgDataProductionTool> {$SRDPT/dgDataProductionTool/contactDetails} {$SRDPT/dgDataProductionTool/dgModel} {$SRDPT/dgDataProductionTool/dgInstrument} </dgDataProductionTool> </dataproductiontool> } {for $SRObsStn in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/ObservationStationID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ObservationStationID/localIdentifier)] return <observationstation> {$SRObsStn/dgMetadataID} {$SRObsStn/dgMetadataDescription} {$SRObsStn/name} {$SRObsStn/abbreviation} <dgObservationStation> {$SRObsStn/dgObservationStation/contactDetails} {$SRObsStn/dgObservationStation/dgStationaryPlatform} {$SRObsStn/dgObservationStation/dgMovingPlatform} </dgObservationStation> </observationstation> } {for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgDataEntity/RelatedDeployment/dgMetadataID/repositoryIdentifier=$RelDep/dgMetadataID/repositoryIdentifier and dgDataEntity/RelatedDeployment/dgMetadataID/localIdentifier=$RelDep/dgMetadataID/localIdentifier]return <dataentity> {$DE/dgMetadataID} {$DE/dgMetadataDescription} {$DE/name} {$DE/abbreviation} <dgDataEntity> {$DE/dgDataEntity/dgDataSetType} {$DE/dgDataEntity/dgDataObjectType} {$DE/dgDataEntity/dgDataGranule} {$DE/dgDataEntity/dgDataSummary} </dgDataEntity> </dataentity> } </ActivityDeployment> } {$Act/dgActivityCoverage} {$Act/ActivityDuration} </dgActivity> {$Act/dgStructuredKeyword} {$Act/DataProvenance} {$Act/MetadataSecurity} </dgMetadataRecord>"; 
    27         static String StubBDPTQuery = "for $DPT in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgDataProductionTool!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <dgMetadataRecord> {$DPT/dgMetadataID}{$DPT/dgMetadataDescription}{$DPT/name}{$DPT/abbreviation}<dgDataProductionTool> {$DPT/contactDetails}{if (exists($DPT/dgDPTRoles)) then ( <dgDPTRoles>Roles are available, and will be added soon</dgDPTRoles> ) else() }{for $RelDep in $DPT//DPTDeployment return <DPTDeployment> {$RelDep/DateStart}{$RelDep/DateEnd}{$RelDep/dgMetadataID}{for $SRAct in collection('/db/ndg_B_metadata')//dgMetadataRecord[(dgMetadataID/repositoryIdentifier=$RelDep/ActivityID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ActivityID/localIdentifier)] return <activity> {$SRAct/dgMetadataID}{$SRAct/dgMetadataDescription}{$SRAct/name}{$SRAct/abbreviation}<dgActivity> {$SRAct/*/dgActivityDataCollection}{$SRAct/*/dgActivityDataProject}{$SRAct/*/dgActivityDataCampaign}{$SRAct/*/dgActivityDataInvestigation}{$SRAct/*/dgActivityCoverage}{$SRAct/*/dgActivityDuration}</dgActivity> </activity> }{for $SRObsStn in collection('/db/ndg_B_metadata')//dgMetadataRecord[(dgMetadataID/repositoryIdentifier=$RelDep/ObservationStationID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ObservationStationID/localIdentifier)] return <observationstation> {$SRObsStn/dgMetadataID}{$SRObsStn/dgMetadataDescription}{$SRObsStn/name}{$SRObsStn/abbreviation}<dgObservationStation> {$SRObsStn/dgObservationStation/contactDetails}{$SRObsStn/dgObservationStation/dgStationaryPlatform}{$SRObsStn/dgObservationStation/dgMovingPlatform}</dgObservationStation> </observationstation> }{for $DE in collection('/db/ndg_B_metadata')//dgMetadataRecord[dgDataEntity/RelatedDeployment/dgMetadataID/repositoryIdentifier=$RelDep/dgMetadataID/repositoryIdentifier and dgDataEntity/RelatedDeployment/dgMetadataID/localIdentifier=$RelDep/dgMetadataID/localIdentifier] return <dataEntity> {$DE/dgMetadataID}{$DE/dgMetadataDescription}{$DE/name}{$DE/abbreviation}<dgDataEntity> {$DE/dgDataEntity/dgDataSetType}{$DE/dgDataEntity/dgDataObjectType}{$DE/dgDataEntity/dgDataGranule}{$DE/dgDataEntity/dgDataSummary}<dgDataRoles> <dgDataCurator> {$DE/dgDataEntity/dgDataRoles/dgDataCurator/dgMetadataID}{$DE/dgDataEntity/dgDataRoles/dgDataCurator/roleName}{$DE/dgDataEntity/dgDataRoles/dgDataCurator/abbreviation}{$DE/dgDataEntity/dgDataRoles/dgDataCurator/contactDetails}{for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder  order by $DataCuratorRole/startDate empty least, $DataCuratorRole/endDate empty least return  <dgRoleHolder> {for $DataCuratorRoleHolder in /*/(dgOrganisation | dgPerson)[(dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return $DataCuratorRoleHolder}{$DataCuratorRole/startDate}{$DataCuratorRole/endDate}{$DataCuratorRole/localName}</dgRoleHolder>}</dgDataCurator> </dgDataRoles> </dgDataEntity> </dataEntity> }</DPTDeployment> }</dgDataProductionTool> {$DPT/dgStructuredKeyword}{$DPT/DataProvenance}{$DPT/MetadataSecurity}</dgMetadataRecord>"; 
    28         static String StubBObsStnQuery = "for $ObsStn in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgObservationStation!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <dgMetadataRecord><dgMetadataID><schemeIdentifier>NDG-B1</schemeIdentifier> {$ObsStn/dgMetadataID/repositoryIdentifier}{$ObsStn/dgMetadataID/localIdentifier}</dgMetadataID> {$ObsStn/dgMetadataDescription}{$ObsStn/name}{$ObsStn/abbreviation}<dgObservationStation> {$ObsStn/dgObservationStation/contactDetails}{if (exists($ObsStn/dgObservationStation/dgStationaryPlatform)) then ( <dgStationaryPlatform> {$ObsStn/dgObservationStation/dgStationaryPlatform/position}{if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring)) then  ( <dgMooring> {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateStart}{$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateEnd}{for $DepositingCruise in collection('/db/ndg_B_metadata')//dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/localIdentifier)] return <depositingcruise> {$DepositingCruise/dgMetadataID}{$DepositingCruise/name}{$DepositingCruise/abbreviation}{$DepositingCruise/dgMetadataDescription}</depositingcruise> }{if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dgStationGrouping)) then  ( for $StationGrouping in collection('/db/ndg_B_metadata')//dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/localIdentifier)] return  <dgStationGrouping> {$StationGrouping/dgMetadataID}{$StationGrouping/name}{$StationGrouping/abbreviation}{$StationGrouping/dgMetadataDescription}{$StationGrouping/dgObservationStation/dgStationaryPlatform/position}</dgStationGrouping> ) else ()}</dgMooring> ) else if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring)) then  ( <dgStationGroup> {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateStart}{$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateEnd}<dgGroupedStations> {for $GroupedStations in collection('/db/ndg_B_metadata')//dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStations/dgGroupedStation/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStations/dgGroupedStation/localIdentifier)] return <dgGroupedStation> {$GroupedStations/dgMetadataID}{$GroupedStations/name}{$GroupedStations/abbreviation}{$GroupedStations/dgMetadataDescription}{$GroupedStations/dgObservationStation/dgStationaryPlatform/position}</dgGroupedStation> }</dgGroupedStations></dgStationGroup> ) else ($ObsStn/dgObservationStation/dgLandStation) }</dgStationaryPlatform> ) else ($ObsStn/dgObservationStation/dgMovingPlatform) }{for $RelDep in $ObsStn//ObsStationDeployment return <ObsStationDeployment> {$RelDep/DateStart}{$RelDep/DateEnd}{$RelDep/dgMetadataID}{for $SRAct in collection('/db/ndg_B_metadata')//dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/ActivityID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ActivityID/localIdentifier)] return <activity> {$SRAct/dgMetadataID}{$SRAct/dgMetadataDescription}{$SRAct/name}{$SRAct/abbreviation}<dgActivity> {$SRAct/*/dgActivityDataCollection}{$SRAct/*/dgActivityDataProject}{$SRAct/*/dgActivityDataCampaign}{$SRAct/*/dgActivityDataInvestigation}{$SRAct/*/dgActivityCoverage}{$SRAct/*/dgActivityDuration}</dgActivity></activity> }{for $SRDPT in collection('/db/ndg_B_metadata')//dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/DataProductionToolID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/DataProductionToolID/localIdentifier)] return <dataproductiontool> {$SRDPT/dgMetadataID}{$SRDPT/dgMetadataDescription}{$SRDPT/name}{$SRDPT/abbreviation}<dgDataProductionTool> {$SRDPT/dgDataProductionTool/contactDetails}{$SRDPT/dgDataProductionTool/dgModel}{$SRDPT/dgDataProductionTool/dgInstrument}</dgDataProductionTool></dataproductiontool> }{for $DE in collection('/db/ndg_B_metadata')//dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgDataEntity/RelatedDeployment/dgMetadataID/repositoryIdentifier=$RelDep/dgMetadataID/repositoryIdentifier and dgDataEntity/RelatedDeployment/dgMetadataID/localIdentifier=$RelDep/dgMetadataID/localIdentifier] return <dataEntity> {$DE/dgMetadataID}{$DE/dgMetadataDescription}{$DE/name}{$DE/abbreviation}<dgDataEntity> {$DE/dgDataEntity/dgDataSetType}{$DE/dgDataEntity/dgDataObjectType}{$DE/dgDataEntity/dgDataGranule}{$DE/dgDataEntity/dgDataSummary}<dgDataRoles><dgDataCurator> {$DE/dgDataEntity/dgDataRoles/dgDataCurator/dgMetadataID}{$DE/dgDataEntity/dgDataRoles/dgDataCurator/roleName}{$DE/dgDataEntity/dgDataRoles/dgDataCurator/abbreviation}{$DE/dgDataEntity/dgDataRoles/dgDataCurator/contactDetails}{for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder  order by $DataCuratorRole/startDate empty least, $DataCuratorRole/endDate empty least return  <dgRoleHolder> {for $DataCuratorRoleHolder in /*/(dgOrganisation | dgPerson)[(dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return $DataCuratorRoleHolder}{$DataCuratorRole/startDate}{$DataCuratorRole/endDate}{$DataCuratorRole/localName}</dgRoleHolder>}</dgDataCurator></dgDataRoles></dgDataEntity></dataEntity> }</ObsStationDeployment> }</dgObservationStation> {$ObsStn/dgStructuredKeyword}{$ObsStn/DataProvenance}{$ObsStn/MetadataSecurity}</dgMetadataRecord>"; 
    29         static String DCQuery = "xquery version '1.0'; declare default element namespace ''; declare namespace dc='http://purl.org/dc/elements/1.1/'; declare namespace oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc'; for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists(dgDataEntity) and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <oai_dc:dc> <dc:title>{string($DE/name)}</dc:title> <dc:type>Dataset</dc:type> <dc:identifier>{concat($DE/dgMetadataID/repositoryIdentifier, ':DC:', $DE/dgMetadataID/localIdentifier)}</dc:identifier> <dc:description>{string($DE/dgMetadataDescription/abstract/abstractText)}</dc:description> {for $StructuredKeyword in distinct-values($DE//(dgStructuredKeyword | dgStdParameterMeasured)/dgValidTerm) where ($DE//(dgStructuredKeyword | dgStdParameterMeasured)/dgValidTermID/ParentListID='http://www.cgd.ucar.edu/cms/eaton/cf-metadata/standard_name.html' or $DE//(dgStructuredKeyword | dgStdParameterMeasured)/dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' or $DE//(dgStructuredKeyword | dgStdParameterMeasured)/dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/projects.html') return <dc:subject> {string($StructuredKeyword)} </dc:subject> } {for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder return <dc:creator> {if (exists($DataCreatorRole/dgPersonID)) then for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgPerson[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName))) else if (exists($DataCreatorRole/dgOrganisationID)) then for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgOrganisation[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return string($DataCreatorRoleHolder/name) else () } </dc:creator> } {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[not(exists(endDate)) or endDate=''] return <dc:publisher> {if (exists($DataCuratorRole/dgPersonID)) then for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgPerson[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) else if (exists($DataCuratorRole/dgOrganisationID)) then for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgOrganisation[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return string($DataCuratorRoleHolder/name) else () } </dc:publisher> } </oai_dc:dc>"; 
     26        static String StubBActQuery = "for $Act in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgActivity!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <dgMetadataRecord> <dgMetadataID> <schemeIdentifier>NDG-B1</schemeIdentifier> {$Act/dgMetadataID/repositoryIdentifier} {$Act/dgMetadataID/localIdentifier} </dgMetadataID> {$Act/dgMetadataDescription} {$Act/name} {$Act/abbreviation} <dgActivity> {for $RelatedActivities in $Act/dgActivity/relatedActivity for $RelatedActivity in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelatedActivities/relatedActivityID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelatedActivities/relatedActivityID/localIdentifier] return <relatedActivity> {$RelatedActivities/relatedActivityID} {$RelatedActivity/name} {$RelatedActivity/abbreviation} {$RelatedActivities/activityRelation} </relatedActivity> } {$Act/dgActivityDataCollection} {$Act/dgActivityDataProject} {$Act/dgActivityDataCollection} {$Act/dgActivityDataInvestigation} <dgActivityRole> <dgInvestigator> <dgPrincipalInvestigator> {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/dgMetadataID} {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/roleName} {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/abbreviation} {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/contactDetails} {for $PIRole in $Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/dgRoleHolder order by $PIRole/startDate empty least, $PIRole/endDate empty least return <dgRoleHolder> {if (exists($PIRole/dgOrganisationID)) then ( for $PIRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgOrganisation[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$PIRole/dgOrganisationID/repositoryIdentifier and localIdentifier=$PIRole/dgOrganisationID/localIdentifier]] return $PIRoleHolder) else () } {if (exists($PIRole/dgPersonID)) then ( for $PIRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgPerson[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$PIRole/dgPersonID/repositoryIdentifier and localIdentifier=$PIRole/dgPersonID/localIdentifier]] return $PIRoleHolder) else () } {$PIRole/startDate} {$PIRole/endDate} {$PIRole/localName} </dgRoleHolder> } </dgPrincipalInvestigator> {for $CI in $Act/dgActivity/dgActivityRole/dgInvestigator/dgCoInvestigator return <dgCoInvestigator> {$CI/dgMetadataID} {$CI/roleName} {$CI/abbreviation} {$CI/contactDetails} {for $CIRole in $CI/dgRoleHolder order by $CIRole/startDate empty least, $CIRole/endDate empty least return <dgRoleHolder> {if (exists($CIRole/dgOrganisationID)) then ( for $CIRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgOrganisation[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$CIRole/dgOrganisationID/repositoryIdentifier and localIdentifier=$CIRole/dgOrganisationID/localIdentifier]] return $CIRoleHolder) else () } {if (exists($CIRole/dgPersonID)) then ( for $CIRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/dgPerson[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$CIRole/dgPersonID/repositoryIdentifier and localIdentifier=$CIRole/dgPersonID/localIdentifier]] return $CIRoleHolder) else () } {$CIRole/startDate} {$CIRole/endDate} {$CIRole/localName} </dgRoleHolder> } </dgCoInvestigator> } </dgInvestigator> {if (exists($Act/dgActivity/dgActivityRole/dgTechnicalContact)) then ( <dgTechnicalContact> {$Act/dgActivity/dgActivityRole/dgTechnicalContact/dgMetadataID} {$Act/dgActivity/dgActivityRole/dgTechnicalContact/roleName} {$Act/dgActivity/dgActivityRole/dgTechnicalContact/abbreviation} {$Act/dgActivity/dgActivityRole/dgTechnicalContact/contactDetails} {for $TechConRole in $Act/dgActivity/dgActivityRole/dgTechnicalContact/dgRoleHolder order by $TechConRole/startDate empty least, $TechConRole/endDate empty least return <dgRoleHolder> {for $TechConRoleHolder in /*/(dgOrganisation | dgPerson)[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$TechConRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$TechConRole/*/localIdentifier)] return $TechConRoleHolder} {$TechConRole/startDate} {$TechConRole/endDate} {$TechConRole/localName} </dgRoleHolder>} </dgTechnicalContact> ) else () } {if (exists($Act/dgActivity/dgActivityRole/dgProjectManager)) then ( <dgProjectManager> {$Act/dgActivity/dgActivityRole/dgProjectManager/dgMetadataID} {$Act/dgActivity/dgActivityRole/dgProjectManager/roleName} {$Act/dgActivity/dgActivityRole/dgProjectManager/abbreviation} {$Act/dgActivity/dgActivityRole/dgProjectManager/contactDetails} {for $PMRole in $Act/dgActivity/dgActivityRole/dgProjectManager/dgRoleHolder order by $PMRole/startDate empty least, $PMRole/endDate empty least return <dgRoleHolder> {for $PMRoleHolder in /*/(dgOrganisation | dgPerson)[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$PMRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$PMRole/*/localIdentifier)] return $PMRoleHolder} {$PMRole/startDate} {$PMRole/endDate} {$PMRole/localName} </dgRoleHolder>} </dgProjectManager> ) else () } </dgActivityRole> {for $RelDep in $Act/dgActivity/ActivityDeployment return <ActivityDeployment> {$RelDep/DateStart} {$RelDep/DateEnd} {$RelDep/dgMetadataID} {for $SRDPT in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/DataProductionToolID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/DataProductionToolID/localIdentifier)] return <dataproductiontool> {$SRDPT/dgMetadataID} {$SRDPT/dgMetadataDescription} {$SRDPT/name} {$SRDPT/abbreviation} <dgDataProductionTool> {$SRDPT/dgDataProductionTool/contactDetails} {$SRDPT/dgDataProductionTool/dgModel} {$SRDPT/dgDataProductionTool/dgInstrument} </dgDataProductionTool> </dataproductiontool> } {for $SRObsStn in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/ObservationStationID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ObservationStationID/localIdentifier)] return <observationstation> {$SRObsStn/dgMetadataID} {$SRObsStn/dgMetadataDescription} {$SRObsStn/name} {$SRObsStn/abbreviation} <dgObservationStation> {$SRObsStn/dgObservationStation/contactDetails} {$SRObsStn/dgObservationStation/dgStationaryPlatform} {$SRObsStn/dgObservationStation/dgMovingPlatform} </dgObservationStation> </observationstation> } {for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgDataEntity/RelatedDeployment/dgMetadataID/repositoryIdentifier=$RelDep/dgMetadataID/repositoryIdentifier and dgDataEntity/RelatedDeployment/dgMetadataID/localIdentifier=$RelDep/dgMetadataID/localIdentifier]return <dataEntity> {$DE/dgMetadataID} {$DE/dgMetadataDescription} {$DE/name} {$DE/abbreviation} <dgDataEntity> {$DE/dgDataEntity/dgDataSetType} {$DE/dgDataEntity/dgDataObjectType} {$DE/dgDataEntity/dgDataGranule} {$DE/dgDataEntity/dgDataSummary} </dgDataEntity> </dataEntity> } </ActivityDeployment> } {$Act/dgActivityCoverage} {$Act/ActivityDuration} </dgActivity> {$Act/dgStructuredKeyword} {$Act/DataProvenance} {$Act/MetadataSecurity} </dgMetadataRecord>"; 
     27        static String StubBDPTQuery = "for $DPT in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgDataProductionTool!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <dgMetadataRecord><dgMetadataID> <schemeIdentifier>NDG-B1</schemeIdentifier> {$DPT/dgMetadataID/repositoryIdentifier} {$DPT/dgMetadataID/localIdentifier} </dgMetadataID> {$DPT/dgMetadataDescription} {$DPT/name} {$DPT/abbreviation} <dgDataProductionTool> {$DPT/contactDetails} {if (exists($DPT/dgModel)) then ( <dgModel/> ) else ($DPT/dgInstrument) } {if (exists($DPT/dgDPTRoles)) then ( <dgDPTRoles>Roles are available, and will be added soon</dgDPTRoles> ) else() } {for $RelDep in $DPT/dgDataProductionTool/DPTDeployment return <DPTDeployment> {$RelDep/DateStart} {$RelDep/DateEnd} {$RelDep/dgMetadataID} {for $SRAct in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/repositoryIdentifier=$RelDep/ActivityID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ActivityID/localIdentifier)] return <activity> {$SRAct/dgMetadataID} {$SRAct/dgMetadataDescription} {$SRAct/name}{$SRAct/abbreviation} <dgActivity> {$SRAct/*/dgActivityDataCollection} {$SRAct/*/dgActivityDataProject} {$SRAct/*/dgActivityDataCampaign} {$SRAct/*/dgActivityDataInvestigation} {$SRAct/*/dgActivityCoverage} {$SRAct/*/dgActivityDuration} </dgActivity> </activity> } {for $SRObsStn in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/repositoryIdentifier=$RelDep/ObservationStationID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ObservationStationID/localIdentifier)] return <observationstation> {$SRObsStn/dgMetadataID} {$SRObsStn/dgMetadataDescription} {$SRObsStn/name} {$SRObsStn/abbreviation} <dgObservationStation> {$SRObsStn/dgObservationStation/contactDetails} {$SRObsStn/dgObservationStation/dgStationaryPlatform} {$SRObsStn/dgObservationStation/dgMovingPlatform} </dgObservationStation> </observationstation> } {for $DE in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[dgDataEntity/RelatedDeployment/dgMetadataID/repositoryIdentifier=$RelDep/dgMetadataID/repositoryIdentifier and dgDataEntity/RelatedDeployment/dgMetadataID/localIdentifier=$RelDep/dgMetadataID/localIdentifier] return <dataEntity> {$DE/dgMetadataID} {$DE/dgMetadataDescription} {$DE/name} {$DE/abbreviation} <dgDataEntity> {$DE/dgDataEntity/dgDataSetType} {$DE/dgDataEntity/dgDataObjectType} {$DE/dgDataEntity/dgDataGranule} {$DE/dgDataEntity/dgDataSummary} <dgDataRoles> <dgDataCurator> {$DE/dgDataEntity/dgDataRoles/dgDataCurator/dgMetadataID} {$DE/dgDataEntity/dgDataRoles/dgDataCurator/roleName} {$DE/dgDataEntity/dgDataRoles/dgDataCurator/abbreviation} {$DE/dgDataEntity/dgDataRoles/dgDataCurator/contactDetails} {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder order by $DataCuratorRole/startDate empty least, $DataCuratorRole/endDate empty least return <dgRoleHolder> {for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/*/(dgOrganisation | dgPerson)[(dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return $DataCuratorRoleHolder} {$DataCuratorRole/startDate} {$DataCuratorRole/endDate} {$DataCuratorRole/localName} </dgRoleHolder>} </dgDataCurator> </dgDataRoles> </dgDataEntity> </dataEntity> } </DPTDeployment> } </dgDataProductionTool> {$DPT/dgStructuredKeyword} {$DPT/DataProvenance} {$DPT/MetadataSecurity} </dgMetadataRecord>"; 
     28        static String StubBObsStnQuery = "for $ObsStn in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgObservationStation!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <dgMetadataRecord> <dgMetadataID> <schemeIdentifier>NDG-B1</schemeIdentifier> {$ObsStn/dgMetadataID/repositoryIdentifier} {$ObsStn/dgMetadataID/localIdentifier} </dgMetadataID> {$ObsStn/dgMetadataDescription} {$ObsStn/name} {$ObsStn/abbreviation} <dgObservationStation> {$ObsStn/dgObservationStation/contactDetails} {if (exists($ObsStn/dgObservationStation/dgStationaryPlatform)) then ( <dgStationaryPlatform> {$ObsStn/dgObservationStation/dgStationaryPlatform/position} {if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring)) then ( <dgMooring> {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateStart} {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateEnd} {for $DepositingCruise in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/localIdentifier)] return <depositingcruise> {$DepositingCruise/dgMetadataID} {$DepositingCruise/name} {$DepositingCruise/abbreviation} {$DepositingCruise/dgMetadataDescription} </depositingcruise> } {if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dgStationGrouping)) then ( for $StationGrouping in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/localIdentifier)] return <dgStationGrouping> {$StationGrouping/dgMetadataID} {$StationGrouping/name} {$StationGrouping/abbreviation} {$StationGrouping/dgMetadataDescription} {$StationGrouping/dgObservationStation/dgStationaryPlatform/position} </dgStationGrouping> ) else ()} </dgMooring>) else if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring)) then ( <dgStationGroup> {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateStart} {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateEnd} <dgGroupedStations> {for $GroupedStations in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStations/dgGroupedStation/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStations/dgGroupedStation/localIdentifier)] return <dgGroupedStation> {$GroupedStations/dgMetadataID} {$GroupedStations/name} {$GroupedStations/abbreviation} {$GroupedStations/dgMetadataDescription} {$GroupedStations/dgObservationStation/dgStationaryPlatform/position} </dgGroupedStation> } </dgGroupedStations> </dgStationGroup> ) else ($ObsStn/dgObservationStation/dgLandStation) } </dgStationaryPlatform> ) else ($ObsStn/dgObservationStation/dgMovingPlatform) } {for $RelDep in $ObsStn/*/ObsStationDeployment return <ObsStationDeployment> {$RelDep/DateStart} {$RelDep/DateEnd} {$RelDep/dgMetadataID} {for $SRAct in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/ActivityID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ActivityID/localIdentifier)] return <activity> {$SRAct/dgMetadataID} {$SRAct/dgMetadataDescription} {$SRAct/name} {$SRAct/abbreviation} <dgActivity> {$SRAct/*/dgActivityDataCollection} {$SRAct/*/dgActivityDataProject} {$SRAct/*/dgActivityDataCampaign} {$SRAct/*/dgActivityDataInvestigation} {$SRAct/*/dgActivityCoverage} {$SRAct/*/dgActivityDuration} </dgActivity> </activity> } {for $SRDPT in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/DataProductionToolID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/DataProductionToolID/localIdentifier)] return <dataproductiontool> {$SRDPT/dgMetadataID} {$SRDPT/dgMetadataDescription} {$SRDPT/name} {$SRDPT/abbreviation} <dgDataProductionTool> {$SRDPT/dgDataProductionTool/contactDetails} {$SRDPT/dgDataProductionTool/dgModel} {$SRDPT/dgDataProductionTool/dgInstrument} </dgDataProductionTool> </dataproductiontool>} {for $DE in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgDataEntity/RelatedDeployment/dgMetadataID/repositoryIdentifier=$RelDep/dgMetadataID/repositoryIdentifier and dgDataEntity/RelatedDeployment/dgMetadataID/localIdentifier=$RelDep/dgMetadataID/localIdentifier] return <dataEntity> {$DE/dgMetadataID} {$DE/dgMetadataDescription} {$DE/name} {$DE/abbreviation} <dgDataEntity> {$DE/dgDataEntity/dgDataSetType} {$DE/dgDataEntity/dgDataObjectType} {$DE/dgDataEntity/dgDataGranule} {$DE/dgDataEntity/dgDataSummary} <dgDataRoles> <dgDataCurator> {$DE/dgDataEntity/dgDataRoles/dgDataCurator/dgMetadataID} {$DE/dgDataEntity/dgDataRoles/dgDataCurator/roleName} {$DE/dgDataEntity/dgDataRoles/dgDataCurator/abbreviation} {$DE/dgDataEntity/dgDataRoles/dgDataCurator/contactDetails} {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder order by $DataCuratorRole/startDate empty least, $DataCuratorRole/endDate empty least return <dgRoleHolder> {for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/*/(dgOrganisation | dgPerson)[(dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return $DataCuratorRoleHolder} {$DataCuratorRole/startDate} {$DataCuratorRole/endDate} {$DataCuratorRole/localName} </dgRoleHolder> } </dgDataCurator> </dgDataRoles> </dgDataEntity> </dataEntity> } </ObsStationDeployment> } </dgObservationStation> {$ObsStn/dgStructuredKeyword} {$ObsStn/DataProvenance} {$ObsStn/MetadataSecurity} </dgMetadataRecord>"; 
     29        static String MOLESQuery = "for $Moles in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return $Moles"; 
     30        static String DublinCoreDEQuery = "declare namespace dc='http://purl.org/dc/elements/1.1/'; declare namespace oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc'; for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgDataEntity!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <oai_dc:dc xmlns:oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc/' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'> <dc:title>{string($DE/name)}</dc:title> <dc:type>Dataset</dc:type> <dc:identifier>{concat($DE/dgMetadataID/repositoryIdentifier, ':DC:', $DE/dgMetadataID/localIdentifier)}</dc:identifier> <dc:description>{string($DE/dgMetadataDescription/abstract/abstractText)}</dc:description> {for $StructuredKeyword in distinct-values($DE/dgStructuredKeyword [dgValidTermID/ParentListID='http://www.cgd.ucar.edu/cms/eaton/cf-metadata/standard_name.html' or dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' or dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/projects.html']//dgValidTerm) order by $StructuredKeyword return <dc:subject> {string($StructuredKeyword)} </dc:subject> } {for $StructuredKeyword1 in distinct-values($DE/dgDataEntity/dgDataSummary/dgParameterSummary/dgStdParameterMeasured[dgValidTermID/ParentListID='http://www.cgd.ucar.edu/cms/eaton/cf-metadata/standard_name.html' or dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' or dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/projects.html']//dgValidTerm) order by $StructuredKeyword1 return <dc:subject> {string($StructuredKeyword1)} </dc:subject> } {for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder order by $DataCreatorRole/startDate empty least, $DataCreatorRole/endDate empty least return for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/(dgOrganisation | dgPerson)[((not(exists($DataCreatorRole/endDate)) or empty($DataCreatorRole/endDate)) and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return <dc:creator> {if (string(local-name($DataCreatorRoleHolder))='dgOrganisation') then (string($DataCreatorRoleHolder/name)) else if (string(local-name($DataCreatorRoleHolder))='dgPerson') then (string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName)))) else ('empty content')} </dc:creator> } {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[empty(endDate)] order by $DataCuratorRole/startDate empty least return for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/(dgOrganisation | dgPerson)[((not(exists($DataCuratorRole/endDate)) or empty($DataCuratorRole/endDate)) and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return <dc:publisher> {if (string(local-name($DataCuratorRoleHolder))='dgOrganisation') then (string($DataCuratorRoleHolder/name)) else if (string(local-name($DataCuratorRoleHolder))='dgPerson') then (string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName)))) else ('empty content')} </dc:publisher> } </oai_dc:dc>"; 
     31        static String DIFQuery = "for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <DIF xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/' xsi:schemaLocation='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/ http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/dif_v9.4.xsd'> <Entry_ID>{concat($DE/dgMetadataID/repositoryIdentifier, ':DIF:', $DE/dgMetadataID/localIdentifier)}</Entry_ID> <Entry_Title>{string($DE/name)}</Entry_Title> {for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return <Dataset_Citation> {element Data_Creator {if (exists($DataCreatorRoleHolder/name/initials)) then ( string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName))) ) else ( string($DataCreatorRoleHolder/abbreviation) )} } <Dataset_Title>{string($DE/name)}</Dataset_Title> </Dataset_Citation> } {for $StructuredKeyword in ($DE//(dgStructuredKeyword | dgStdParameterMeasured)[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and ListLevel = 0]) return if (exists($StructuredKeyword/*/dgValidTerm)) then ( <Parameters> {element Category {string($StructuredKeyword/*/dgValidTerm)}} {if (exists($StructuredKeyword//dgValidSubterm) and $StructuredKeyword//dgValidSubterm != '' and $StructuredKeyword//dgValidSubterm != ' ') then ( for $Subterm in $StructuredKeyword//dgValidSubterm[exists(dgValidTerm)] where exists($Subterm/dgValidSubterm) order by $Subterm/ListLevel return if ($Subterm/ListLevel=1) then (element Topic {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=2) then (element Term {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=3) then (element Variable {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=4) then (element Detailed_Variable {string($Subterm/dgValidSubterm/dgValidTerm)}) else (element GCMD_Science_Valid {string($Subterm/dgValidSubterm/dgValidTerm)})))) ) else()} </Parameters> ) else() } {for $ISOTopicCategory in ($DE/dgStructuredKeyword[dgValidTermID/ParentListID='ISO 19115 Topic Category']) return element ISO_Topic_Category {string($ISOTopicCategory/dgValidTerm)} } {for $Keyword in distinct-values($DE//dgStructuredKeyword[ dgValidTermID/ParentListID!='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and dgValidTermID/ParentListID!='ISO 19115 Topic Category' ]/dgValidTerm) return element Keyword {string($Keyword)} } {for $DepDPT in ($DE/dgDataEntity/RelatedDeployment/DataProductionToolID) return <Sensor_Name> {for $DepDPTAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/abbreviation)) return element Short_Name {data($DepDPTAbbrev)}} {for $DepDPTName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/name)) return element Long_Name {data($DepDPTName)} } </Sensor_Name> } {for $DepObsStn in ($DE/dgDataEntity/RelatedDeployment/ObservationStationID) return <Source_Name> {for $DepObsStnAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/abbreviation)) return <Short_Name>{data($DepObsStnAbbrev)}</Short_Name>} {for $DepObsStnName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/name)) return <Long_Name>{data($DepObsStnName)}</Long_Name>} </Source_Name> } {for $TemporalRange in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgDateRange) return <Temporal_Coverage> {element Start_Date {data($TemporalRange/DateRangeStart)}} {element End_Date {data($TemporalRange/DateRangeEnd)}} </Temporal_Coverage> } {for $TemporalTerm in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea/dgValidTerm) return element Paleo_Temporal_Coverage { element Chronostratigraphic_Unit {data($TemporalTerm)} } } {for $Data_Set_Progress in ($DE/dgDataEntity/dgDataSummary/dgDataStatus/dgDatasetClosure) return element Data_Set_Progress {$Data_Set_Progress} } {for $BoundingBox in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/BoundingBox) return <Spatial_Coverage> {element Southernmost_Latitude {data($BoundingBox/LimitSouth)}} {element Northernmost_Latitude {data($BoundingBox/LimitNorth)}} {element Westernmost_Longitude {data($BoundingBox/LimitWest)}} {element Easternmost_Longitude {data($BoundingBox/LimitEast)}} </Spatial_Coverage> } {for $Location in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_locations.html']) return element Location {$Location} } {for $DepAct in ($DE/dgDataEntity/RelatedDeployment/ActivityID) return <Project> {for $DepActAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/abbreviation)) return <Short_Name>{data($DepActAbbrev)}</Short_Name>} {for $DepActName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/name)) return <Long_Name>{data($DepActName)}</Long_Name>} </Project> } {if (exists($DE/dgDataEntity/dgDataGranule/accessControlPolicy)) then ( element Access_Constraints {''} ) else () } {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return <Data_Center> <Data_Center_Name> {element Short_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) ) else ( string($DataCuratorRoleHolder/abbreviation) )} } {element Long_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) ) else (string($DataCuratorRoleHolder/name))} } </Data_Center_Name> {if (exists($DataCuratorRoleHolder/contactDetails/URI)) then ( element Data_Center_URL {data($DataCuratorRoleHolder/contactDetails/URI)} ) else ()} {for $DGID in $DE/dgDataEntity/dgDataGranule/dataModelID return element Data_Set_ID {concat($DGID/repositoryIdentifier, ':', $DGID/schemeIdentifier, ':', $DGID/localIdentifier)} } <Personnel> {element Role {'Data Center Contact'}} {if (exists($DataCuratorRoleHolder/name/knownAs)) then ( element First_Name {string($DataCuratorRoleHolder/name/knownAs)} ) else if (exists($DataCuratorRoleHolder/name/initials)) then ( element First_Name {string($DataCuratorRoleHolder/name/initials)} ) else ()} {element Last_Name {if (exists($DataCuratorRoleHolder/name/familyName)) then ( string($DataCuratorRoleHolder/name/familyName) ) else (string($DataCuratorRoleHolder/name))} } {if (exists($DataCuratorRole/contactDetails/eMail)) then ( element Email {string($DataCuratorRole/contactDetails/eMail)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/eMail)) then ( element Email {string($DataCuratorRoleHolder/contactDetails/eMail)} ) else () )} {if (exists($DataCuratorRole/contactDetails/telephone)) then ( element Phone {string($DataCuratorRole/contactDetails/telephone)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/telephone)) then ( element Phone {string($DataCuratorRoleHolder/contactDetails/telephone)} ) else () )} {if (exists($DataCuratorRole/contactDetails/fax)) then ( element Fax {string($DataCuratorRole/contactDetails/fax)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/fax)) then ( element Fax {string($DataCuratorRoleHolder/contactDetails/fax)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/addressline)) then ( for $addressline in $DataCuratorRole/contactDetails/address/addressline return element address {$addressline} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/addressline)) then ( for $addressline in $DataCuratorRoleHolder/contactDetails/address/addressline return element address {$addressline} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/city)) then ( element City {string($DataCuratorRole/contactDetails/city)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/city)) then ( element Cityl {string($DataCuratorRoleHolder/contactDetails/city)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/postcode)) then ( element Postal_Code {string($DataCuratorRole/contactDetails/postcode)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( element email {string($DataCuratorRoleHolder/contactDetails/postcode)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/country)) then ( element Postal_Code {string($DataCuratorRole/contactDetails/country)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( element Postal_Code {string($DataCuratorRoleHolder/contactDetails/eMail)} ) else () )} </Personnel> </Data_Center> } <Summary>{string($DE/dgMetadataDescription/abstract/abstractText)}</Summary> <Related_URL> {element URL_Content_Type {'NDG_B_SERVICE'}} {element URL {data($DE/dgMetadataID/repositoryIdentifier)}} {element Description {'The NDG service for browsing metadata.'}} </Related_URL> {for $DG in $DE/dgDataEntity/dgDataGranule return if ($DG/dataModelID/schemeIdentifier='NDG-A0') then ( <Related_URL> {element URL_Content_Type {'NDG_A_SERVICE'}} {element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&amp;datasetID=', true())}} {element Description {'The NDG service delivering data via NDG A metadata.'}} </Related_URL> ) else if ($DG/dataModelID/schemeIdentifier='CSML-0') then ( <Related_URL> {element URL_Content_Type {'NDG_A_SERVICE'}} {element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())}} {element Description {'The NDG service delivering data via NDG A metadata.'}} </Related_URL> ) else if ($DG/dataModelID/schemeIdentifier='URI') then ( <Related_URL> {element URL {data($DG/instance/URI)}} {if (exists($DG/instance/instanceComment)) then ( element Description {data($DG/instance/instanceComment)} ) else ( element Description {'URL to aid in delivering data. Note that this may point directly to the data or, more likely, point to the web site of the curators.'} ) } </Related_URL> ) else () } <Metadata_Name>[CEOS IDN DIF]</Metadata_Name> {element Metadata_Version {'9.4'}} {if (exists($DE/dgMetadataProvenance/RecordCreation)) then ( element DIF_Creation_Date {data($DE/dgMetadataProvenance/RecordCreation/CreatedDate)} ) else () } {for $MDUpdt in $DE/dgMetadataProvenance/RecordUpdate return element DIF_Revision_History {concat(data($MDUpdt/UpdateDate), ' - ', data($MDUpdt/UpdateSummary), ' - ', data($MDUpdt/UpdatedBy))} } {if (exists($DE/dgMetadataProvenance/RecordReview)) then ( element Future_DIF_Review_Date {data($DE/dgMetadataProvenance/RecordReview/ReviewDate)} ) else () } </DIF>"; 
    3032   
    3133        static boolean debug = false; 
     
    7577            String user = null; 
    7678            String userpw = null; 
     79 
     80            String outputFormat = null; 
    7781 
    7882            long queryTimeStart = 0; 
     
    104108                user = DefaultUserID; 
    105109            } 
    106         if (debug) { 
     110        outputFormat = getNamedParam("format", args); 
     111        if (outputFormat.equals("DC")) { // Supported format 
     112                if (debug) { 
     113                        System.out.println("DC format found.\n"); 
     114                } 
     115        } 
     116        else if (outputFormat.equals("DIF")) { // Supported format 
     117                if (debug) { 
     118                        System.out.println("DIF format found.\n"); 
     119                } 
     120        } 
     121        else if (outputFormat.equals("NDG-B0")) { // Supported format 
     122                if (debug) { 
     123                        System.out.println("MOLES format found.\n"); 
     124                } 
     125        } 
     126        else { 
     127                outputFormat = "NDG-B1"; // Give them back the default format... 
     128            } 
     129 
     130        if (debug) { 
    107131                System.out.println("repositoryID=" + repositoryID); 
    108132                System.out.println("localID=" + localID); 
     
    110134                System.out.println("user=" + user); 
    111135                System.out.println("userpw=" + userpw + "\n"); 
     136                System.out.println("outputFormat=" + outputFormat + "\n"); 
    112137                } 
    113138         
     
    204229                } 
    205230                else { 
    206                                  System.out.println("<dgMetadata/>"); 
     231                                 if (outputFormat.equals("NDG-B1")) {System.out.println("<dgMetadata/>");} 
     232                                 else if (outputFormat.equals("DIF")) {System.out.println("<DIF  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/' xsi:schemaLocation='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/ http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/dif_v9.4.xsd'/>");} 
     233                                 else if (outputFormat.equals("DC")) {System.out.println("<oai_dc:dc xmlns:oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc/' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'/>");} 
     234 
    207235                                 System.exit(10); 
    208236                } 
     
    223251                /** 
    224252                 * OK, now we've found out what type of object they've asked for, 
    225                  * let's go and get it... 
     253                 * let's go and get it, if appropriate... 
    226254                 */ 
     255                // Bug out if the object requested is not appropriate to the format 
     256                if ((outputFormat.equals("DIF")  
     257                                || outputFormat.equals("DC"))  
     258                                && !objectTypeString.equals("<objectType>4</objectType>")  
     259                                )  
     260                        { 
     261                         System.exit(12); 
     262                        } 
     263 
    227264                // Select correct query for type or bug out if there's no object... 
    228             if (objectTypeString.compareTo("<objectType>4</objectType>") == 0) 
     265                if (outputFormat.equals("DIF")) {xquery = DIFQuery;} 
     266                else if (outputFormat.equals("DC")) {xquery = DublinCoreDEQuery;} 
     267                else if (outputFormat.equals("NDG-B0")) {xquery = MOLESQuery;} 
     268                else if (outputFormat.equals("NDG-B1") && objectTypeString.equals("<objectType>4</objectType>")) 
    229269                        xquery = StubBDEQuery; 
    230                 else if (objectTypeString.compareTo("<objectType>3</objectType>") == 0) 
     270                else if (outputFormat.equals("NDG-B1") && objectTypeString.equals("<objectType>3</objectType>")) 
    231271                        xquery = StubBObsStnQuery; 
    232                 else if (objectTypeString.compareTo("<objectType>2</objectType>") == 0) 
     272                else if (outputFormat.equals("NDG-B1") && objectTypeString.equals("<objectType>2</objectType>")) 
    233273                        xquery = StubBDPTQuery; 
    234                 else if (objectTypeString.compareTo("<objectType>1</objectType>") == 0) 
     274                else if (outputFormat.equals("NDG-B1") && objectTypeString.equals("<objectType>1</objectType>")) 
    235275                        xquery = StubBActQuery; 
    236276                else { 
     
    266306                     
    267307            // get root-collection 
    268 //            rootCollection = DatabaseManager.getCollection(eXistService + DBBroker.ROOT_COLLECTION); 
    269308            rootCollection = DatabaseManager.getCollection(eXistService + DBBroker.ROOT_COLLECTION, user, userpw); 
    270309            // get query-service 
  • TI07-MOLES/trunk/StubB/XQuery/NDG-ActStubB.xquery

    r648 r1276  
    1 for $Act in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgActivity!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='repositoryID' and dgMetadataID/localIdentifier='localID'] 
     1for $Act in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgActivity!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='badc.nerc.ac.uk' and dgMetadataID/localIdentifier='activity1'] 
    22return 
    33<dgMetadataRecord> 
     
    2121                        </relatedActivity> 
    2222                        } 
    23         {$Act/dgActivityDataCollection} 
    24         {$Act/dgActivityDataProject} 
    25         {$Act/dgActivityDataCollection} 
    26         {$Act/dgActivityDataInvestigation} 
    27         <dgActivityRole> 
    28                 <dgInvestigator> 
    29                         <dgPrincipalInvestigator> 
    30                                 {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/dgMetadataID} 
    31                                 {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/roleName} 
    32                                 {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/abbreviation} 
    33                                 {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/contactDetails} 
    34  
    35                                 {for $PIRole in $Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/dgRoleHolder  
    36                                         order by $PIRole/startDate empty least, $PIRole/endDate empty least 
    37                                         return  
     23                {$Act/dgActivityDataCollection} 
     24                {$Act/dgActivityDataProject} 
     25                {$Act/dgActivityDataCollection} 
     26                {$Act/dgActivityDataInvestigation} 
     27                <dgActivityRole> 
     28                        <dgInvestigator> 
     29                                <dgPrincipalInvestigator> 
     30                                        {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/dgMetadataID} 
     31                                        {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/roleName} 
     32                                        {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/abbreviation} 
     33                                        {$Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/contactDetails} 
     34                                        {for $PIRole in $Act/dgActivity/dgActivityRole/dgInvestigator/dgPrincipalInvestigator/dgRoleHolder  
     35                                                order by $PIRole/startDate empty least, $PIRole/endDate empty least 
     36                                                return  
    3837                                                <dgRoleHolder> 
    3938                                                        {if (exists($PIRole/dgOrganisationID)) then ( 
     
    5251                                                </dgRoleHolder> 
    5352                                        }                                        
    54                         </dgPrincipalInvestigator> 
    55                         {for $CI in $Act/dgActivity/dgActivityRole/dgInvestigator/dgCoInvestigator  
    56                         return   
    57                                 <dgCoInvestigator> 
    58                                 {$CI/dgMetadataID} 
    59                                 {$CI/roleName} 
     53                                </dgPrincipalInvestigator> 
     54                                {for $CI in $Act/dgActivity/dgActivityRole/dgInvestigator/dgCoInvestigator  
     55                                return   
     56                                        <dgCoInvestigator> 
     57                                        {$CI/dgMetadataID} 
     58                                        {$CI/roleName} 
    6059                                        {$CI/abbreviation} 
    6160                                        {$CI/contactDetails} 
     
    156155                                } 
    157156                        {for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgDataEntity/RelatedDeployment/dgMetadataID/repositoryIdentifier=$RelDep/dgMetadataID/repositoryIdentifier and dgDataEntity/RelatedDeployment/dgMetadataID/localIdentifier=$RelDep/dgMetadataID/localIdentifier]            return 
    158                                 <dataentity> 
     157                                <dataEntity> 
    159158                                {$DE/dgMetadataID} 
    160159                                {$DE/dgMetadataDescription} 
     
    167166                                        {$DE/dgDataEntity/dgDataSummary} 
    168167                                </dgDataEntity> 
    169                         </dataentity> 
     168                        </dataEntity> 
    170169                        } 
    171170                </ActivityDeployment> 
  • TI07-MOLES/trunk/StubB/XQuery/NDG-DEStubB.xquery

    r673 r1276  
    1 for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier='repositoryID' and localIdentifier='localID']] 
     1for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier='badc.nerc.ac.uk' and localIdentifier='dataent1']] 
    22return 
    33<dgMetadataRecord> 
  • TI07-MOLES/trunk/StubB/XQuery/NDG-DPTStubB.xquery

    r648 r1276  
    1 for $DPT in //dgMetadataRecord[dgDataProductionTool!='' and dgMetadataID/repositoryIdentifier='repositoryID' and dgMetadataID/localIdentifier='localID'] 
    2 return 
    3 <dgMetadataRecord> 
     1for $DPT in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgDataProductionTool!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='badc.nerc.ac.uk' and dgMetadataID/localIdentifier='dpt1']  
     2return  
     3<dgMetadataRecord>  
    44        {$DPT/dgMetadataID} 
     5                <dgMetadataID> 
     6                        <schemeIdentifier>NDG-B1</schemeIdentifier>  
     7                        {$DPT/dgMetadataID/repositoryIdentifier} 
     8                        {$DPT/dgMetadataID/localIdentifier} 
     9                </dgMetadataID>  
    510        {$DPT/dgMetadataDescription} 
    611        {$DPT/name} 
    712        {$DPT/abbreviation} 
    8         <dgDataProductionTool> 
    9                 {$DPT/contactDetails} 
     13        <dgDataProductionTool>  
     14        {$DPT/contactDetails} 
     15        {if (exists($DPT/dgModel)) then ( 
     16                 <dgModel/> 
     17            )  
     18        else ($DPT/dgInstrument)  
     19        } 
    1020        {if (exists($DPT/dgDPTRoles)) then ( 
    11         <dgDPTRoles>Roles are available, and will be added soon</dgDPTRoles> 
    12         ) 
    13         else() 
    14         } 
    15         {for $RelDep in $DPT//DPTDeployment 
    16                 return 
    17                 <DPTDeployment> 
     21                 <dgDPTRoles>Roles are available, and will be added soon</dgDPTRoles>  
     22        ) else() } 
     23        {for $RelDep in $DPT/dgDataProductionTool/DPTDeployment  
     24        return  
     25                <DPTDeployment>  
    1826                        {$RelDep/DateStart} 
    1927                        {$RelDep/DateEnd} 
    2028                        {$RelDep/dgMetadataID} 
    21                         {for $SRAct in //dgMetadataRecord[(dgMetadataID/repositoryIdentifier=$RelDep/ActivityID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ActivityID/localIdentifier)] 
    22                                 return 
    23                                         <activity> 
     29                        {for $SRAct in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/repositoryIdentifier=$RelDep/ActivityID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ActivityID/localIdentifier)]  
     30                        return  
     31                                <activity>  
    2432                                        {$SRAct/dgMetadataID} 
    2533                                        {$SRAct/dgMetadataDescription} 
    26                                         {$SRAct/name} 
    27                                         {$SRAct/abbreviation} 
     34                                        {$SRAct/name}{$SRAct/abbreviation} 
    2835                                        <dgActivity> 
    2936                                                {$SRAct/*/dgActivityDataCollection} 
     
    3340                                                {$SRAct/*/dgActivityCoverage} 
    3441                                                {$SRAct/*/dgActivityDuration} 
    35                                         </dgActivity> 
    36                                         </activity> 
    37                                 } 
    38                         {for $SRObsStn in //dgMetadataRecord[(dgMetadataID/repositoryIdentifier=$RelDep/ObservationStationID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ObservationStationID/localIdentifier)] 
    39                                 return 
    40                                 <observationstation> 
     42                                        </dgActivity>  
     43                                </activity>  
     44                        } 
     45                        {for $SRObsStn in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/repositoryIdentifier=$RelDep/ObservationStationID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ObservationStationID/localIdentifier)]  
     46                        return  
     47                                <observationstation>  
    4148                                        {$SRObsStn/dgMetadataID} 
    4249                                        {$SRObsStn/dgMetadataDescription} 
    4350                                        {$SRObsStn/name} 
    4451                                        {$SRObsStn/abbreviation} 
    45                                         <dgObservationStation> 
     52                                        <dgObservationStation>  
    4653                                                {$SRObsStn/dgObservationStation/contactDetails} 
    4754                                                {$SRObsStn/dgObservationStation/dgStationaryPlatform} 
    4855                                                {$SRObsStn/dgObservationStation/dgMovingPlatform} 
    49                                         </dgObservationStation> 
    50                                 </observationstation> 
    51                                 } 
    52                         {for $DE in //dgMetadataRecord[dgDataEntity/RelatedDeployment/dgMetadataID/repositoryIdentifier=$RelDep/dgMetadataID/repositoryIdentifier and dgDataEntity/RelatedDeployment/dgMetadataID/localIdentifier=$RelDep/dgMetadataID/localIdentifier] 
    53                                 return 
    54                                 <dataEntity> 
    55                                 {$DE/dgMetadataID} 
    56                                 {$DE/dgMetadataDescription} 
    57                                 {$DE/name} 
    58                                 {$DE/abbreviation} 
    59                                 <dgDataEntity> 
    60                                         {$DE/dgDataEntity/dgDataSetType} 
    61                                         {$DE/dgDataEntity/dgDataObjectType} 
    62                                         {$DE/dgDataEntity/dgDataGranule} 
    63                                         {$DE/dgDataEntity/dgDataSummary} 
    64                                         <dgDataRoles> 
    65                                         <dgDataCurator> 
    66                                                 {$DE/dgDataEntity/dgDataRoles/dgDataCurator/dgMetadataID} 
    67                                                 {$DE/dgDataEntity/dgDataRoles/dgDataCurator/roleName} 
    68                                                 {$DE/dgDataEntity/dgDataRoles/dgDataCurator/abbreviation} 
    69                                                 {$DE/dgDataEntity/dgDataRoles/dgDataCurator/contactDetails} 
    70                                                 {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder  
    71                                                         order by $DataCuratorRole/startDate empty least, $DataCuratorRole/endDate empty least 
    72                                                         return  
    73                                                         <dgRoleHolder> 
    74                                                         {for $DataCuratorRoleHolder in /*/(dgOrganisation | dgPerson)[(dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return $DataCuratorRoleHolder} 
    75                                                                 {$DataCuratorRole/startDate} 
    76                                                                 {$DataCuratorRole/endDate} 
    77                                                                 {$DataCuratorRole/localName} 
    78                                                         </dgRoleHolder>} 
    79                                         </dgDataCurator> 
    80                                         </dgDataRoles> 
    81                                 </dgDataEntity> 
    82                         </dataEntity> 
     56                                        </dgObservationStation>  
     57                                </observationstation> } 
     58                        {for $DE in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[dgDataEntity/RelatedDeployment/dgMetadataID/repositoryIdentifier=$RelDep/dgMetadataID/repositoryIdentifier and dgDataEntity/RelatedDeployment/dgMetadataID/localIdentifier=$RelDep/dgMetadataID/localIdentifier]  
     59                        return  
     60                                <dataEntity>  
     61                                        {$DE/dgMetadataID} 
     62                                        {$DE/dgMetadataDescription} 
     63                                        {$DE/name} 
     64                                        {$DE/abbreviation} 
     65                                        <dgDataEntity>  
     66                                                {$DE/dgDataEntity/dgDataSetType} 
     67                                                {$DE/dgDataEntity/dgDataObjectType} 
     68                                                {$DE/dgDataEntity/dgDataGranule} 
     69                                                {$DE/dgDataEntity/dgDataSummary} 
     70                                                <dgDataRoles>  
     71                                                        <dgDataCurator>  
     72                                                                {$DE/dgDataEntity/dgDataRoles/dgDataCurator/dgMetadataID} 
     73                                                                {$DE/dgDataEntity/dgDataRoles/dgDataCurator/roleName} 
     74                                                                {$DE/dgDataEntity/dgDataRoles/dgDataCurator/abbreviation} 
     75                                                                {$DE/dgDataEntity/dgDataRoles/dgDataCurator/contactDetails} 
     76                                                                {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder   
     77                                                                        order by $DataCuratorRole/startDate empty least, $DataCuratorRole/endDate empty least  
     78                                                                return   
     79                                                                        <dgRoleHolder>  
     80                                                                                {for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/*/(dgOrganisation | dgPerson)[(dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)]  
     81                                                                                return $DataCuratorRoleHolder} 
     82                                                                                        {$DataCuratorRole/startDate} 
     83                                                                                        {$DataCuratorRole/endDate} 
     84                                                                                        {$DataCuratorRole/localName} 
     85                                                                        </dgRoleHolder>} 
     86                                                        </dgDataCurator>  
     87                                                </dgDataRoles>  
     88                                        </dgDataEntity>  
     89                                </dataEntity>  
    8390                        } 
    84                 </DPTDeployment> 
     91                </DPTDeployment>  
    8592                } 
    86         </dgDataProductionTool> 
     93        </dgDataProductionTool>  
    8794        {$DPT/dgStructuredKeyword} 
    8895        {$DPT/DataProvenance} 
  • TI07-MOLES/trunk/StubB/XQuery/NDG-ObsStnStubB.xquery

    r648 r1276  
    1 for $ObsStn in //dgMetadataRecord[dgObservationStation!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='repositoryID' and dgMetadataID/localIdentifier='localID'] 
    2 return 
    3 <dgMetadataRecord> 
    4         <dgMetadataID> 
    5                 <schemeIdentifier>NDG-B1</schemeIdentifier> 
    6                 {$ObsStn/dgMetadataID/repositoryIdentifier} 
    7                 {$ObsStn/dgMetadataID/localIdentifier} 
    8         </dgMetadataID> 
    9         {$ObsStn/dgMetadataDescription} 
    10         {$ObsStn/name} 
    11         {$ObsStn/abbreviation} 
    12         <dgObservationStation> 
    13                 {$ObsStn/dgObservationStation/contactDetails} 
    14                 {if (exists($ObsStn/dgObservationStation/dgStationaryPlatform)) then ( 
    15                         <dgStationaryPlatform> 
     1for $ObsStn in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgObservationStation!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='badc.nerc.ac.uk' and dgMetadataID/localIdentifier='obs1']  
     2return  
     3        <dgMetadataRecord> 
     4                <dgMetadataID> 
     5                        <schemeIdentifier>NDG-B1</schemeIdentifier>  
     6                        {$ObsStn/dgMetadataID/repositoryIdentifier} 
     7                        {$ObsStn/dgMetadataID/localIdentifier} 
     8                </dgMetadataID>  
     9                {$ObsStn/dgMetadataDescription} 
     10                {$ObsStn/name} 
     11                {$ObsStn/abbreviation} 
     12                <dgObservationStation>  
     13                        {$ObsStn/dgObservationStation/contactDetails} 
     14                        {if (exists($ObsStn/dgObservationStation/dgStationaryPlatform)) then ( 
     15                                <dgStationaryPlatform>  
    1616                                {$ObsStn/dgObservationStation/dgStationaryPlatform/position} 
    17                                 {if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring)) then  
    18                                 ( 
    19                                 <dgMooring> 
     17                                {if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring)) then  (  
     18                                        <dgMooring>  
     19                                                {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateStart} 
     20                                                {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateEnd} 
     21                                                {for $DepositingCruise in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/localIdentifier)]  
     22                                                return  
     23                                                        <depositingcruise>  
     24                                                                {$DepositingCruise/dgMetadataID} 
     25                                                                {$DepositingCruise/name} 
     26                                                                {$DepositingCruise/abbreviation} 
     27                                                                {$DepositingCruise/dgMetadataDescription} 
     28                                                        </depositingcruise>  
     29                                                } 
     30                                                {if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dgStationGrouping)) then  (  
     31                                                        for $StationGrouping in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/localIdentifier)]  
     32                                                        return   
     33                                                                <dgStationGrouping>  
     34                                                                        {$StationGrouping/dgMetadataID} 
     35                                                                        {$StationGrouping/name} 
     36                                                                        {$StationGrouping/abbreviation} 
     37                                                                        {$StationGrouping/dgMetadataDescription} 
     38                                                                        {$StationGrouping/dgObservationStation/dgStationaryPlatform/position} 
     39                                                                </dgStationGrouping> )  
     40                                                else ()} 
     41                                                </dgMooring>)  
     42                        else if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring)) then  (  
     43                                <dgStationGroup>  
    2044                                        {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateStart} 
    2145                                        {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateEnd} 
    22                                         {for $DepositingCruise in //dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/localIdentifier)] 
    23                                         return 
    24                                         <depositingcruise> 
    25                                                 {$DepositingCruise/dgMetadataID} 
    26                                                 {$DepositingCruise/name} 
    27                                                 {$DepositingCruise/abbreviation} 
    28                                                 {$DepositingCruise/dgMetadataDescription} 
    29                                         </depositingcruise> 
    30                                         } 
    31                                         {if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dgStationGrouping)) then  
    32                                         ( 
    33                                         for $StationGrouping in //dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/DepositingCruise/localIdentifier)] 
    34                                         return  
    35                                                 <dgStationGrouping> 
    36                                                         {$StationGrouping/dgMetadataID} 
    37                                                         {$StationGrouping/name} 
    38                                                         {$StationGrouping/abbreviation} 
    39                                                         {$StationGrouping/dgMetadataDescription} 
    40                                                         {$StationGrouping/dgObservationStation/dgStationaryPlatform/position} 
    41                                                 </dgStationGrouping> 
    42                                         ) 
    43                                         else ()} 
    44                                 </dgMooring>             
    45                                 ) 
    46                                 else if (exists($ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring)) then  
    47                                 ( 
    48                                 <dgStationGroup> 
    49                                         {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateStart} 
    50                                         {$ObsStn/dgObservationStation/dgStationaryPlatform/dgMooring/dateEnd} 
    51                                         <dgGroupedStations> 
    52                                         {for $GroupedStations in //dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStations/dgGroupedStation/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStations/dgGroupedStation/localIdentifier)] 
    53                                         return 
    54                                         <dgGroupedStation> 
    55                                                 {$GroupedStations/dgMetadataID} 
    56                                                 {$GroupedStations/name} 
    57                                                 {$GroupedStations/abbreviation} 
    58                                                 {$GroupedStations/dgMetadataDescription} 
    59                                                 {$GroupedStations/dgObservationStation/dgStationaryPlatform/position} 
    60                                         </dgGroupedStation> 
    61                                         } 
     46                                        <dgGroupedStations>  
     47                                                {for $GroupedStations in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStations/dgGroupedStation/repositoryIdentifier and dgMetadataID/localIdentifier=$ObsStn/dgObservationStation/dgStationaryPlatform/dgStationGroup/dgGroupedStations/dgGroupedStation/localIdentifier)]  
     48                                                return  
     49                                                        <dgGroupedStation>  
     50                                                                {$GroupedStations/dgMetadataID} 
     51                                                                {$GroupedStations/name} 
     52                                                                {$GroupedStations/abbreviation} 
     53                                                                {$GroupedStations/dgMetadataDescription} 
     54                                                                {$GroupedStations/dgObservationStation/dgStationaryPlatform/position} 
     55                                                        </dgGroupedStation> } 
    6256                                        </dgGroupedStations> 
    63                                 </dgStationGroup>                
    64                                 ) 
    65                                 else ($ObsStn/dgObservationStation/dgLandStation) 
     57                                </dgStationGroup> )  
     58                        else ($ObsStn/dgObservationStation/dgLandStation)  
     59                        } 
     60                        </dgStationaryPlatform> )  
     61                        else ($ObsStn/dgObservationStation/dgMovingPlatform)  
     62                        } 
     63                        {for $RelDep in $ObsStn/*/ObsStationDeployment  
     64                        return  
     65                                <ObsStationDeployment>  
     66                                {$RelDep/DateStart} 
     67                                {$RelDep/DateEnd} 
     68                                {$RelDep/dgMetadataID} 
     69                                {for $SRAct in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/ActivityID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ActivityID/localIdentifier)]  
     70                                return  
     71                                        <activity>  
     72                                                {$SRAct/dgMetadataID} 
     73                                                {$SRAct/dgMetadataDescription} 
     74                                                {$SRAct/name} 
     75                                                {$SRAct/abbreviation} 
     76                                                <dgActivity>  
     77                                                        {$SRAct/*/dgActivityDataCollection} 
     78                                                        {$SRAct/*/dgActivityDataProject} 
     79                                                        {$SRAct/*/dgActivityDataCampaign} 
     80                                                        {$SRAct/*/dgActivityDataInvestigation} 
     81                                                        {$SRAct/*/dgActivityCoverage} 
     82                                                        {$SRAct/*/dgActivityDuration} 
     83                                                </dgActivity> 
     84                                        </activity>  
    6685                                } 
    67                         </dgStationaryPlatform> 
    68                 ) 
    69                 else ($ObsStn/dgObservationStation/dgMovingPlatform) 
    70                 } 
    71         {for $RelDep in $ObsStn//ObsStationDeployment 
    72                 return 
    73                 <ObsStationDeployment> 
    74                         {$RelDep/DateStart} 
    75                         {$RelDep/DateEnd} 
    76                         {$RelDep/dgMetadataID} 
    77                         {for $SRAct in //dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/ActivityID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/ActivityID/localIdentifier)] 
    78                                 return 
    79                                         <activity> 
    80                                         {$SRAct/dgMetadataID} 
    81                                         {$SRAct/dgMetadataDescription} 
    82                                         {$SRAct/name} 
    83                                         {$SRAct/abbreviation} 
    84                                         <dgActivity> 
    85                                                 {$SRAct/*/dgActivityDataCollection} 
    86                                                 {$SRAct/*/dgActivityDataProject} 
    87                                                 {$SRAct/*/dgActivityDataCampaign} 
    88                                                 {$SRAct/*/dgActivityDataInvestigation} 
    89                                                 {$SRAct/*/dgActivityCoverage} 
    90                                                 {$SRAct/*/dgActivityDuration} 
    91                                         </dgActivity> 
    92                                         </activity> 
    93                                 } 
    94                         {for $SRDPT in //dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/DataProductionToolID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/DataProductionToolID/localIdentifier)] 
    95                                 return 
    96                                         <dataproductiontool> 
     86                                {for $SRDPT in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$RelDep/DataProductionToolID/repositoryIdentifier and dgMetadataID/localIdentifier=$RelDep/DataProductionToolID/localIdentifier)]  
     87                                return  
     88                                        <dataproductiontool>  
    9789                                                {$SRDPT/dgMetadataID} 
    9890                                                {$SRDPT/dgMetadataDescription} 
    9991                                                {$SRDPT/name} 
    10092                                                {$SRDPT/abbreviation} 
    101                                                 <dgDataProductionTool> 
     93                                                <dgDataProductionTool>  
    10294                                                        {$SRDPT/dgDataProductionTool/contactDetails} 
    10395                                                        {$SRDPT/dgDataProductionTool/dgModel} 
    10496                                                        {$SRDPT/dgDataProductionTool/dgInstrument} 
    10597                                                </dgDataProductionTool> 
    106                                         </dataproductiontool> 
     98                                        </dataproductiontool>} 
     99                                {for $DE in collection('/db/ndg_B_metadata')/*/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgDataEntity/RelatedDeployment/dgMetadataID/repositoryIdentifier=$RelDep/dgMetadataID/repositoryIdentifier and dgDataEntity/RelatedDeployment/dgMetadataID/localIdentifier=$RelDep/dgMetadataID/localIdentifier]  
     100                                return  
     101                                        <dataEntity>  
     102                                                {$DE/dgMetadataID} 
     103                                                {$DE/dgMetadataDescription} 
     104                                                {$DE/name} 
     105                                                {$DE/abbreviation} 
     106                                                <dgDataEntity>  
     107                                                        {$DE/dgDataEntity/dgDataSetType} 
     108                                                        {$DE/dgDataEntity/dgDataObjectType} 
     109                                                        {$DE/dgDataEntity/dgDataGranule} 
     110                                                        {$DE/dgDataEntity/dgDataSummary} 
     111                                                        <dgDataRoles> 
     112                                                                <dgDataCurator>  
     113                                                                        {$DE/dgDataEntity/dgDataRoles/dgDataCurator/dgMetadataID} 
     114                                                                        {$DE/dgDataEntity/dgDataRoles/dgDataCurator/roleName} 
     115                                                                        {$DE/dgDataEntity/dgDataRoles/dgDataCurator/abbreviation} 
     116                                                                        {$DE/dgDataEntity/dgDataRoles/dgDataCurator/contactDetails} 
     117                                                                        {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder   
     118                                                                        order by $DataCuratorRole/startDate empty least, $DataCuratorRole/endDate empty least  
     119                                                                        return   
     120                                                                                <dgRoleHolder>  
     121                                                                                {for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/*/(dgOrganisation | dgPerson)[(dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)]  
     122                                                                                return  
     123                                                                                        $DataCuratorRoleHolder} 
     124                                                                                        {$DataCuratorRole/startDate} 
     125                                                                                        {$DataCuratorRole/endDate} 
     126                                                                                        {$DataCuratorRole/localName} 
     127                                                                                </dgRoleHolder> 
     128                                                                        } 
     129                                                                </dgDataCurator> 
     130                                                        </dgDataRoles> 
     131                                                </dgDataEntity> 
     132                                        </dataEntity>  
     133                                        } 
     134                                </ObsStationDeployment>  
    107135                                } 
    108                         {for $DE in //dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgDataEntity/RelatedDeployment/dgMetadataID/repositoryIdentifier=$RelDep/dgMetadataID/repositoryIdentifier and dgDataEntity/RelatedDeployment/dgMetadataID/localIdentifier=$RelDep/dgMetadataID/localIdentifier] 
    109                                 return 
    110                                 <dataEntity> 
    111                                 {$DE/dgMetadataID} 
    112                                 {$DE/dgMetadataDescription} 
    113                                 {$DE/name} 
    114                                 {$DE/abbreviation} 
    115                                 <dgDataEntity> 
    116                                         {$DE/dgDataEntity/dgDataSetType} 
    117                                         {$DE/dgDataEntity/dgDataObjectType} 
    118                                         {$DE/dgDataEntity/dgDataGranule} 
    119                                         {$DE/dgDataEntity/dgDataSummary} 
    120                                         <dgDataRoles> 
    121                                         <dgDataCurator> 
    122                                                 {$DE/dgDataEntity/dgDataRoles/dgDataCurator/dgMetadataID} 
    123                                                 {$DE/dgDataEntity/dgDataRoles/dgDataCurator/roleName} 
    124                                                 {$DE/dgDataEntity/dgDataRoles/dgDataCurator/abbreviation} 
    125                                                 {$DE/dgDataEntity/dgDataRoles/dgDataCurator/contactDetails} 
    126                                                 {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder  
    127                                                         order by $DataCuratorRole/startDate empty least, $DataCuratorRole/endDate empty least 
    128                                                         return  
    129                                                         <dgRoleHolder> 
    130                                                         {for $DataCuratorRoleHolder in /*/(dgOrganisation | dgPerson)[(dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return $DataCuratorRoleHolder} 
    131                                                                 {$DataCuratorRole/startDate} 
    132                                                                 {$DataCuratorRole/endDate} 
    133                                                                 {$DataCuratorRole/localName} 
    134                                                         </dgRoleHolder>} 
    135                                         </dgDataCurator> 
    136                                         </dgDataRoles> 
    137                                 </dgDataEntity> 
    138                         </dataEntity> 
    139                         } 
    140                 </ObsStationDeployment> 
    141                 } 
    142         </dgObservationStation> 
    143         {$ObsStn/dgStructuredKeyword} 
    144         {$ObsStn/DataProvenance} 
    145         {$ObsStn/MetadataSecurity} 
    146 </dgMetadataRecord> 
     136                        </dgObservationStation>  
     137                        {$ObsStn/dgStructuredKeyword} 
     138                        {$ObsStn/DataProvenance} 
     139                        {$ObsStn/MetadataSecurity} 
     140        </dgMetadataRecord> 
Note: See TracChangeset for help on using the changeset viewer.