Changeset 2372 for TI07-MOLES/trunk


Ignore:
Timestamp:
03/04/07 13:13:58 (12 years ago)
Author:
ko23
Message:

Fix MDIP2MOLES cast (see #655)

Location:
TI07-MOLES/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/MDIP/XQueries/NDG-MDIP.xquery

    r2363 r2372  
    1818 
    1919for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    20         exists('moles:dgDataEntity')  
    21         and moles:dgMetadataID/moles:schemeIdentifier='NDG-B0'  
    22         and moles:dgMetadataID/moles:repositoryIdentifier=$repositoryIdentifier 
    23         and moles:dgMetadataID/moles:localIdentifier=$localIdentifier] 
     20exists('moles:dgDataEntity')  
     21and moles:dgMetadataID/moles:schemeIdentifier='NDG-B0'  
     22and moles:dgMetadataID/moles:repositoryIdentifier=$repositoryIdentifier 
     23and moles:dgMetadataID/moles:localIdentifier=$localIdentifier] 
    2424return 
    2525element Metadata { 
    26         element Title {data($DE/moles:name)}, 
    27         if (exists($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDatasetLanguage)) then 
    28                 for $lang in $DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDatasetLanguage 
    29                 return 
    30                         element Language{ 
    31                                 element LanguageName {data($lang/moles:dgValidTerm)}, 
    32                                 element LanguageVocab {data($lang/moles:dgValidTermID/moles:ParentListID)}, 
    33                                 element LanguageCode {data($lang/moles:dgValidTermID/moles:TermID)} 
    34                         } 
    35                                  
    36         else (), 
     26element Title {data($DE/moles:name)}, 
     27if (exists($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDatasetLanguage)) then 
     28for $lang in $DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDatasetLanguage 
     29return 
     30element Language{ 
     31element LanguageName {data($lang/moles:dgValidTerm)}, 
     32element LanguageVocab {data($lang/moles:dgValidTermID/moles:ParentListID)}, 
     33element LanguageCode {data($lang/moles:dgValidTermID/moles:TermID)} 
     34} 
    3735 
    38         element Abstract {string($DE/moles:dgMetadataDescription/moles:abstract/moles:abstractText)}, 
    39         for $isoTopic in $DE/moles:dgStructuredKeyword[voclib:spot-vocab($voclib:iso_topic_list, moles:dgValidTermID/moles:ParentListID)]  
    40         return element TopicCategory { 
    41         element TopicCategoryName {data($isoTopic/moles:dgValidTerm)}, 
    42         element TopicCategoryVocab {data($isoTopic/moles:dgValidTermID/moles:ParentListID)}, 
    43         element TopicCategoryCode {data($isoTopic/moles:dgValidTermID/moles:TermID)} 
    44         }, 
    45         for $subject in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgParameterSummary/moles:dgStdParameterMeasured[ 
    46         voclib:spot-vocab($voclib:gcmd_science_valids, moles:dgValidTermID/moles:ParentListID)  
    47         or voclib:spot-vocab($voclib:gcmd_project_valids, moles:dgValidTermID/moles:ParentListID) 
    48         or voclib:spot-vocab($voclib:gcmd_science_valids_categories, moles:dgValidTermID/moles:ParentListID) 
    49         or voclib:spot-vocab($voclib:bodc_parameter_usage_vocab, moles:dgValidTermID/moles:ParentListID) 
    50         or voclib:spot-vocab($voclib:bodc_parameter_discovery_vocab, moles:dgValidTermID/moles:ParentListID) 
    51         ])  
    52         return (element Subject { 
    53         element SubjectName {data($subject/moles:dgValidTerm)}, 
    54         element SubjectVocab {data($subject/moles:dgValidTermID/moles:ParentListID)}, 
    55         element SubjectCode {data($subject/moles:dgValidTermID/moles:TermID)} 
    56         }, 
    57         for $subterm in $subject//moles:dgValidSubterm 
    58         return (element Subject { 
    59         element SubjectName {data($subterm/moles:dgValidTerm)}, 
    60         element SubjectVocab {data($subterm/moles:dgValidTermID/moles:ParentListID)}, 
    61         element SubjectCode {data($subterm/moles:dgValidTermID/moles:TermID)} 
    62         } 
    63         ) 
    64         ), 
    65         if (exists($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange))) then  
    66         element Date { 
    67                 element DatasetStartDate { 
    68                 let $dateStart:=min($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange/moles:DateRangeStart) cast as xs:date) 
    69                 return  
    70                 if (empty($dateStart)) then ()  
    71                 else data($dateStart) 
    72                 }, 
    73                 element DatasetEndDate { 
    74                 let $dateEnd:=max($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange/moles:DateRangeEnd) cast as xs:date) 
    75                 return 
    76                 if (empty($dateEnd)) then ()  
    77                 else data($dateEnd) 
    78                 } 
    79         } 
    80         else (), 
    81         let $west := min($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitWest cast as xs:integer) 
    82         return element WestCoOrdinate {data($west)}, 
    83         let $east := max($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitEast cast as xs:integer) 
    84         return element EastCoOrdinate {data($east)}, 
    85         let $north := max($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitNorth cast as xs:integer) 
    86         return element NorthCoOrdinate {data($north)}, 
    87         let $south := min($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitSouth cast as xs:integer) 
    88         return element SouthCoOrdinate {data($south)}, 
    89         element DatasetIdentifier {concat($DE/moles:dgMetadataID/moles:repositoryIdentifier, $utillib:moles_id_separator, 'MDIP', $utillib:moles_id_separator, $DE/moles:dgMetadataID/moles:localIdentifier)}, 
    90         for $target in $DE/moles:dgStructuredKeyword[voclib:spot-vocab($voclib:ndg_data_provider_vocab, moles:dgValidTermID/moles:ParentListID) ] 
    91         return element Target { 
    92         element TargetName {data($target/moles:dgValidTerm)}, 
    93         element TargetVocab {data($target/moles:dgValidTermID/moles:ParentListID)}, 
    94         element TargetCode {data($target/moles:dgValidTermID/moles:TermID)} 
    95         } 
    96         } 
     36else (), 
     37 
     38element Abstract {string($DE/moles:dgMetadataDescription/moles:abstract/moles:abstractText)}, 
     39for $isoTopic in $DE/moles:dgStructuredKeyword[voclib:spot-vocab($voclib:iso_topic_list, moles:dgValidTermID/moles:ParentListID)]  
     40return element TopicCategory { 
     41element TopicCategoryName {data($isoTopic/moles:dgValidTerm)}, 
     42element TopicCategoryVocab {data($isoTopic/moles:dgValidTermID/moles:ParentListID)}, 
     43element TopicCategoryCode {data($isoTopic/moles:dgValidTermID/moles:TermID)} 
     44}, 
     45for $subject in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgParameterSummary/moles:dgStdParameterMeasured[ 
     46voclib:spot-vocab($voclib:gcmd_science_valids, moles:dgValidTermID/moles:ParentListID)  
     47or voclib:spot-vocab($voclib:gcmd_project_valids, moles:dgValidTermID/moles:ParentListID) 
     48or voclib:spot-vocab($voclib:gcmd_science_valids_categories, moles:dgValidTermID/moles:ParentListID) 
     49or voclib:spot-vocab($voclib:bodc_parameter_usage_vocab, moles:dgValidTermID/moles:ParentListID) 
     50or voclib:spot-vocab($voclib:bodc_parameter_discovery_vocab, moles:dgValidTermID/moles:ParentListID) 
     51])  
     52return (element Subject { 
     53element SubjectName {data($subject/moles:dgValidTerm)}, 
     54element SubjectVocab {data($subject/moles:dgValidTermID/moles:ParentListID)}, 
     55element SubjectCode {data($subject/moles:dgValidTermID/moles:TermID)} 
     56}, 
     57for $subterm in $subject//moles:dgValidSubterm 
     58return (element Subject { 
     59element SubjectName {data($subterm/moles:dgValidTerm)}, 
     60element SubjectVocab {data($subterm/moles:dgValidTermID/moles:ParentListID)}, 
     61element SubjectCode {data($subterm/moles:dgValidTermID/moles:TermID)} 
     62} 
     63) 
     64), 
     65if (exists($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange))) then  
     66element Date { 
     67element DatasetStartDate { 
     68let $dateStart:=min($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange/moles:DateRangeStart) cast as xs:date) 
     69return  
     70if (empty($dateStart)) then ()  
     71else data($dateStart) 
     72}, 
     73element DatasetEndDate { 
     74let $dateEnd:=max($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange/moles:DateRangeEnd) cast as xs:date) 
     75return 
     76if (empty($dateEnd)) then ()  
     77else data($dateEnd) 
     78} 
     79} 
     80else (), 
     81let $west := min($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitWest cast as xs:decimal) 
     82return element WestCoOrdinate {data($west)}, 
     83let $east := max($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitEast cast as xs:decimal) 
     84return element EastCoOrdinate {data($east)}, 
     85let $north := max($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitNorth cast as xs:decimal) 
     86return element NorthCoOrdinate {data($north)}, 
     87let $south := min($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitSouth cast as xs:decimal) 
     88return element SouthCoOrdinate {data($south)}, 
     89element DatasetIdentifier {concat($DE/moles:dgMetadataID/moles:repositoryIdentifier, $utillib:moles_id_separator, 'MDIP', $utillib:moles_id_separator, $DE/moles:dgMetadataID/moles:localIdentifier)}, 
     90for $target in $DE/moles:dgStructuredKeyword[voclib:spot-vocab($voclib:ndg_data_provider_vocab, moles:dgValidTermID/moles:ParentListID) ] 
     91return element Target { 
     92element TargetName {data($target/moles:dgValidTerm)}, 
     93element TargetVocab {data($target/moles:dgValidTermID/moles:ParentListID)}, 
     94element TargetCode {data($target/moles:dgValidTermID/moles:TermID)} 
     95} 
     96} 
  • TI07-MOLES/trunk/PythonCode/wsgi/ndg_xqueries.py

    r2367 r2372  
    19141914declare namespace gco='http://www.isotc211.org/2005/gco'; 
    19151915declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance';  
    1916  
    19171916declare variable $targetCollection as xs:string {'TargetCollection'}; 
    19181917declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    19191918declare variable $localIdentifier as xs:string {'LocalID'}; 
    1920  
    19211919declare variable $ISO_639-2_ns as xs:string{$voclib:ISO_639-2_ns}; 
    19221920declare variable $ISO_3166_ns as xs:string{$voclib:ISO_3166_ns}; 
     
    19841982    } 
    19851983    else (), 
    1986     let $west := min($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitWest cast as xs:integer) 
     1984    let $west := min($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitWest cast as xs:decimal) 
    19871985    return element WestCoOrdinate {data($west)}, 
    1988     let $east := max($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitEast cast as xs:integer) 
     1986    let $east := max($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitEast cast as xs:decimal) 
    19891987    return element EastCoOrdinate {data($east)}, 
    1990     let $north := max($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitNorth cast as xs:integer) 
     1988    let $north := max($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitNorth cast as xs:decimal) 
    19911989    return element NorthCoOrdinate {data($north)}, 
    1992     let $south := min($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitSouth cast as xs:integer) 
     1990    let $south := min($DE/moles:dgDataEntity/moles:dgDataSummary//moles:BoundingBox/moles:LimitSouth cast as xs:decimal) 
    19931991    return element SouthCoOrdinate {data($south)}, 
    19941992    element DatasetIdentifier {concat($DE/moles:dgMetadataID/moles:repositoryIdentifier, $utillib:moles_id_separator, 'MDIP', $utillib:moles_id_separator, $DE/moles:dgMetadataID/moles:localIdentifier)}, 
Note: See TracChangeset for help on using the changeset viewer.