Changeset 5166


Ignore:
Timestamp:
03/04/09 14:43:44 (10 years ago)
Author:
sdonegan
Message:

Updated ndgCommon xqueries with latest developments from production ndgUtils branch..

Location:
ndgCommon/trunk/ndg/common/xmldb/xquery
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/xmldb/xquery/dif2moles.xq

    r4938 r5166  
    1 (: This query produces one MOLES data entity plus one organisation entry for a given DIF instance 
     1(: This query produces one MOLES data entity plus one organisation entry for a given DIF instance 
    22   Input is TargetCollection (where the DIF exists), RepositoryID, where the existing DIF lies, and 
    33   expected to be the output RepositoryID (fix it in the output xml if it's wrong), and Input_EntryID 
     
    88(: dgPersons are not created as one can't tell automatically which are people and which are orgs, and orgs are simpler :)   
    99 
     10(: 
    1011import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    1112import module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'xmldb:exist:///db/xqueryLib/Utilities/inputParse_xquery_lib.xquery'; 
     13:) 
     14import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'vocab_xquery_lib.xquery'; 
     15import module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'inputParse_xquery_lib.xquery'; 
     16 
    1217 
    1318declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 
     
    194199            element DateRange { 
    195200                element DateRangeStart {string($temporalcoverage/dif:Start_Date)}, 
    196                 element DateRangeEnd {string($temporalcoverage/dif:Stop_Date)} 
     201                element DateRangeEnd {string($temporalcoverage/dif:End_Date)} 
    197202            }, 
    198203            for $paleotemporalcoverage in $DIF/dif:Paleo_Temporal_Coverage[exists(dif:Paleo_Start_Date)] 
     
    310315element dgValidTerm {string($structuredKeywords)}, 
    311316element dgValidTermID { 
    312 if ($structuredKeywords='MDIP' or $structuredKeywords='NERC' or $structuredKeywords='NERC_DDC' or $structuredKeywords='DPPP') then 
     317if ($structuredKeywords='MDIP' or $structuredKeywords='NERC' or $structuredKeywords='NERC_DDC' or $structuredKeywords='DPPP' or $structuredKeywords='ERFF') then 
    313318element ParentListID {concat($voclib:ndg_data_provider_vocab, '/current')} 
    314319else 
  • ndgCommon/trunk/ndg/common/xmldb/xquery/mdip2moles.xq

    r4938 r5166  
    44(: Not producing valid MOLES as still got to work out parameter vocabulary namespaces in the subject field :)   
    55 
    6 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    7 import module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'xmldb:exist:///db/xqueryLib/Utilities/inputParse_xquery_lib.xquery'; 
     6import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'vocab_xquery_lib.xquery'; 
     7import module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'inputParse_xquery_lib.xquery'; 
    88 
    99declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 
  • ndgCommon/trunk/ndg/common/xmldb/xquery/moles2dif.xq

    r4938 r5166  
    1 declare default element namespace 'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 
     1declare default element namespace 'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 
    22declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance'; 
    33declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    44declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
    55 
    6 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    7 import module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'xmldb:exist:///db/xqueryLib/Utilities/inputParse_xquery_lib.xquery'; 
     6 
     7import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'vocab_xquery_lib.xquery'; 
     8import module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'inputParse_xquery_lib.xquery'; 
    89 
    910 
     
    274275                        (: fail safe... :) 
    275276                        (: SJD Updated to pull straight from dgOrganisation as "backup fail safe" :) 
     277                        (: work out how many dgOrganisation elements there are - if more than 2 take the first :)              
    276278                        if (exists(collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation)) then 
    277                             element Data_Center { 
     279                            if (count(collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation) = 1) then                              
     280                              element Data_Center { 
    278281                                element Data_Center_Name { 
    279282                                    element Short_Name {data(collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation/moles:abbreviation)}, 
    280283                                    element Long_Name {data(collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation/moles:name)} 
    281284                                }, 
    282                                 element Data_Center_URL {data(collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation/moles:contactDetails/moles:URI) cast as xs:anyURI}, 
     285                                element Data_Center_URL {data(collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation/moles:contactDetails/moles:URI) cast as xs:anyURI},                                  
     286                                element Personnel { 
     287                                    element Role {''}, 
     288                                    element Last_Name {''} 
     289                                 } 
     290                            } 
     291                             else  
     292                                 element Data_Center { 
     293                                element Data_Center_Name { 
     294                                    element Short_Name {data(collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation[1]/moles:abbreviation)}, 
     295                                    element Long_Name {data(collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation[1]/moles:name)} 
     296                                }, 
     297                                element Data_Center_URL {data(collection($targetCollection)/moles:dgMetadata/moles:dgOrganisation[1]/moles:contactDetails/moles:URI) cast as xs:anyURI},                                  
    283298                                element Personnel { 
    284299                                    element Role {''}, 
     
    300315        element Multimedia_Sample {''}, 
    301316        element Reference {''}, 
    302         element Summary {string($DE/moles:dgMetadataDescription/moles:abstract/moles:abstractText)}, 
     317        element Summary {data($DE/moles:dgMetadataDescription/moles:abstract/moles:abstractText)}, 
    303318        for $DG in $DE/moles:dgDataEntity/moles:dgDataGranule 
    304319            (: BNL need to make sure we have a function for doing related URLs :) 
  • ndgCommon/trunk/ndg/common/xmldb/xquery/moles2mdip.xq

    r4996 r5166  
    1 (: This xquery for TargetCollection RepositoryID and LocalID will find and convert Moles to MDIP format :) 
    2 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    3 import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
     1(: Create an MDIP record for moles documents in /misc/humid1/cbyrom/eclipseWorkspace/ingestAutomation-upgrade2/OAIBatch/data/badc/discovery/moles/ that have badc.nerc.ac.uk and test_file2 :) 
     2import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'vocab_xquery_lib.xquery'; 
     3import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'utility_xquery_lib.xquery'; 
    44 
    55declare default element namespace 'http://www.oceannet.org/mdip/xml'; 
     
    113113             if ($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange/moles:DateRangeStart) != '') then 
    114114                element DatasetStartDate { 
    115                     let $dateStart:=min($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange/moles:DateRangeStart)) 
     115                    let $dateStart:=($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange/moles:DateRangeStart)) 
    116116                    return  
    117117                        if (empty($dateStart)) then ()  
     
    123123            if ($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange/moles:DateRangeEnd) != '') then 
    124124                element DatasetEndDate{ 
    125                   let $dateEnd:=max($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange/moles:DateRangeEnd)) 
     125                  let $dateEnd:=($DE//moles:dgTemporalCoverage/(moles:DateSingle | moles:DateRange/moles:DateRangeEnd)) 
    126126                  return 
    127127                    if (empty($dateEnd)) then ()  
Note: See TracChangeset for help on using the changeset viewer.