Changeset 2367 for TI07-MOLES/trunk


Ignore:
Timestamp:
02/04/07 16:48:48 (12 years ago)
Author:
ko23
Message:

Fix of #679

Location:
TI07-MOLES/trunk
Files:
6 edited

Legend:

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

    r2301 r2367  
    1010declare namespace mdip='http://www.oceannet.org/mdip/xml'; 
    1111declare namespace gco='http://www.isotc211.org/2005/gco'; 
    12  
     12(: keep base 
     13declare variable $input_collection as xs:string {'TargetCollection'}; 
     14declare variable $input_repository as xs:string {'Input_Repository_Code'}; 
     15declare variable $input_repository_local as xs:string {'Input_Repository_LocalID'}; 
     16declare variable $input_DatasetIdentifier as xs:string {'Input_Entry_ID'}; 
     17declare variable $output_local_id as xs:string {'Output_LocalID'}; 
     18:) 
    1319declare variable $input_collection as xs:string {'TargetCollection'}; 
    1420declare variable $input_repository as xs:string {'Input_Repository_Code'}; 
     
    254260                                                element CreatedDate {current-date()}, 
    255261                                                element CreatedBy {'MOLES Import'} 
    256                                         }, 
    257                                 if (exists($MDIP/mdip:Last_DIF_Revision_Date)) then 
    258                                         element RecordUpdate { 
    259                                                 element UpdateDate { 
    260                                                         if (string($MDIP/mdip:Last_DIF_Revision_Date) castable as xs:dateTime) then  
    261                                                                 string($MDIP/mdip:Last_DIF_Revision_Date) cast as xs:dateTime 
    262                                                         else (current-dateTime()) 
    263                                                 }, 
    264                                                 element UpdatedBy {$input_repository} 
    265                                         } 
    266                                 else () 
     262                                        } 
    267263                        } (: dgMetadataProvenance :) 
    268264                else () 
  • TI07-MOLES/trunk/PythonCode/wsgi/ndg_xqueries.py

    r2363 r2367  
    1212ObjectTypeQuery = '''declare default element namespace 'http://ndg.nerc.ac.uk/moles';declare variable $targetCollection as xs:string {'TargetCollection'};for $Obj in collection($targetCollection)/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>''' 
    1313 
    14 StubBDEQuery = '''import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
     14StubBDEQuery = '''declare default element namespace 'http://ndg.nerc.ac.uk/moles/dataentity';  
     15declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
     16declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
     17 
     18import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    1519import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
    1620(:  
     
    1822import module namespace stubblib='http://ndg.nerc.ac.uk/xquery/lib/stubb' at 'xmldb:exist:///db/xqueryLib/StubB/stubb_xquery_lib.xquery'; 
    1923:) 
    20 declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
    21 declare default element namespace 'http://ndg.nerc.ac.uk/moles/dataentity';  
    22 declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    23  
    2424declare variable $targetCollection as xs:string {'TargetCollection'}; 
    2525declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
     
    240240and moles:dgMetadataID[ 
    241241moles:schemeIdentifier='NDG-B0'  
    242 and moles:repositoryIdentifier='badc.nerc.ac.uk'  
    243 and moles:localIdentifier='dataent1']] 
     242and moles:repositoryIdentifier=$repositoryIdentifier 
     243and moles:localIdentifier=$localIdentifier]] 
    244244return 
    245245utillib:strip-namespace(element dgMetadataRecord { 
     
    348348    if (exists($DE/moles:dgMetadataSecurity)) then $DE/moles:dgMetadataSecurity else () 
    349349} (: </dgMetadataRecord> :) 
    350 ) (: end of namespace strip :)''' 
    351  
    352 StubBActQuery = '''import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
     350) (: end of namespace strip :) 
     351''' 
     352 
     353StubBActQuery = '''declare default element namespace 'http://ndg.nerc.ac.uk/moles/activity';  
     354declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
     355declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
     356 
     357import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    353358import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
    354359(:  
     
    356361import module namespace stubblib='http://ndg.nerc.ac.uk/xquery/lib/stubb' at 'xmldb:exist:///db/xqueryLib/StubB/stubb_xquery_lib.xquery'; 
    357362:) 
    358 declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
    359 declare default element namespace 'http://ndg.nerc.ac.uk/moles/activity';  
    360 declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    361  
    362363declare variable $targetCollection as xs:string {'TargetCollection'}; 
    363364declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
     
    576577for $Act in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    577578    moles:dgActivity!=''  
    578     and moles:dgMetadataID/moles:schemeIdentifier='NDG-B0'  
    579     and moles:dgMetadataID/moles:repositoryIdentifier='badc.nerc.ac.uk'  
    580     and moles:dgMetadataID/moles:localIdentifier='activity3'] 
    581 return 
     579    and moles:dgMetadataID[ 
     580    moles:schemeIdentifier='NDG-B0'  
     581    and moles:repositoryIdentifier=$repositoryIdentifier 
     582    and moles:localIdentifier=$localIdentifier]] 
     583    return 
    582584utillib:strip-namespace(element dgMetadataRecord { 
    583585    element dgMetadataID { 
     
    961963for $DPT in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    962964    moles:dgDataProductionTool!=''  
    963     and moles:dgMetadataID/moles:schemeIdentifier='NDG-B0'  
    964     and moles:dgMetadataID/moles:repositoryIdentifier='badc.nerc.ac.uk'  
    965     and moles:dgMetadataID/moles:localIdentifier='dpt1']  
    966 return  
     965    and moles:dgMetadataID[ 
     966    moles:schemeIdentifier='NDG-B0'  
     967    and moles:repositoryIdentifier=$repositoryIdentifier 
     968    and moles:localIdentifier=$localIdentifier]] 
     969    return 
    967970utillib:strip-namespace(element dgMetadataRecord {  
    968971    $DPT/dgMetadataID, 
     
    10031006    if (exists($DPT/moles:dgMetadataSecurity)) then $DPT/moles:dgMetadataSecurity else () 
    10041007} (:End </dgMetadataRecord> :) 
    1005 ) (: End namespace strip :)''' 
     1008) (: End namespace strip :) 
     1009''' 
    10061010 
    10071011StubBObsStnQuery = '''declare default element namespace 'http://ndg.nerc.ac.uk/moles/observationstation';  
     
    12301234 
    12311235for $ObsStn in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    1232     moles:dgObservationStation!='' and moles:dgMetadataID/moles:schemeIdentifier='NDG-B0'  
    1233     and moles:dgMetadataID/moles:repositoryIdentifier='badc.nerc.ac.uk'  
    1234     and moles:dgMetadataID/moles:localIdentifier='obs1']  
    1235 return  
    1236 utillib:strip-namespace( 
     1236    moles:dgObservationStation!=''  
     1237    and moles:dgMetadataID[ 
     1238    moles:schemeIdentifier='NDG-B0'  
     1239    and moles:repositoryIdentifier=$repositoryIdentifier 
     1240    and moles:localIdentifier=$localIdentifier]] 
     1241    return 
     1242    utillib:strip-namespace( 
    12371243    element dgMetadataRecord { 
    12381244        element dgMetadataID { 
     
    12951301    if (exists($ObsStn/moles:dgMetadataSecurity)) then $ObsStn/moles:dgMetadataSecurity else () 
    12961302    } (: End </dgMetadataRecord> :) 
    1297 ) (: End namespace strip :)''' 
     1303) (: End namespace strip :) 
     1304''' 
    12981305 
    12991306ISO19139Query = ''' 
  • TI07-MOLES/trunk/StubB/XQuery/NDG-ActStubB.xquery

    r2236 r2367  
     1declare default element namespace 'http://ndg.nerc.ac.uk/moles/activity';  
     2declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
     3declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
     4 
    15import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    26import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
     
    59import module namespace stubblib='http://ndg.nerc.ac.uk/xquery/lib/stubb' at 'xmldb:exist:///db/xqueryLib/StubB/stubb_xquery_lib.xquery'; 
    610:) 
    7 declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
    8 declare default element namespace 'http://ndg.nerc.ac.uk/moles/activity';  
    9 declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    10  
    1111declare variable $targetCollection as xs:string {'TargetCollection'}; 
    1212declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
     
    225225for $Act in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    226226    moles:dgActivity!=''  
    227     and moles:dgMetadataID/moles:schemeIdentifier='NDG-B0'  
    228     and moles:dgMetadataID/moles:repositoryIdentifier='badc.nerc.ac.uk'  
    229     and moles:dgMetadataID/moles:localIdentifier='activity3'] 
    230 return 
     227    and moles:dgMetadataID[ 
     228    moles:schemeIdentifier='NDG-B0'  
     229    and moles:repositoryIdentifier=$repositoryIdentifier 
     230    and moles:localIdentifier=$localIdentifier]] 
     231    return 
    231232utillib:strip-namespace(element dgMetadataRecord { 
    232233    element dgMetadataID { 
  • TI07-MOLES/trunk/StubB/XQuery/NDG-DEStubB.xquery

    r2236 r2367  
     1declare default element namespace 'http://ndg.nerc.ac.uk/moles/dataentity';  
     2declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
     3declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
     4 
    15import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    26import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
     
    59import module namespace stubblib='http://ndg.nerc.ac.uk/xquery/lib/stubb' at 'xmldb:exist:///db/xqueryLib/StubB/stubb_xquery_lib.xquery'; 
    610:) 
    7 declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
    8 declare default element namespace 'http://ndg.nerc.ac.uk/moles/dataentity';  
    9 declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    10  
    1111declare variable $targetCollection as xs:string {'TargetCollection'}; 
    1212declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
     
    227227and moles:dgMetadataID[ 
    228228moles:schemeIdentifier='NDG-B0'  
    229 and moles:repositoryIdentifier='badc.nerc.ac.uk'  
    230 and moles:localIdentifier='dataent1']] 
     229and moles:repositoryIdentifier=$repositoryIdentifier 
     230and moles:localIdentifier=$localIdentifier]] 
    231231return 
    232232utillib:strip-namespace(element dgMetadataRecord { 
  • TI07-MOLES/trunk/StubB/XQuery/NDG-DPTStubB.xquery

    r2236 r2367  
    225225for $DPT in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    226226    moles:dgDataProductionTool!=''  
    227     and moles:dgMetadataID/moles:schemeIdentifier='NDG-B0'  
    228     and moles:dgMetadataID/moles:repositoryIdentifier='badc.nerc.ac.uk'  
    229     and moles:dgMetadataID/moles:localIdentifier='dpt1']  
    230 return  
     227    and moles:dgMetadataID[ 
     228    moles:schemeIdentifier='NDG-B0'  
     229    and moles:repositoryIdentifier=$repositoryIdentifier 
     230    and moles:localIdentifier=$localIdentifier]] 
     231    return 
    231232utillib:strip-namespace(element dgMetadataRecord {  
    232233    $DPT/dgMetadataID, 
  • TI07-MOLES/trunk/StubB/XQuery/NDG-ObsStnStubB.xquery

    r2236 r2367  
    224224 
    225225for $ObsStn in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
    226     moles:dgObservationStation!='' and moles:dgMetadataID/moles:schemeIdentifier='NDG-B0'  
    227     and moles:dgMetadataID/moles:repositoryIdentifier='badc.nerc.ac.uk'  
    228     and moles:dgMetadataID/moles:localIdentifier='obs1']  
    229 return  
    230 utillib:strip-namespace( 
     226    moles:dgObservationStation!=''  
     227    and moles:dgMetadataID[ 
     228    moles:schemeIdentifier='NDG-B0'  
     229    and moles:repositoryIdentifier=$repositoryIdentifier 
     230    and moles:localIdentifier=$localIdentifier]] 
     231    return 
     232    utillib:strip-namespace( 
    231233    element dgMetadataRecord { 
    232234        element dgMetadataID { 
Note: See TracChangeset for help on using the changeset viewer.