Changeset 3841
- Timestamp:
- 01/05/08 14:28:47 (13 years ago)
- Location:
- exist/trunk
- Files:
-
- 1 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
exist/trunk/xquery/DIFList.xq
r3163 r3841 1 1 (: This is a DIF listing query for TargetCollection - returns EntryIDs and the files in which they exist :) 2 2 declare default element namespace 'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 3 declare variable $targetCollection as xs:string {'TargetCollection'};3 declare variable $targetCollection as xs:string := 'TargetCollection'; 4 4 for $DE in collection($targetCollection)/DIF/Entry_ID let $f:=util:document-name($DE) return 5 5 <dgMetadataRecord> -
exist/trunk/xquery/MDIPList.xq
r3181 r3841 1 1 declare default element namespace 'http://www.oceannet.org/mdip/xml'; 2 declare variable $targetCollection as xs:string {'TargetCollection'};2 declare variable $targetCollection as xs:string := 'TargetCollection'; 3 3 for $DE in collection($targetCollection)/Metadata/DatasetIdentifier 4 4 let $f:=util:document-name($DE) -
exist/trunk/xquery/dif2moles.xq
r3151 r3841 7 7 (: Note algoritm for creating non-pre-existing organisations :) 8 8 (: dgPersons are not created as one can't tell automatically which are people and which are orgs, and orgs are simpler :) 9 9 10 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 10 11 import module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'xmldb:exist:///db/xqueryLib/Utilities/inputParse_xquery_lib.xquery'; 12 11 13 declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 12 14 declare namespace dif='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 13 15 declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance'; 14 16 15 (: Keep as an example, but note the entryID in the dif is an16 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 :)23 17 (: 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'};18 declare variable $targetCollection as xs:string := 'TargetCollection'; 19 declare variable $input_repository as xs:string := 'RepositoryID'; 20 declare variable $input_repository_local as xs:string := 'repository_localid'; 21 declare variable $input_entry_id as xs:string := 'Input_Entry_ID'; 22 declare variable $output_local_id as xs:string := 'LocalID'; 29 23 30 24 for $DIF in collection($targetCollection)/dif:DIF[dif:Entry_ID=$input_entry_id] … … 47 41 element localIdentifier {concat('generated_desc-', $output_local_id)} 48 42 else 49 element localIdentifier {concat('generated_desc-', e scape-uri(string($DIF/dif:Entry_ID), true()))}43 element localIdentifier {concat('generated_desc-', encode-for-uri(string($DIF/dif:Entry_ID)))} 50 44 }, 51 45 element metadataDescriptionLastUpdated {current-date()} , … … 58 52 element descriptionSection { 59 53 element descriptionOnlineReference { 60 element dgSimpleLink {e scape-uri(data($descOnline/dif:URL), true())}},54 element dgSimpleLink {encode-for-uri(data($descOnline/dif:URL))}}, 61 55 if (exists($descOnline/dif:URL_Content_Type)) then 62 56 element dgReferenceName {data($descOnline/dif:URL_Content_Type)} … … 79 73 element dgValidTermID { 80 74 element ParentListID {$voclib:unknown_vocab_id}, 81 element TermID {e scape-uri('dummy unit', true())}75 element TermID {encode-for-uri('dummy unit')} 82 76 } 83 77 } … … 89 83 element dgValidTermID { 90 84 element ParentListID {concat($voclib:gcmd_science_valids_categories, '/current')}, 91 element TermID {e scape-uri($parameter/dif:Category, true())}85 element TermID {encode-for-uri($parameter/dif:Category)} 92 86 }, 93 87 element dgValidSubterm { … … 96 90 element dgValidTermID { 97 91 element ParentListID {concat($voclib:gcmd_science_valids_topics, '/current')}, 98 element TermID {e scape-uri($parameter/dif:Topic, true())}92 element TermID {encode-for-uri($parameter/dif:Topic)} 99 93 }, 100 94 element dgValidSubterm { … … 103 97 element dgValidTermID { 104 98 element ParentListID {concat($voclib:gcmd_science_valids_terms, '/current')}, 105 element TermID {e scape-uri($parameter/dif:Term, true())}99 element TermID {encode-for-uri($parameter/dif:Term)} 106 100 }, 107 101 if (exists($parameter/dif:Variable) and $parameter/dif:Variable!='') then … … 110 104 element dgValidTermID { 111 105 element ParentListID {concat($voclib:gcmd_science_valids_variables, '/current')}, 112 element TermID {e scape-uri($parameter/dif:Variable, true())}106 element TermID {encode-for-uri($parameter/dif:Variable)} 113 107 }, 114 108 if (exists($parameter/dif:Detailed_Variable) and $parameter/dif:Detailed_Variable!='') then … … 117 111 element dgValidTermID { 118 112 element ParentListID {$voclib:unknown_vocab_id}, 119 element TermID {e scape-uri($parameter/dif:Detailed_Variable, true())}113 element TermID {encode-for-uri($parameter/dif:Detailed_Variable)} 120 114 }, 121 115 element ListLevel {4}} … … 170 164 element dgValidTermID { 171 165 element ParentListID {concat($voclib:gcmd_location_valids, '/current')}, 172 element TermID {e scape-uri($location, true())}166 element TermID {encode-for-uri($location)} 173 167 } 174 168 } … … 195 189 element dgValidTermID { 196 190 element ParentListID {concat($voclib:gcmd_chronostratigraphic_valids, '/current')}, 197 element TermID {e scape-uri($chronostratigraphic, true())}191 element TermID {encode-for-uri($chronostratigraphic)} 198 192 } 199 193 } … … 212 206 element localIdentifier {concat('generated_creator-', $output_local_id)} 213 207 else 214 element localIdentifier {concat('generated_creator-', e scape-uri(string($DIF/dif:Entry_ID), true()))}208 element localIdentifier {concat('generated_creator-', encode-for-uri(string($DIF/dif:Entry_ID)))} 215 209 }, 216 210 element roleName {'Data Creator'}, … … 223 217 element repositoryIdentifier {$input_repository}, 224 218 if ($output_local_id != 'Output_LocalID') then 225 element localIdentifier {e scape-uri(concat('generated_orgcit-', string($creatorID), '-', $output_local_id), true())}226 else 227 element localIdentifier {e scape-uri(concat('generated_orgcit-', string($creatorID), '-', data($DIF/dif:Entry_ID)), true())}219 element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creatorID), '-', $output_local_id))} 220 else 221 element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creatorID), '-', data($DIF/dif:Entry_ID)))} 228 222 }, 229 223 element startDate {current-date()} … … 236 230 element repositoryIdentifier {$input_repository}, 237 231 if ($output_local_id != 'Output_LocalID') then 238 element localIdentifier {e scape-uri(concat('generated_creator-', $output_local_id), true())}239 else 240 element localIdentifier {e scape-uri(concat('generated_creator-', data($DIF/dif:Entry_ID)), true())}232 element localIdentifier {encode-for-uri(concat('generated_creator-', $output_local_id))} 233 else 234 element localIdentifier {encode-for-uri(concat('generated_creator-', data($DIF/dif:Entry_ID)))} 241 235 }, 242 236 element roleName {'Data Creator'}, … … 249 243 element repositoryIdentifier {$input_repository}, 250 244 if ($output_local_id != 'Output_LocalID') then 251 element localIdentifier {e scape-uri(concat('generated_orgcit-', string($creatorID), '-', $output_local_id), true())}252 else 253 element localIdentifier {e scape-uri(concat('generated_orgcit-', string($creatorID), '-', data($DIF/dif:Entry_ID)), true())}245 element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creatorID), '-', $output_local_id))} 246 else 247 element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creatorID), '-', data($DIF/dif:Entry_ID)))} 254 248 }, 255 249 element startDate {current-date()} … … 262 256 element repositoryIdentifier {$input_repository}, 263 257 if ($output_local_id != 'Output_LocalID') then 264 element localIdentifier {e scape-uri(concat('generated_curator-', $output_local_id), true())}265 else 266 element localIdentifier {e scape-uri(concat('generated_curator-', data($DIF/dif:Entry_ID)), true())}258 element localIdentifier {encode-for-uri(concat('generated_curator-', $output_local_id))} 259 else 260 element localIdentifier {encode-for-uri(concat('generated_curator-', data($DIF/dif:Entry_ID)))} 267 261 }, 268 262 element roleName {'Data Curator'}, … … 296 290 element ParentListID {$voclib:unknown_vocab_id} 297 291 , 298 element TermID {e scape-uri($structuredKeywords, true())}292 element TermID {encode-for-uri($structuredKeywords)} 299 293 } 300 294 }, … … 305 299 element dgValidTermID { 306 300 element ParentListID {concat($voclib:iso_topic_list, '/current')}, 307 element TermID {e scape-uri($structuredKeywords, true())}301 element TermID {encode-for-uri($structuredKeywords)} 308 302 } 309 303 }, … … 344 338 element repositoryIdentifier {$input_repository}, 345 339 if ($output_local_id != 'Output_LocalID') then 346 element localIdentifier {e scape-uri(concat('generated_orgcit-', string($creator), '-', $output_local_id), true())}347 else 348 element localIdentifier {e scape-uri(concat('generated_orgcit-', string($creator), '-', data($DIF/dif:Entry_ID)), true())}340 element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creator), '-', $output_local_id))} 341 else 342 element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creator), '-', data($DIF/dif:Entry_ID)))} 349 343 }, 350 344 element name {string($creator)}, -
exist/trunk/xquery/mdip2moles.xq
r3156 r3841 10 10 declare namespace mdip='http://www.oceannet.org/mdip/xml'; 11 11 declare 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 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'; 24 18 25 19 for $MDIP in collection($input_collection)/mdip:Metadata[mdip:DatasetIdentifier=$input_DatasetIdentifier] … … 33 27 element localIdentifier {$output_local_id} 34 28 else 35 element localIdentifier {e scape-uri(data($MDIP/mdip:DatasetIdentifier), true())}29 element localIdentifier {encode-for-uri(data($MDIP/mdip:DatasetIdentifier))} 36 30 }, 37 31 element dgMetadataDescription { … … 42 36 element localIdentifier {concat('generated_desc-', $output_local_id)} 43 37 else 44 element localIdentifier {concat('generated_desc-', e scape-uri(string($MDIP/mdip:DatasetIdentifier), true()))}38 element localIdentifier {concat('generated_desc-', encode-for-uri(string($MDIP/mdip:DatasetIdentifier)))} 45 39 }, 46 40 element metadataDescriptionLastUpdated {current-date()} , … … 64 58 element dgValidTermID { 65 59 element ParentListID {$voclib:unknown_vocab_id}, 66 element TermID {e scape-uri('dummy unit', true())}60 element TermID {encode-for-uri('dummy unit')} 67 61 } 68 62 } … … 103 97 element dgValidTermID { 104 98 element ParentListID {'$voclib:unknown_vocab_id'}, 105 element TermID {e scape-uri(string($location/mdip:VerticalDatum), true())}99 element TermID {encode-for-uri(string($location/mdip:VerticalDatum))} 106 100 } 107 101 }, … … 144 138 element localIdentifier {concat('generated_creator-', $output_local_id)} 145 139 else 146 element localIdentifier {concat('generated_creator-', e scape-uri(string($MDIP/mdip:DatasetIdentifier), true()))}140 element localIdentifier {concat('generated_creator-', encode-for-uri(string($MDIP/mdip:DatasetIdentifier)))} 147 141 }, 148 142 element roleName {'Data Creator'}, … … 155 149 element repositoryIdentifier {$input_repository}, 156 150 if ($output_local_id != 'Output_LocalID') then 157 element localIdentifier {e scape-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))} 158 152 else 159 element localIdentifier {e scape-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)))} 160 154 }, 161 155 element startDate {current-date()} … … 170 164 element localIdentifier {concat('generated_creator-', $output_local_id)} 171 165 else 172 element localIdentifier {concat('generated_creator-', e scape-uri(string($MDIP/mdip:DatasetIdentifier), true()))}166 element localIdentifier {concat('generated_creator-', encode-for-uri(string($MDIP/mdip:DatasetIdentifier)))} 173 167 }, 174 168 element roleName {'Data Creator'}, … … 181 175 element repositoryIdentifier {$input_repository}, 182 176 if ($output_local_id != 'Output_LocalID') then 183 element localIdentifier {e scape-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))} 184 178 else 185 element localIdentifier {e scape-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)))} 186 180 }, 187 181 element startDate {current-date()} … … 196 190 element localIdentifier {concat('generated_curator-', $output_local_id)} 197 191 else 198 element localIdentifier {concat('generated_curator-', e scape-uri(string($MDIP/mdip:DatasetIdentifier), true()))}192 element localIdentifier {concat('generated_curator-', encode-for-uri(string($MDIP/mdip:DatasetIdentifier)))} 199 193 }, 200 194 element roleName {'Data Curator'}, … … 272 266 element repositoryIdentifier {$input_repository}, 273 267 if ($output_local_id != 'Output_LocalID') then 274 element localIdentifier {e scape-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))} 275 269 else 276 element localIdentifier {e scape-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)))} 277 271 }, 278 272 element name {data($creator/mdip:OriginatorName)}, -
exist/trunk/xquery/moles.xq
r3118 r3841 1 1 (: Return a moles document from TargetCollection conforming to RepositoryID and LocalID :) 2 2 declare 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'};3 declare variable $targetCollection as xs:string := 'TargetCollection'; 4 declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 5 declare variable $localIdentifier as xs:string := 'LocalID'; 6 6 for $Moles in collection($targetCollection)/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' 7 7 and dgMetadataID/repositoryIdentifier=$repositoryIdentifier -
exist/trunk/xquery/moles2DC.xq
r3224 r3841 2 2 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 3 3 import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 4 4 5 declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 5 6 declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance'; … … 12 13 :) 13 14 14 declare variable $targetCollection as xs:string {'TargetCollection'};15 declare variable $repositoryIdentifier as xs:string {'RepositoryID'};16 declare variable $localIdentifier as xs:string {'LocalID'};15 declare variable $targetCollection as xs:string := 'TargetCollection'; 16 declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 17 declare variable $localIdentifier as xs:string := 'LocalID'; 17 18 18 19 for $DE in collection($targetCollection)/dgMetadata/dgMetadataRecord[ -
exist/trunk/xquery/moles2dif.xq
r3715 r3841 4 4 TargetCollection, Repository ID, LocalID :) 5 5 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';8 6 declare default element namespace 'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 9 7 declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance'; … … 11 9 declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 12 10 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 declare variable $targetCollection as xs:string := 'TargetCollection'; 12 declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 13 declare variable $localIdentifier as xs:string := 'LocalID'; 14 17 15 (: 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'};16 declare variable $targetCollection as xs:string := '/db/ndg_B_metadata'; 17 declare variable $repositoryIdentifier as xs:string := 'badc.nerc.ac.uk'; 18 declare variable $localIdentifier as xs:string := 'dataent_CIRA'; 21 19 :) 22 20 for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ … … 132 130 else (), 133 131 if (exists($DG/moles:accessControlPolicy/moles:accessControlPolicyURL)) then 134 concat('See access control policy at ', e scape-uri($DG/moles:accessControlPolicy/moles:accessControlPolicyURL, true()))132 concat('See access control policy at ', encode-for-uri($DG/moles:accessControlPolicy/moles:accessControlPolicyURL)) 135 133 else if (exists($DG/moles:accessControlPolicy/moles:accessControlPolicyText)) then 136 134 data($DG/moles:accessControlPolicy/moles:accessControlPolicyText) -
exist/trunk/xquery/moles2iso19139.xq
r3118 r3841 1 1 (: 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';3 2 import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 4 3 … … 10 9 declare namespace xlink='http://www.w3.org/1999/xlink'; 11 10 declare 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 (: 12 This option doesn't work when using with saxon - as used by the ingest 13 declare option exist:timeout '24500'; 14 :) 15 16 declare variable $targetCollection as xs:string := 'TargetCollection'; 17 declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 18 declare variable $localIdentifier as xs:string := 'LocalID'; 17 19 18 20 for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ -
exist/trunk/xquery/moles2mdip.xq
r3118 r3841 2 2 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 3 3 import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 4 4 5 declare default element namespace 'http://www.oceannet.org/mdip/xml'; 5 6 declare namespace moles='http://ndg.nerc.ac.uk/moles'; 6 7 declare namespace gco='http://www.isotc211.org/2005/gco'; 7 8 declare 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 10 declare variable $targetCollection as xs:string := 'TargetCollection'; 11 declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 12 declare variable $localIdentifier as xs:string := 'LocalID'; 13 declare variable $ISO_639-2_ns as xs:string := $voclib:ISO_639-2_ns; 14 declare variable $ISO_3166_ns as xs:string := $voclib:ISO_3166_ns; 13 15 14 16 for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ -
exist/trunk/xquery/molesList.xq
r3361 r3841 1 1 (: 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) :) 2 2 declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 3 for $DE in collection('TargetCollection')/dgMetadata/dgMetadataRecord[exists(dgDataEntity)] 3 declare variable $targetCollection as xs:string := 'TargetCollection'; 4 for $DE in collection($targetCollection)/dgMetadata/dgMetadataRecord[exists(dgDataEntity)] 4 5 let $f:=util:document-name($DE) 5 6 return -
exist/trunk/xquery/molesObjectType.xq
r3118 r3841 2 2 0 - unknown, 1 - activity, 2 - DPT, 3 - ObsStn, 4 - DataEntity :) 3 3 declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 4 declare variable $targetCollection as xs:string {'TargetCollection'};4 declare variable $targetCollection as xs:string := 'TargetCollection'; 5 5 for $Obj in collection($targetCollection)/dgMetadata/dgMetadataRecord[dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] 6 6 return <objectType>{if (exists($Obj/dgDataEntity)) then 4 -
exist/trunk/xquery/stubB_DPT.xq
r3118 r3841 1 1 (: This query for TargetCollection, RepositoryID and LocalID, will return the stubB for a Data Production Tool, DPT :) 2 2 declare 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';4 3 import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 5 4 (: … … 10 9 declare namespace moles='http://ndg.nerc.ac.uk/moles'; 11 10 12 declare variable $targetCollection as xs:string {'TargetCollection'};13 declare variable $repositoryIdentifier as xs:string {'RepositoryID'};14 declare variable $localIdentifier as xs:string {'LocalID'};11 declare variable $targetCollection as xs:string := 'TargetCollection'; 12 declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 13 declare variable $localIdentifier as xs:string := 'LocalID'; 15 14 16 15 declare 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 4 4 declare namespace moles='http://ndg.nerc.ac.uk/moles'; 5 5 6 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery';7 6 import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 8 7 (: … … 10 9 import module namespace stubblib='http://ndg.nerc.ac.uk/xquery/lib/stubb' at 'xmldb:exist:///db/xqueryLib/StubB/stubb_xquery_lib.xquery'; 11 10 :) 12 declare variable $targetCollection as xs:string {'TargetCollection'};13 declare variable $repositoryIdentifier as xs:string {'RepositoryID'};14 declare variable $localIdentifier as xs:string {'LocalID'};11 declare variable $targetCollection as xs:string := 'TargetCollection'; 12 declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 13 declare variable $localIdentifier as xs:string := 'LocalID'; 15 14 16 15 declare 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 4 4 declare namespace moles='http://ndg.nerc.ac.uk/moles'; 5 5 6 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery';7 6 import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 8 7 (: … … 10 9 import module namespace stubblib='http://ndg.nerc.ac.uk/xquery/lib/stubb' at 'xmldb:exist:///db/xqueryLib/StubB/stubb_xquery_lib.xquery'; 11 10 :) 12 declare variable $targetCollection as xs:string {'TargetCollection'};13 declare variable $repositoryIdentifier as xs:string {'RepositoryID'};14 declare variable $localIdentifier as xs:string {'LocalID'};11 declare variable $targetCollection as xs:string := 'TargetCollection'; 12 declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 13 declare variable $localIdentifier as xs:string := 'LocalID'; 15 14 16 15 declare 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 1 1 (: This query for TargetCollection, RepositoryID and LocalID, will return the stubB for an observation station :) 2 2 declare 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';4 3 import module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities' at 'xmldb:exist:///db/xqueryLib/Utilities/utility_xquery_lib.xquery'; 5 4 (: … … 10 9 declare namespace moles='http://ndg.nerc.ac.uk/moles'; 11 10 12 declare variable $targetCollection as xs:string {'TargetCollection'};13 declare variable $repositoryIdentifier as xs:string {'RepositoryID'};14 declare variable $localIdentifier as xs:string {'LocalID'};11 declare variable $targetCollection as xs:string := 'TargetCollection'; 12 declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 13 declare variable $localIdentifier as xs:string := 'LocalID'; 15 14 declare function f:return-stub-activity($out-element-name as xs:string, $repid as xs:string, $locid as xs:string) as element() 16 15 (: Returns a 'stubB' style activity record to expand an activity record :) -
exist/trunk/xqueryLib/Utilities/utility_xquery_lib.xquery
r3071 r3841 1 1 module namespace utillib='http://ndg.nerc.ac.uk/xquery/lib/utilities'; 2 declare variable $utillib:libversion as xs:decimal {1.0};2 declare variable $utillib:libversion as xs:decimal := 1.0; 3 3 4 declare variable $utillib:moles_id_separator as xs:string {'__'};4 declare variable $utillib:moles_id_separator as xs:string := '__'; 5 5 6 6 declare function utillib:kev-strip-namespace($e as element()) as element() -
exist/trunk/xqueryLib/Vocabs/vocab_xquery_lib.xquery
r2511 r3841 1 1 module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab'; 2 declare variable $voclib:libversion as xs:decimal {1.0}; 2 declare variable $voclib:libversion as xs:decimal := 1.0; 3 (: Standard vocab roots :) 4 declare variable $voclib:unknown_vocab_id as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/null'; 3 5 4 (: Standard vocab roots :) 5 declare variable $voclib:unknown_vocab_id as xs:string {'http://vocab.ndg.nerc.ac.uk/term/null'}; 6 declare variable $voclib:iso_3166_alpha2 as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/C320'; 6 7 7 declare variable $voclib:iso_3166_alpha2 as xs:string {'http://vocab.ndg.nerc.ac.uk/term/C320'}; 8 declare variable $voclib:bodc_parameter_usage_vocab as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P011'; 9 declare variable $voclib:bodc_parameter_discovery_vocab as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P021'; 8 10 9 declare variable $voclib:bodc_parameter_usage_vocab as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P011'}; 10 declare variable $voclib:bodc_parameter_discovery_vocab as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P021'}; 11 declare variable $voclib:ndg_data_provider_vocab as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/N010'; 12 declare variable $voclib:ndg_online_reference_classes_vocab as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/L041'; 13 declare variable $voclib:ndg_activity_relations_vocab as xs:string := $voclib:unknown_vocab_id; 14 declare variable $voclib:ndg_de_relations_vocab as xs:string := $voclib:unknown_vocab_id; 15 declare variable $voclib:ndg_formats_vocab as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/N021'; 11 16 12 declare variable $voclib:ndg_data_provider_vocab as xs:string {'http://vocab.ndg.nerc.ac.uk/term/N010'}; 13 declare variable $voclib:ndg_online_reference_classes_vocab as xs:string {'http://vocab.ndg.nerc.ac.uk/term/L041'}; 14 declare variable $voclib:ndg_activity_relations_vocab as xs:string {$voclib:unknown_vocab_id}; 15 declare variable $voclib:ndg_de_relations_vocab as xs:string {$voclib:unknown_vocab_id}; 16 declare variable $voclib:ndg_formats_vocab as xs:string {'http://vocab.ndg.nerc.ac.uk/term/N021'}; 17 declare variable $voclib:bodc_unit_names as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P061'; 18 declare variable $voclib:cf_standard_names as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P071'; 19 declare variable $voclib:cf_cell_methods as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P151'; 17 20 18 declare variable $voclib:bodc_unit_names as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P061'}; 19 declare variable $voclib:cf_standard_names as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P071'}; 20 declare variable $voclib:cf_cell_methods as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P151'}; 21 declare variable $voclib:gcmd_instrument_valids as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P101'; 22 declare variable $voclib:gcmd_science_valids as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P04'; 23 declare variable $voclib:gcmd_science_valids_correct as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P041'; 24 declare variable $voclib:gcmd_science_valids_deprecated as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P042'; 25 declare variable $voclib:gcmd_science_valids_categories as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P111'; 26 declare variable $voclib:gcmd_science_valids_topics as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P121'; 27 declare variable $voclib:gcmd_science_valids_terms as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P131'; 28 declare variable $voclib:gcmd_science_valids_variables as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P141'; 21 29 22 declare variable $voclib:gcmd_instrument_valids as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P101'}; 23 declare variable $voclib:gcmd_science_valids as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P04'}; 24 declare variable $voclib:gcmd_science_valids_correct as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P041'}; 25 declare variable $voclib:gcmd_science_valids_deprecated as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P042'}; 26 declare variable $voclib:gcmd_science_valids_categories as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P111'}; 27 declare variable $voclib:gcmd_science_valids_topics as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P121'}; 28 declare variable $voclib:gcmd_science_valids_terms as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P131'}; 29 declare variable $voclib:gcmd_science_valids_variables as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P141'}; 30 declare variable $voclib:gcmd_project_valids as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P161'; 31 declare variable $voclib:gcmd_location_valids as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P171'; 32 declare variable $voclib:gcmd_chronostratigraphic_valids as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P181'; 33 declare variable $voclib:gcmd_url_content_valids as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P201'; 30 34 31 declare variable $voclib:gcmd_project_valids as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P161'}; 32 declare variable $voclib:gcmd_location_valids as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P171'}; 33 declare variable $voclib:gcmd_chronostratigraphic_valids as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P181'}; 34 declare variable $voclib:gcmd_url_content_valids as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P201'}; 35 36 declare variable $voclib:gcmd_iso_topic_list as xs:string {'http://gcmd.gsfc.nasa.gov/Resources/valids/iso_topic_list.html'}; 35 declare variable $voclib:gcmd_iso_topic_list as xs:string := 'http://gcmd.gsfc.nasa.gov/Resources/valids/iso_topic_list.html'; 37 36 38 37 (: ISO 19115 vocab namespaces :) 39 declare variable $voclib:iso_topic_list as xs:string {'http://vocab.ndg.nerc.ac.uk/term/P051'};40 declare variable $voclib:iso_CI_RoleCode as xs:string {'http://http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode'};41 declare variable $voclib:iso_CI_RoleCode_custodian as xs:string {'http://http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode_custodian'};42 declare variable $voclib:iso_MD_ScopeCode as xs:string {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode'};43 declare variable $voclib:iso_MD_ScopeCode_dataset as xs:string {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode_dataset'};38 declare variable $voclib:iso_topic_list as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/P051'; 39 declare variable $voclib:iso_CI_RoleCode as xs:string := 'http://http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode'; 40 declare variable $voclib:iso_CI_RoleCode_custodian as xs:string := 'http://http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode_custodian'; 41 declare variable $voclib:iso_MD_ScopeCode as xs:string := 'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode'; 42 declare variable $voclib:iso_MD_ScopeCode_dataset as xs:string := 'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode_dataset'; 44 43 45 44 (: MDIP specific namespaces :) 46 declare variable $voclib:ISO_639-2_ns as xs:string {'UKGemini_Language_Categories'};47 declare variable $voclib:ISO_3166_ns as xs:string {'UKGemini_Land_Area_Categories'};45 declare variable $voclib:ISO_639-2_ns as xs:string := 'UKGemini_Language_Categories'; 46 declare variable $voclib:ISO_3166_ns as xs:string := 'UKGemini_Land_Area_Categories'; 48 47 49 48 (: IHO list :) 50 declare variable $voclib:iho_s23_list as xs:string {'http://vocab.ndg.nerc.ac.uk/term/C161'};49 declare variable $voclib:iho_s23_list as xs:string := 'http://vocab.ndg.nerc.ac.uk/term/C161'; 51 50 52 51 declare function voclib:spot-vocab($vocab_root as xs:string, $vocab_uri as xs:string) as xs:boolean
Note: See TracChangeset
for help on using the changeset viewer.