Changeset 2132


Ignore:
Timestamp:
09/02/07 11:38:07 (12 years ago)
Author:
ko23
Message:

Refactoring intermediate

Location:
TI07-MOLES/trunk
Files:
18 added
3 edited

Legend:

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

    r2077 r2132  
    33declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance';  
    44declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    5 declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
     5declare variable $targetCollection as xs:string {'TargetCollection'}; 
     6declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
     7declare variable $localIdentifier as xs:string {'LocalID'}; 
    68 
    7 for $DE in collection('/db/ndg_B_metadata')/moles:dgMetadata/moles:dgMetadataRecord[ 
     9for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    810        exists('moles:dgDataEntity')  
    911        and moles:dgMetadataID/moles:schemeIdentifier='NDG-B0'  
    10         and moles:dgMetadataID/moles:repositoryIdentifier='grid.bodc.nerc.ac.uk'  
    11         and moles:dgMetadataID/moles:localIdentifier='HGFS3751'] 
     12        and moles:dgMetadataID/moles:repositoryIdentifier=$repositoryIdentifier 
     13        and moles:dgMetadataID/moles:localIdentifier=$localIdentifier] 
    1214return 
    1315element DIF { 
     
    1820            for $DataCreatorRole in $DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCreator/moles:dgRoleHolder[not(exists(moles:endDate)) or moles:endDate=''][1] 
    1921                return  
    20                     for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/moles:dgMetadata/*[(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 
     22                    for $DataCreatorRoleHolder in collection($targetCollection)/moles:dgMetadata/*[(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 
    2123                               and moles:dgMetadataID/moles:repositoryIdentifier=$DataCreatorRole/*/moles:repositoryIdentifier 
    2224                               and moles:dgMetadataID/moles:localIdentifier=$DataCreatorRole/*/moles:localIdentifier)] 
     
    6163        return  
    6264            element Sensor_Name { 
    63                 for $DepDPTAbbrev in distinct-values((collection('/db/ndg_B_metadata')/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:abbreviation)) 
     65                for $DepDPTAbbrev in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:abbreviation)) 
    6466                    return element Short_Name {data($DepDPTAbbrev)}, 
    65                 for $DepDPTName in distinct-values((collection('/db/ndg_B_metadata')/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:name)) 
     67                for $DepDPTName in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:name)) 
    6668                    return element Long_Name {data($DepDPTName)} 
    6769                }, 
     
    6971        return  
    7072            element Source_Name { 
    71                 for $DepObsStnAbbrev in distinct-values((collection('/db/ndg_B_metadata')/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:abbreviation)) 
     73                for $DepObsStnAbbrev in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:abbreviation)) 
    7274                    return element Short_Name {data($DepObsStnAbbrev)}, 
    73                 for $DepObsStnName in distinct-values((collection('/db/ndg_B_metadata')/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:name)) 
     75                for $DepObsStnName in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:name)) 
    7476                    return element Long_Name {data($DepObsStnName)} 
    7577                }, 
     
    98100        return  
    99101            element Project { 
    100                 for $DepActAbbrev in distinct-values(collection('/db/ndg_B_metadata')/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepAct/moles:repositoryIdentifier and moles:localIdentifier=$DepAct/moles:localIdentifier]]/moles:abbreviation) 
     102                for $DepActAbbrev in distinct-values(collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepAct/moles:repositoryIdentifier and moles:localIdentifier=$DepAct/moles:localIdentifier]]/moles:abbreviation) 
    101103                    return  
    102104                        element Short_Name {data($DepActAbbrev)}, 
    103                 for $DepActName in distinct-values(collection('/db/ndg_B_metadata')/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepAct/moles:repositoryIdentifier and moles:localIdentifier=$DepAct/moles:localIdentifier]]/moles:name) 
     105                for $DepActName in distinct-values(collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepAct/moles:repositoryIdentifier and moles:localIdentifier=$DepAct/moles:localIdentifier]]/moles:name) 
    104106                    return  
    105107                        element Long_Name {data($DepActName)} 
     
    128130                    order by $DataCreatorRole/moles:startDate empty least 
    129131                            return  
    130                                 for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/moles:dgMetadata/(moles:dgOrganisation | moles:dgPerson) 
     132                                for $DataCreatorRoleHolder in collection($targetCollection)/moles:dgMetadata/(moles:dgOrganisation | moles:dgPerson) 
    131133                                                [(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 
    132134                                                and moles:dgMetadataID/moles:repositoryIdentifier=$DataCreatorRole/(moles:dgOrganisationID | moles:dgPersonID)/moles:repositoryIdentifier 
     
    143145        for $DataCuratorRole in $DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCurator/moles:dgRoleHolder[not(exists(moles:endDate)) or moles:endDate=''] 
    144146            return  
    145                 for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/moles:dgMetadata/*[(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 
     147                for $DataCuratorRoleHolder in collection($targetCollection)/moles:dgMetadata/*[(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 
    146148                   and moles:dgMetadataID/moles:repositoryIdentifier=$DataCuratorRole/*/moles:repositoryIdentifier 
    147149                   and moles:dgMetadataID/moles:localIdentifier=$DataCuratorRole/*/moles:localIdentifier)] 
  • TI07-MOLES/trunk/DublinCore/XQuery/NDG-DublinCore.xquery

    r2077 r2132  
    44declare namespace dc='http://purl.org/dc/elements/1.1/'; 
    55declare namespace oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc'; 
    6 declare variable $targetCollection as xs:string {'/db/ndg_B_metadata'}; 
    7 declare variable $gcmd_science_valids as xs:string {'http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html'}; 
    8 declare variable $gcmd_project_valids as xs:string {'http://gcmd.gsfc.nasa.gov/Resources/valids/projects.html'}; 
    9 declare variable $cf_standard_names as xs:string {'http://www.cgd.ucar.edu/cms/eaton/cf-metadata/standard_name.html'}; 
    10 declare variable $iso_topic_list as xs:string {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopicCategoryCode'}; 
     6declare variable $targetCollection as xs:string {'TargetCollection'}; 
     7declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
     8declare variable $localIdentifier as xs:string {'LocalID'}; 
    119 
    12 for $DE in collection($targetCollection)/dgMetadata/dgMetadataRecord[dgDataEntity!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='badc.nerc.ac.uk' and dgMetadataID/localIdentifier='dataent1'] 
     10for $DE in collection($targetCollection)/dgMetadata/dgMetadataRecord[ 
     11exists('dgDataEntity')  
     12and dgMetadataID/schemeIdentifier='NDG-B0'  
     13and dgMetadataID/repositoryIdentifier=$repositoryIdentifier 
     14and dgMetadataID/localIdentifier=$localIdentifier] 
    1315return  
    1416element oai_dc:dc { 
Note: See TracChangeset for help on using the changeset viewer.