Changeset 3841 for exist/trunk/xquery


Ignore:
Timestamp:
01/05/08 14:28:47 (12 years ago)
Author:
cbyrom
Message:

Various updates to the xquery files - to remove usage of invalid specs
and dependency on obsolete function calls. Also add the inputParse_xquery_lib.xquery
file - referenced from the xquery files but not currently included in codebase.
NB, changes made to allow use of Saxon java library to do xqueries - to
remove the need for the discovery service eXist DB.

  • NB, also changes tested by comparing saxon transforms to eXist ones; these

were found to be identical.

Location:
exist/trunk/xquery
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/xquery/DIFList.xq

    r3163 r3841  
    11(: This is a DIF listing query for TargetCollection - returns EntryIDs and the files in which they exist :) 
    22declare default element namespace 'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 
    3 declare variable $targetCollection as xs:string {'TargetCollection'}; 
     3declare variable $targetCollection as xs:string := 'TargetCollection'; 
    44for $DE in collection($targetCollection)/DIF/Entry_ID let $f:=util:document-name($DE) return  
    55<dgMetadataRecord> 
  • exist/trunk/xquery/MDIPList.xq

    r3181 r3841  
    11declare default element namespace 'http://www.oceannet.org/mdip/xml'; 
    2 declare variable $targetCollection as xs:string {'TargetCollection'}; 
     2declare variable $targetCollection as xs:string := 'TargetCollection'; 
    33for $DE in collection($targetCollection)/Metadata/DatasetIdentifier 
    44let $f:=util:document-name($DE) 
  • exist/trunk/xquery/dif2moles.xq

    r3151 r3841  
    77(: Note algoritm for creating non-pre-existing organisations :) 
    88(: dgPersons are not created as one can't tell automatically which are people and which are orgs, and orgs are simpler :)   
     9 
    910import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    1011import module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'xmldb:exist:///db/xqueryLib/Utilities/inputParse_xquery_lib.xquery'; 
     12 
    1113declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 
    1214declare namespace dif='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 
    1315declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance';  
    1416 
    15 (: Keep as an example, but note the entryID in the dif is an 
    16    NDG format ID, so the example isn't as obvious .... 
    17 declare variable $targetCollection as xs:string {'/db/discovery/original/ndg.noc.soton.ac.uk'}; 
    18 declare variable $input_repository as xs:string {'ndg.noc.soton.ac.uk'}; 
    19 declare variable $input_repository_local as xs:string {'nocs'}; 
    20 declare variable $input_entry_id as xs:string {'ndg.noc.soton.ac.uk__DIF__NOCSDAT110'}; 
    21 declare variable $output_local_id as xs:string {'NOCS_DAT110'}; 
    22 :) 
    2317(: Replacable parameters :) 
    24 declare variable $targetCollection as xs:string {'TargetCollection'}; 
    25 declare variable $input_repository as xs:string {'RepositoryID'}; 
    26 declare variable $input_repository_local as xs:string {'repository_localid'}; 
    27 declare variable $input_entry_id as xs:string {'Input_Entry_ID'}; 
    28 declare variable $output_local_id as xs:string {'LocalID'}; 
     18declare variable $targetCollection as xs:string := 'TargetCollection'; 
     19declare variable $input_repository as xs:string := 'RepositoryID'; 
     20declare variable $input_repository_local as xs:string := 'repository_localid'; 
     21declare variable $input_entry_id as xs:string := 'Input_Entry_ID'; 
     22declare variable $output_local_id as xs:string := 'LocalID'; 
    2923 
    3024for $DIF in collection($targetCollection)/dif:DIF[dif:Entry_ID=$input_entry_id] 
     
    4741element localIdentifier {concat('generated_desc-', $output_local_id)} 
    4842else 
    49 element localIdentifier {concat('generated_desc-', escape-uri(string($DIF/dif:Entry_ID), true()))} 
     43element localIdentifier {concat('generated_desc-', encode-for-uri(string($DIF/dif:Entry_ID)))} 
    5044}, 
    5145element metadataDescriptionLastUpdated {current-date()}                 , 
     
    5852element descriptionSection { 
    5953element descriptionOnlineReference { 
    60 element dgSimpleLink {escape-uri(data($descOnline/dif:URL), true())}}, 
     54element dgSimpleLink {encode-for-uri(data($descOnline/dif:URL))}}, 
    6155if (exists($descOnline/dif:URL_Content_Type)) then  
    6256element dgReferenceName {data($descOnline/dif:URL_Content_Type)} 
     
    7973element dgValidTermID { 
    8074element ParentListID {$voclib:unknown_vocab_id}, 
    81 element TermID {escape-uri('dummy unit', true())} 
     75element TermID {encode-for-uri('dummy unit')} 
    8276} 
    8377} 
     
    8983element dgValidTermID { 
    9084element ParentListID {concat($voclib:gcmd_science_valids_categories, '/current')}, 
    91 element TermID {escape-uri($parameter/dif:Category, true())} 
     85element TermID {encode-for-uri($parameter/dif:Category)} 
    9286}, 
    9387element dgValidSubterm { 
     
    9690element dgValidTermID { 
    9791element ParentListID {concat($voclib:gcmd_science_valids_topics, '/current')}, 
    98 element TermID {escape-uri($parameter/dif:Topic, true())} 
     92element TermID {encode-for-uri($parameter/dif:Topic)} 
    9993}, 
    10094element dgValidSubterm { 
     
    10397element dgValidTermID { 
    10498element ParentListID {concat($voclib:gcmd_science_valids_terms, '/current')}, 
    105 element TermID {escape-uri($parameter/dif:Term, true())} 
     99element TermID {encode-for-uri($parameter/dif:Term)} 
    106100}, 
    107101if (exists($parameter/dif:Variable) and $parameter/dif:Variable!='') then 
     
    110104element dgValidTermID { 
    111105element ParentListID {concat($voclib:gcmd_science_valids_variables, '/current')}, 
    112 element TermID {escape-uri($parameter/dif:Variable, true())} 
     106element TermID {encode-for-uri($parameter/dif:Variable)} 
    113107}, 
    114108if (exists($parameter/dif:Detailed_Variable) and $parameter/dif:Detailed_Variable!='') then 
     
    117111element dgValidTermID { 
    118112element ParentListID {$voclib:unknown_vocab_id}, 
    119 element TermID {escape-uri($parameter/dif:Detailed_Variable, true())} 
     113element TermID {encode-for-uri($parameter/dif:Detailed_Variable)} 
    120114}, 
    121115element ListLevel {4}} 
     
    170164element dgValidTermID { 
    171165element ParentListID {concat($voclib:gcmd_location_valids, '/current')}, 
    172 element TermID {escape-uri($location, true())} 
     166element TermID {encode-for-uri($location)} 
    173167} 
    174168} 
     
    195189element dgValidTermID { 
    196190element ParentListID {concat($voclib:gcmd_chronostratigraphic_valids, '/current')}, 
    197 element TermID {escape-uri($chronostratigraphic, true())} 
     191element TermID {encode-for-uri($chronostratigraphic)} 
    198192} 
    199193} 
     
    212206element localIdentifier {concat('generated_creator-', $output_local_id)} 
    213207else 
    214 element localIdentifier {concat('generated_creator-', escape-uri(string($DIF/dif:Entry_ID), true()))} 
     208element localIdentifier {concat('generated_creator-', encode-for-uri(string($DIF/dif:Entry_ID)))} 
    215209}, 
    216210element roleName {'Data Creator'}, 
     
    223217element repositoryIdentifier {$input_repository}, 
    224218if ($output_local_id != 'Output_LocalID') then 
    225 element localIdentifier  {escape-uri(concat('generated_orgcit-', string($creatorID), '-', $output_local_id), true())} 
    226 else 
    227 element localIdentifier  {escape-uri(concat('generated_orgcit-', string($creatorID), '-', data($DIF/dif:Entry_ID)), true())} 
     219element localIdentifier  {encode-for-uri(concat('generated_orgcit-', string($creatorID), '-', $output_local_id))} 
     220else 
     221element localIdentifier  {encode-for-uri(concat('generated_orgcit-', string($creatorID), '-', data($DIF/dif:Entry_ID)))} 
    228222}, 
    229223element startDate {current-date()} 
     
    236230element repositoryIdentifier {$input_repository}, 
    237231if ($output_local_id != 'Output_LocalID') then 
    238 element localIdentifier  {escape-uri(concat('generated_creator-', $output_local_id), true())} 
    239 else 
    240 element localIdentifier  {escape-uri(concat('generated_creator-', data($DIF/dif:Entry_ID)), true())} 
     232element localIdentifier  {encode-for-uri(concat('generated_creator-', $output_local_id))} 
     233else 
     234element localIdentifier  {encode-for-uri(concat('generated_creator-', data($DIF/dif:Entry_ID)))} 
    241235}, 
    242236element roleName {'Data Creator'}, 
     
    249243element repositoryIdentifier {$input_repository}, 
    250244if ($output_local_id != 'Output_LocalID') then 
    251 element localIdentifier  {escape-uri(concat('generated_orgcit-', string($creatorID), '-', $output_local_id), true())} 
    252 else 
    253 element localIdentifier  {escape-uri(concat('generated_orgcit-', string($creatorID), '-', data($DIF/dif:Entry_ID)), true())} 
     245element localIdentifier  {encode-for-uri(concat('generated_orgcit-', string($creatorID), '-', $output_local_id))} 
     246else 
     247element localIdentifier  {encode-for-uri(concat('generated_orgcit-', string($creatorID), '-', data($DIF/dif:Entry_ID)))} 
    254248}, 
    255249element startDate {current-date()} 
     
    262256element repositoryIdentifier {$input_repository}, 
    263257if ($output_local_id != 'Output_LocalID') then 
    264 element localIdentifier  {escape-uri(concat('generated_curator-', $output_local_id), true())} 
    265 else 
    266 element localIdentifier  {escape-uri(concat('generated_curator-', data($DIF/dif:Entry_ID)), true())} 
     258element localIdentifier  {encode-for-uri(concat('generated_curator-', $output_local_id))} 
     259else 
     260element localIdentifier  {encode-for-uri(concat('generated_curator-', data($DIF/dif:Entry_ID)))} 
    267261}, 
    268262element roleName {'Data Curator'}, 
     
    296290element ParentListID {$voclib:unknown_vocab_id} 
    297291, 
    298 element TermID {escape-uri($structuredKeywords, true())} 
     292element TermID {encode-for-uri($structuredKeywords)} 
    299293} 
    300294}, 
     
    305299element dgValidTermID { 
    306300element ParentListID {concat($voclib:iso_topic_list, '/current')}, 
    307 element TermID {escape-uri($structuredKeywords, true())} 
     301element TermID {encode-for-uri($structuredKeywords)} 
    308302} 
    309303}, 
     
    344338element repositoryIdentifier {$input_repository}, 
    345339if ($output_local_id != 'Output_LocalID') then 
    346 element localIdentifier  {escape-uri(concat('generated_orgcit-', string($creator), '-', $output_local_id), true())} 
    347 else 
    348 element localIdentifier  {escape-uri(concat('generated_orgcit-', string($creator), '-', data($DIF/dif:Entry_ID)), true())} 
     340element localIdentifier  {encode-for-uri(concat('generated_orgcit-', string($creator), '-', $output_local_id))} 
     341else 
     342element localIdentifier  {encode-for-uri(concat('generated_orgcit-', string($creator), '-', data($DIF/dif:Entry_ID)))} 
    349343}, 
    350344element name {string($creator)}, 
  • exist/trunk/xquery/mdip2moles.xq

    r3156 r3841  
    1010declare namespace mdip='http://www.oceannet.org/mdip/xml'; 
    1111declare namespace gco='http://www.isotc211.org/2005/gco'; 
    12 (: keep base 
    13 declare variable $input_collection as xs:string {'TargetCollection'}; 
    14 declare variable $input_repository as xs:string {'Input_Repository_Code'}; 
    15 declare variable $input_repository_local as xs:string {'Input_Repository_LocalID'}; 
    16 declare variable $input_DatasetIdentifier as xs:string {'Input_Entry_ID'}; 
    17 declare variable $output_local_id as xs:string {'Output_LocalID'}; 
    18 :) 
    19 declare variable $input_collection as xs:string {'TargetCollection'}; 
    20 declare variable $input_repository as xs:string {'Input_Repository_Code'}; 
    21 declare variable $input_repository_local as xs:string {'Input_Repository_LocalID'}; 
    22 declare variable $input_DatasetIdentifier as xs:string {'Input_Entry_ID'}; 
    23 declare variable $output_local_id as xs:string {'Output_LocalID'}; 
     12 
     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'; 
    2418 
    2519for $MDIP in collection($input_collection)/mdip:Metadata[mdip:DatasetIdentifier=$input_DatasetIdentifier] 
     
    3327                                element localIdentifier {$output_local_id} 
    3428                        else 
    35                                 element localIdentifier {escape-uri(data($MDIP/mdip:DatasetIdentifier), true())} 
     29                                element localIdentifier {encode-for-uri(data($MDIP/mdip:DatasetIdentifier))} 
    3630                }, 
    3731                element dgMetadataDescription { 
     
    4236                                        element localIdentifier {concat('generated_desc-', $output_local_id)} 
    4337                                else 
    44                                         element localIdentifier {concat('generated_desc-', escape-uri(string($MDIP/mdip:DatasetIdentifier), true()))} 
     38                                        element localIdentifier {concat('generated_desc-', encode-for-uri(string($MDIP/mdip:DatasetIdentifier)))} 
    4539                        }, 
    4640                        element metadataDescriptionLastUpdated {current-date()}                 , 
     
    6458                                                                        element dgValidTermID { 
    6559                                                                                element ParentListID {$voclib:unknown_vocab_id}, 
    66                                                                                 element TermID {escape-uri('dummy unit', true())} 
     60                                                                                element TermID {encode-for-uri('dummy unit')} 
    6761                                                                        } 
    6862                                                                } 
     
    10397                                                                                element dgValidTermID { 
    10498                                                                                        element ParentListID {'$voclib:unknown_vocab_id'}, 
    105                                                                                         element TermID {escape-uri(string($location/mdip:VerticalDatum), true())} 
     99                                                                                        element TermID {encode-for-uri(string($location/mdip:VerticalDatum))} 
    106100                                                                                } 
    107101                                                                        }, 
     
    144138                                                                element localIdentifier {concat('generated_creator-', $output_local_id)} 
    145139                                                        else 
    146                                                                 element localIdentifier {concat('generated_creator-', escape-uri(string($MDIP/mdip:DatasetIdentifier), true()))} 
     140                                                                element localIdentifier {concat('generated_creator-', encode-for-uri(string($MDIP/mdip:DatasetIdentifier)))} 
    147141                                                }, 
    148142                                                element roleName {'Data Creator'}, 
     
    155149                                                                element repositoryIdentifier {$input_repository}, 
    156150                                                                if ($output_local_id != 'Output_LocalID') then 
    157                                                                         element localIdentifier {escape-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', $output_local_id), true())} 
     151                                                                        element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', $output_local_id))} 
    158152                                                                else 
    159                                                                         element localIdentifier {escape-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', data($MDIP/mdip:DatasetIdentifier)), true())} 
     153                                                                        element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', data($MDIP/mdip:DatasetIdentifier)))} 
    160154                                                        }, 
    161155                                                element startDate {current-date()} 
     
    170164                                                                element localIdentifier {concat('generated_creator-', $output_local_id)} 
    171165                                                        else 
    172                                                                 element localIdentifier {concat('generated_creator-', escape-uri(string($MDIP/mdip:DatasetIdentifier), true()))} 
     166                                                                element localIdentifier {concat('generated_creator-', encode-for-uri(string($MDIP/mdip:DatasetIdentifier)))} 
    173167                                                }, 
    174168                                                element roleName {'Data Creator'}, 
     
    181175                                                                element repositoryIdentifier {$input_repository}, 
    182176                                                                if ($output_local_id != 'Output_LocalID') then 
    183                                                                         element localIdentifier {escape-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', $output_local_id), true())} 
     177                                                                        element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', $output_local_id))} 
    184178                                                                else 
    185                                                                         element localIdentifier {escape-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', data($MDIP/mdip:DatasetIdentifier)), true())} 
     179                                                                        element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', data($MDIP/mdip:DatasetIdentifier)))} 
    186180                                                        }, 
    187181                                                element startDate {current-date()} 
     
    196190                                                        element localIdentifier {concat('generated_curator-', $output_local_id)} 
    197191                                                else 
    198                                                         element localIdentifier {concat('generated_curator-', escape-uri(string($MDIP/mdip:DatasetIdentifier), true()))} 
     192                                                        element localIdentifier {concat('generated_curator-', encode-for-uri(string($MDIP/mdip:DatasetIdentifier)))} 
    199193                                        }, 
    200194                                        element roleName {'Data Curator'}, 
     
    272266                                element repositoryIdentifier {$input_repository}, 
    273267                                if ($output_local_id != 'Output_LocalID') then 
    274                                         element localIdentifier {escape-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', $output_local_id), true())} 
     268                                        element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', $output_local_id))} 
    275269                                else 
    276                                         element localIdentifier {escape-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', data($MDIP/mdip:DatasetIdentifier)), true())} 
     270                                        element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', data($MDIP/mdip:DatasetIdentifier)))} 
    277271                        }, 
    278272                        element name {data($creator/mdip:OriginatorName)}, 
  • exist/trunk/xquery/moles.xq

    r3118 r3841  
    11(: Return a moles document from TargetCollection conforming to RepositoryID and LocalID :) 
    22declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 
    3 declare variable $targetCollection as xs:string {'TargetCollection'}; 
    4 declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    5 declare variable $localIdentifier as xs:string {'LocalID'}; 
     3declare variable $targetCollection as xs:string := 'TargetCollection'; 
     4declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
     5declare variable $localIdentifier as xs:string := 'LocalID'; 
    66for $Moles in collection($targetCollection)/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0'  
    77and dgMetadataID/repositoryIdentifier=$repositoryIdentifier  
  • exist/trunk/xquery/moles2DC.xq

    r3224 r3841  
    22import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    33import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
     4 
    45declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 
    56declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance';  
     
    1213:) 
    1314 
    14 declare variable $targetCollection as xs:string {'TargetCollection'}; 
    15 declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    16 declare variable $localIdentifier as xs:string {'LocalID'}; 
     15declare variable $targetCollection as xs:string := 'TargetCollection'; 
     16declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
     17declare variable $localIdentifier as xs:string := 'LocalID'; 
    1718 
    1819for $DE in collection($targetCollection)/dgMetadata/dgMetadataRecord[ 
  • exist/trunk/xquery/moles2dif.xq

    r3715 r3841  
    44 TargetCollection, Repository ID, LocalID :) 
    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 utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
    86declare default element namespace 'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 
    97declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance';  
     
    119declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
    1210 
    13  
    14 declare variable $targetCollection as xs:string {'TargetCollection'}; 
    15 declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    16 declare variable $localIdentifier as xs:string {'LocalID'}; 
     11declare variable $targetCollection as xs:string := 'TargetCollection'; 
     12declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
     13declare variable $localIdentifier as xs:string := 'LocalID'; 
     14 
    1715(: Keep 
    18 declare variable $targetCollection as xs:string {'/db/ndg_B_metadata'}; 
    19 declare variable $repositoryIdentifier as xs:string {'badc.nerc.ac.uk'}; 
    20 declare variable $localIdentifier as xs:string {'dataent_CIRA'}; 
     16declare variable $targetCollection as xs:string := '/db/ndg_B_metadata'; 
     17declare variable $repositoryIdentifier as xs:string := 'badc.nerc.ac.uk'; 
     18declare variable $localIdentifier as xs:string := 'dataent_CIRA'; 
    2119:) 
    2220for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
     
    132130                                else (), 
    133131                                if (exists($DG/moles:accessControlPolicy/moles:accessControlPolicyURL)) then 
    134                                     concat('See access control policy at ', escape-uri($DG/moles:accessControlPolicy/moles:accessControlPolicyURL, true())) 
     132                                    concat('See access control policy at ', encode-for-uri($DG/moles:accessControlPolicy/moles:accessControlPolicyURL)) 
    135133                                else if (exists($DG/moles:accessControlPolicy/moles:accessControlPolicyText)) then 
    136134                                    data($DG/moles:accessControlPolicy/moles:accessControlPolicyText) 
  • exist/trunk/xquery/moles2iso19139.xq

    r3118 r3841  
    11(: This xquery for TargetCollection RepositoryID and LocalID will find and convert Moles to ISO19139 :) 
    2 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    32import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
    43 
     
    109declare namespace xlink='http://www.w3.org/1999/xlink';  
    1110declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance';  
    12 declare option exist:timeout '24500';  
    13  
    14 declare variable $targetCollection as xs:string {'TargetCollection'}; 
    15 declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    16 declare variable $localIdentifier as xs:string {'LocalID'}; 
     11(: 
     12This option doesn't work when using with saxon - as used by the ingest 
     13declare option exist:timeout '24500'; 
     14:)  
     15 
     16declare variable $targetCollection as xs:string := 'TargetCollection'; 
     17declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
     18declare variable $localIdentifier as xs:string := 'LocalID'; 
    1719 
    1820for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
  • exist/trunk/xquery/moles2mdip.xq

    r3118 r3841  
    22import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    33import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
     4 
    45declare default element namespace 'http://www.oceannet.org/mdip/xml'; 
    56declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    67declare namespace gco='http://www.isotc211.org/2005/gco'; 
    78declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance';  
    8 declare variable $targetCollection as xs:string {'TargetCollection'}; 
    9 declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    10 declare variable $localIdentifier as xs:string {'LocalID'}; 
    11 declare variable $ISO_639-2_ns as xs:string{$voclib:ISO_639-2_ns}; 
    12 declare variable $ISO_3166_ns as xs:string{$voclib:ISO_3166_ns}; 
     9 
     10declare variable $targetCollection as xs:string := 'TargetCollection'; 
     11declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
     12declare variable $localIdentifier as xs:string := 'LocalID'; 
     13declare variable $ISO_639-2_ns as xs:string := $voclib:ISO_639-2_ns; 
     14declare variable $ISO_3166_ns as xs:string := $voclib:ISO_3166_ns; 
    1315 
    1416for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
  • exist/trunk/xquery/molesList.xq

    r3361 r3841  
    11(: This moles listing query returns all the moles DataEntity documents and their local identifiers within a specific TargetCollection and a particular type (default is dgDataEntity) :) 
    22declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 
    3 for $DE in collection('TargetCollection')/dgMetadata/dgMetadataRecord[exists(dgDataEntity)] 
     3declare variable $targetCollection as xs:string := 'TargetCollection'; 
     4for $DE in collection($targetCollection)/dgMetadata/dgMetadataRecord[exists(dgDataEntity)] 
    45let $f:=util:document-name($DE) 
    56return 
  • exist/trunk/xquery/molesObjectType.xq

    r3118 r3841  
    22     0 - unknown, 1 - activity, 2 - DPT, 3 - ObsStn, 4 - DataEntity :) 
    33declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 
    4 declare variable $targetCollection as xs:string {'TargetCollection'}; 
     4declare variable $targetCollection as xs:string := 'TargetCollection'; 
    55for $Obj in collection($targetCollection)/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] 
    66return <objectType>{if (exists($Obj/dgDataEntity)) then 4  
  • exist/trunk/xquery/stubB_DPT.xq

    r3118 r3841  
    11(: This query for TargetCollection, RepositoryID and LocalID, will return the stubB for a Data Production Tool, DPT :) 
    22declare default element namespace 'http://ndg.nerc.ac.uk/moles/dataproductiontool';  
    3 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    43import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
    54(:  
     
    109declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    1110 
    12 declare variable $targetCollection as xs:string {'TargetCollection'}; 
    13 declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    14 declare variable $localIdentifier as xs:string {'LocalID'}; 
     11declare variable $targetCollection as xs:string := 'TargetCollection'; 
     12declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
     13declare variable $localIdentifier as xs:string := 'LocalID'; 
    1514 
    1615declare function f:return-stub-activity($out-element-name as xs:string, $repid as xs:string, $locid as xs:string) as element()  
  • exist/trunk/xquery/stubB_activity.xq

    r3118 r3841  
    44declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    55 
    6 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    76import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
    87(:  
     
    109import module namespace stubblib='http://ndg.nerc.ac.uk/xquery/lib/stubb' at 'xmldb:exist:///db/xqueryLib/StubB/stubb_xquery_lib.xquery'; 
    1110:) 
    12 declare variable $targetCollection as xs:string {'TargetCollection'}; 
    13 declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    14 declare variable $localIdentifier as xs:string {'LocalID'}; 
     11declare variable $targetCollection as xs:string := 'TargetCollection'; 
     12declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
     13declare variable $localIdentifier as xs:string := 'LocalID'; 
    1514 
    1615declare function f:return-stub-activity($out-element-name as xs:string, $repid as xs:string, $locid as xs:string) as element()  
  • exist/trunk/xquery/stubB_dataEntity.xq

    r3118 r3841  
    44declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    55 
    6 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    76import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
    87(:  
     
    109import module namespace stubblib='http://ndg.nerc.ac.uk/xquery/lib/stubb' at 'xmldb:exist:///db/xqueryLib/StubB/stubb_xquery_lib.xquery'; 
    1110:) 
    12 declare variable $targetCollection as xs:string {'TargetCollection'}; 
    13 declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    14 declare variable $localIdentifier as xs:string {'LocalID'}; 
     11declare variable $targetCollection as xs:string := 'TargetCollection'; 
     12declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
     13declare variable $localIdentifier as xs:string := 'LocalID'; 
    1514 
    1615declare function f:return-stub-activity($out-element-name as xs:string, $repid as xs:string, $locid as xs:string) as element()  
  • exist/trunk/xquery/stubB_observationStation.xq

    r3118 r3841  
    11(: This query for TargetCollection, RepositoryID and LocalID, will return the stubB for an observation station :) 
    22declare default element namespace 'http://ndg.nerc.ac.uk/moles/observationstation';  
    3 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    43import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 
    54(:  
     
    109declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    1110 
    12 declare variable $targetCollection as xs:string {'TargetCollection'}; 
    13 declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 
    14 declare variable $localIdentifier as xs:string {'LocalID'}; 
     11declare variable $targetCollection as xs:string := 'TargetCollection'; 
     12declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
     13declare variable $localIdentifier as xs:string := 'LocalID'; 
    1514declare function f:return-stub-activity($out-element-name as xs:string, $repid as xs:string, $locid as xs:string) as element()  
    1615(: Returns a 'stubB' style activity record to expand an activity record :) 
Note: See TracChangeset for help on using the changeset viewer.