Ignore:
Timestamp:
15/02/07 11:54:01 (14 years ago)
Author:
ko23
Message:

Refactoring intermediate

File:
1 edited

Legend:

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

    r2154 r2171  
    11import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    2 import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
     2import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
    33declare default element namespace 'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 
    44declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance';  
     
    77declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    88declare variable $localIdentifier as xs:string {'LocalID'}; 
    9  
    10 voclib:spot-vocab($vocab_root as xs:string, $vocab_uri as xs:string) 
    119 
    1210for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
     
    3533            element Dataset_Title {string($DE/moles:name)} 
    3634        }, 
    37         for $StructuredKeyword in ($DE//(moles:dgStructuredKeyword | moles:dgStdParameterMeasured)[voclib:spot-vocab($voclib:gcmd_science_valids, moles:dgValidTermID/moles:ParentListID) and moles:ListLevel = 0]) 
     35        for $StructuredKeyword in ($DE//(moles:dgStructuredKeyword | moles:dgStdParameterMeasured)[(voclib:spot-vocab($voclib:gcmd_science_valids, moles:dgValidTermID/moles:ParentListID) or voclib:spot-vocab($voclib:gcmd_science_valids_correct, moles:dgValidTermID/moles:ParentListID)) and moles:ListLevel = 0]) 
    3836                return if (exists($StructuredKeyword/*/moles:dgValidTerm)) then  
    3937                    element Parameters { 
     
    5452                    } 
    5553                else(), 
    56         for $ISOTopicCategory in ($DE/moles:dgStructuredKeyword[moles:dgValidTermID/moles:ParentListID='http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopicCategoryCode']) 
     54        for $ISOTopicCategory in ($DE/moles:dgStructuredKeyword[voclib:spot-vocab($voclib:iso_topic_list, moles:dgValidTermID/moles:ParentListID)]) 
    5755            return  
    5856                element ISO_Topic_Category {string($ISOTopicCategory/moles:dgValidTerm)}, 
    5957        for $Keyword in distinct-values($DE//moles:dgStructuredKeyword[ 
    60         moles:dgValidTermID/moles:ParentListID!='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html'   
    61         and  
    62         moles:dgValidTermID/moles:ParentListID!='http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopicCategoryCode'   
    63         ]/moles:dgValidTerm) 
     58        not (voclib:spot-vocab($voclib:iso_topic_list, moles:dgValidTermID/moles:ParentListID) 
     59        or voclib:spot-vocab($voclib:gcmd_science_valids, moles:dgValidTermID/moles:ParentListID) 
     60        or voclib:spot-vocab($voclib:gcmd_science_valids_correct, moles:dgValidTermID/moles:ParentListID) 
     61        )]/moles:dgValidTerm) 
    6462        return element Keyword {string($Keyword)},  
    6563        for $DepDPT in ($DE/moles:dgDataEntity/moles:RelatedDeployment/moles:DataProductionToolID)   
     
    8684                        element End_Date {data($TemporalRange/moles:DateRangeEnd)} 
    8785                        }, 
    88         for $TemporalTerm in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:dgArea/moles:dgValidTerm) 
     86        for $TemporalTerm in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:dgArea[voclib:spot-vocab($voclib:gcmd_chronostratigraphic_valids, moles:dgValidTermID/moles:ParentListID)]/moles:dgValidTerm) 
    8987                return element Paleo_Temporal_Coverage {element Chronostratigraphic_Unit {data($TemporalTerm)}},  
    9088        for $Data_Set_Progress in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataStatus/moles:dgDatasetClosure) 
     
    9896                    element Easternmost_Longitude {data($BoundingBox/moles:LimitEast)} 
    9997                }, 
    100         for $Location in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:dgArea[moles:dgValidTermID/moles:ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_locations.html']) 
     98        for $Location in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:dgArea[voclib:spot-vocab($voclib:gcmd_location_valids, moles:dgValidTermID/moles:ParentListID)]) 
    10199                return element Location {$Location},  
    102100        for $DepAct in ($DE/moles:dgDataEntity/moles:RelatedDeployment/moles:ActivityID) 
Note: See TracChangeset for help on using the changeset viewer.