Changeset 2358
- Timestamp:
- 02/04/07 08:36:07 (14 years ago)
- Location:
- TI07-MOLES/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TI07-MOLES/trunk/DIF/XQuery/DIF2MOLES.xquery
r2291 r2358 9 9 10 10 (: Replacable parameters :) 11 declare variable $targetCollection as xs:string {'/db/discovery'}; 12 declare variable $input_repository as xs:string {'Input_Repository_Code'}; 13 declare variable $input_repository_local as xs:string {'Input_Repository_LocalID'}; 14 declare variable $input_entry_id as xs:string {'GEOARCHIVES'}; 15 declare variable $localIdentifier as xs:string {'GEOARCHIVES'}; 16 17 declare variable $output_local_id as xs:string {'Output_LocalID'}; 18 (: Keep 11 19 declare variable $targetCollection as xs:string {'TargetCollection'}; 12 20 declare variable $input_repository as xs:string {'Input_Repository_Code'}; … … 14 22 declare variable $input_entry_id as xs:string {'Input_Entry_ID'}; 15 23 declare variable $output_local_id as xs:string {'Output_LocalID'}; 16 24 :) 17 25 for $DIF in collection($targetCollection)/dif:DIF[dif:Entry_ID=$input_entry_id] 18 26 return … … 38 46 element metadataDescriptionLastUpdated {current-date()} , 39 47 element abstract { 40 element abstractText {string($DIF/dif:Summary)} 48 element abstractText {string($DIF/dif:Summary)}, 49 for $descOnline in $DIF/dif:Related_URL 50 return 51 element descriptionSection { 52 element descriptionOnlineReference { 53 element dgSimpleLink {escape-uri(data($descOnline/dif:URL), true())}}, 54 if (exists($descOnline/dif:URL_Content_Type)) then 55 element dgReferenceName {data($descOnline/dif:URL)} 56 else () 57 } 41 58 } 42 59 }, … … 62 79 }, 63 80 element dgStdParameterMeasured { 64 element dgValidTerm {string($parameter/dif:Category)}, 81 if ($parameter/dif:Category!='') then element dgValidTerm {string($parameter/dif:Category)} 82 else element dgValidTerm {'unknown'}, 65 83 element dgValidTermID { 66 84 element ParentListID {concat($voclib:gcmd_science_valids_categories, '/current')}, … … 68 86 }, 69 87 element dgValidSubterm { 70 element dgValidTerm {string($parameter/dif:Topic)}, 88 if ($parameter/dif:Topic!='') then element dgValidTerm {string($parameter/dif:Topic)} 89 else element dgValidTerm {'unknown'}, 71 90 element dgValidTermID { 72 91 element ParentListID {concat($voclib:gcmd_science_valids_topics, '/current')}, 73 element TermID {escape-uri($parameter/dif: Category, true())}92 element TermID {escape-uri($parameter/dif:Topic, true())} 74 93 }, 75 94 element dgValidSubterm { 76 element dgValidTerm {string($parameter/dif:Term)}, 95 if ($parameter/dif:Term!='') then element dgValidTerm {string($parameter/dif:Term)} 96 else element dgValidTerm {'unknown'}, 77 97 element dgValidTermID { 78 98 element ParentListID {concat($voclib:gcmd_science_valids_terms, '/current')}, 79 99 element TermID {escape-uri($parameter/dif:Term, true())} 80 100 }, 81 if (exists($parameter/dif:Variable) ) then101 if (exists($parameter/dif:Variable) and $parameter/dif:Variable!='') then 82 102 element dgValidSubterm { 83 103 element dgValidTerm {string($parameter/dif:Variable)}, … … 86 106 element TermID {escape-uri($parameter/dif:Variable, true())} 87 107 }, 88 if (exists($parameter/dif:Detailed_Variable) ) then108 if (exists($parameter/dif:Detailed_Variable) and $parameter/dif:Detailed_Variable!='') then 89 109 element dgValidSubterm { 90 110 element dgValidTerm {string($parameter/dif:Detailed_Variable)}, … … 106 126 element ParameterName { 107 127 concat (string($parameter/dif:Category), ' > ', string($parameter/dif:Topic), ' > ', string($parameter/dif:Term)), 108 if (exists($parameter/dif:Variable) ) then128 if (exists($parameter/dif:Variable) and $parameter/dif:Variable!='') then 109 129 concat(' > ', string($parameter/dif:Variable)) 110 130 else (), 111 if (exists($parameter/dif:Detailed_Variable) ) then131 if (exists($parameter/dif:Detailed_Variable) and $parameter/dif:Detailed_Variable!='') then 112 132 concat(' > ', string($parameter/dif:Detailed_Variable)) 113 133 else () … … 115 135 element ParameterAbbreviation { 116 136 concat (string($parameter/dif:Category), ' > ', string($parameter/dif:Topic), ' > ', string($parameter/dif:Term)), 117 if (exists($parameter/dif:Variable) ) then137 if (exists($parameter/dif:Variable) and $parameter/dif:Variable!='') then 118 138 concat(' > ', string($parameter/dif:Variable)) 119 139 else (), 120 if (exists($parameter/dif:Detailed_Variable) ) then140 if (exists($parameter/dif:Detailed_Variable) and $parameter/dif:Detailed_Variable!='') then 121 141 concat(' > ', string($parameter/dif:Detailed_Variable)) 122 142 else () … … 193 213 return 194 214 element dgRoleHolder { 195 element dg OrganisationID {215 element dgMetadataID { 196 216 element schemeIdentifier {'NDG-B0'}, 197 217 element repositoryIdentifier {$input_repository}, -
TI07-MOLES/trunk/DIF/XQuery/NDG-DIF.xquery
r2302 r2358 4 4 declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance'; 5 5 declare namespace moles='http://ndg.nerc.ac.uk/moles'; 6 (: Keep 6 7 declare variable $targetCollection as xs:string {'TargetCollection'}; 7 8 declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 8 9 declare variable $localIdentifier as xs:string {'LocalID'}; 10 :) 11 declare variable $targetCollection as xs:string {'/db/discovery'}; 12 declare variable $repositoryIdentifier as xs:string {'grid.bodc.nerc.ac.uk'}; 13 declare variable $localIdentifier as xs:string {'neodc.nerc.ac.uk:DIF:NEODC_NCAVEO_LCM2000'}; 9 14 10 15 for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ … … 137 142 for $DataCreatorRoleHolder in collection($targetCollection)/moles:dgMetadata/(moles:dgOrganisation | moles:dgPerson) 138 143 [(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 139 and moles:dgMetadataID/moles:repositoryIdentifier=$DataCreatorRole/ (moles:dgOrganisationID | moles:dgPersonID)/moles:repositoryIdentifier140 and moles:dgMetadataID/moles:localIdentifier=$DataCreatorRole/ (moles:dgOrganisationID | moles:dgPersonID)/moles:localIdentifier)]144 and moles:dgMetadataID/moles:repositoryIdentifier=$DataCreatorRole/*/moles:repositoryIdentifier 145 and moles:dgMetadataID/moles:localIdentifier=$DataCreatorRole/*/moles:localIdentifier)] 141 146 return 142 147 element Originating_Center { … … 148 153 } 149 154 else (), 150 for $DataCuratorRole in $DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCurator/moles:dgRoleHolder[not(exists(moles:endDate)) or moles:endDate=''] 151 return 152 for $DataCuratorRoleHolder in collection($targetCollection)/moles:dgMetadata/*[(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 153 and moles:dgMetadataID/moles:repositoryIdentifier=$DataCuratorRole/*/moles:repositoryIdentifier 154 and moles:dgMetadataID/moles:localIdentifier=$DataCuratorRole/*/moles:localIdentifier)] 155 return 156 element Data_Center { 157 element Data_Center_Name { 158 element Short_Name { 159 if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 160 string(concat(string($DataCuratorRoleHolder/moles:name/moles:initials), ' ', string($DataCuratorRoleHolder/moles:name/moles:familyName))) 161 else 162 string($DataCuratorRoleHolder/moles:abbreviation) 163 }, 164 element Long_Name { 165 if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 166 string(concat(string($DataCuratorRoleHolder/moles:name/moles:initials), ' ', string($DataCuratorRoleHolder/moles:name/moles:familyName))) 167 else string($DataCuratorRoleHolder/moles:name) 168 } 169 }, 170 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:URI)) then 171 element Data_Center_URL {data($DataCuratorRoleHolder/moles:contactDetails/moles:URI)} 172 else (), 173 for $DGID in $DE/moles:dgDataEntity/moles:dgDataGranule/moles:dataModelID 174 return 175 element Data_Set_ID {concat($DGID/moles:repositoryIdentifier, '__', $DGID/moles:schemeIdentifier, '__', $DGID/moles:localIdentifier)}, 176 element Personnel { 177 element Role {'Data Center Contact'}, 178 if (exists($DataCuratorRoleHolder/name/knownAs)) then 179 element First_Name {string($DataCuratorRoleHolder/moles:name/moles:knownAs)} 180 else if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 181 element First_Name {string($DataCuratorRoleHolder/moles:name/moles:initials)} 182 else (), 183 element Last_Name { 184 if (exists($DataCuratorRoleHolder/moles:name/moles:familyName)) then 185 string($DataCuratorRoleHolder/moles:name/moles:familyName) 186 else string($DataCuratorRoleHolder/moles:name) 187 }, 188 if (exists($DataCuratorRole/moles:contactDetails/moles:eMail)) then 189 element Email {string($DataCuratorRole/moles:contactDetails/moles:eMail)} 190 else 191 if (exists($DataCuratorRoleHolder/contactDetails/eMail)) then 192 (element Email {string($DataCuratorRoleHolder/moles:contactDetails/moles:eMail)}) 193 else (), 194 if (exists($DataCuratorRole/moles:contactDetails/moles:telephone)) then 195 element Phone {string($DataCuratorRole/moles:contactDetails/moles:telephone)} 196 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:telephone)) then 197 element Phone {string($DataCuratorRoleHolder/moles:contactDetails/moles:telephone)} 198 else (), 199 if (exists($DataCuratorRole/moles:contactDetails/moles:fax)) then 200 element Fax {string($DataCuratorRole/moles:contactDetails/moles:fax)} 201 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:fax)) then 202 element Fax {string($DataCuratorRoleHolder/moles:contactDetails/moles:fax)} 203 else (), 204 if (exists($DataCuratorRole/moles:contactDetails/moles:address)) then 205 element Contact_Address { 206 for $addressline in $DataCuratorRole/moles:contactDetails/moles:address/moles:addressline 207 return element Address {data($addressline)}, 208 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:city)) then 209 element City {string($DataCuratorRole/moles:contactDetails/moles:address/moles:city)} 210 else (), 211 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:postcode)) then 212 element Postal_Code {string($DataCuratorRole/moles:contactDetails/moles:address/moles:postcode)} 213 else (), 214 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:country)) then 215 element Country {string($DataCuratorRole/moles:contactDetails/moles:address/moles:country)} 216 else () 217 } 218 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address)) then 219 element Contact_Address { 220 for $addressline in $DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:addressline 221 return element Address {data($addressline)}, 222 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:city)) then 223 element City {string($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:city)} 224 else (), 225 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:postcode)) then 226 element Postal_Code {string($DataCuratorRole/moles:contactDetails/moles:postcode)} 227 else (), 228 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:country)) then 229 element Country {string($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:country)} 230 else () 231 } 232 else () 233 } 234 }, 155 for $DataCuratorRole in $DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCurator/moles:dgRoleHolder 156 [not(exists(moles:endDate)) or moles:endDate=''] 157 return 158 for $DataCuratorRoleHolder in collection($targetCollection)/moles:dgMetadata/(moles:dgOrganisation | moles:dgPerson) 159 [(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 160 and moles:dgMetadataID/moles:repositoryIdentifier=$DataCuratorRole/*/moles:repositoryIdentifier 161 and moles:dgMetadataID/moles:localIdentifier=$DataCuratorRole/*/moles:localIdentifier)] 162 return 163 element Data_Center { 164 element Data_Center_Name { 165 element Short_Name { 166 if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 167 string(concat(string($DataCuratorRoleHolder/moles:name/moles:initials), ' ', string($DataCuratorRoleHolder/moles:name/moles:familyName))) 168 else 169 string($DataCuratorRoleHolder/moles:abbreviation) 170 }, 171 element Long_Name { 172 if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 173 string(concat(string($DataCuratorRoleHolder/moles:name/moles:initials), ' ', string($DataCuratorRoleHolder/moles:name/moles:familyName))) 174 else string($DataCuratorRoleHolder/moles:name) 175 } 176 }, 177 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:URI)) then 178 element Data_Center_URL {data($DataCuratorRoleHolder/moles:contactDetails/moles:URI)} 179 else (), 180 for $DGID in $DE/moles:dgDataEntity/moles:dgDataGranule/moles:dataModelID 181 return 182 element Data_Set_ID {concat($DGID/moles:repositoryIdentifier, $utillib:moles_id_separator, $DGID/moles:schemeIdentifier, $utillib:moles_id_separator, $DGID/moles:localIdentifier)}, 183 element Personnel { 184 element Role {'Data Center Contact'}, 185 if (exists($DataCuratorRoleHolder/name/knownAs)) then 186 element First_Name {string($DataCuratorRoleHolder/moles:name/moles:knownAs)} 187 else if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 188 element First_Name {string($DataCuratorRoleHolder/moles:name/moles:initials)} 189 else (), 190 element Last_Name { 191 if (exists($DataCuratorRoleHolder/moles:name/moles:familyName)) then 192 string($DataCuratorRoleHolder/moles:name/moles:familyName) 193 else string($DataCuratorRoleHolder/moles:name) 194 }, 195 if (exists($DataCuratorRole/moles:contactDetails/moles:eMail)) then 196 element Email {string($DataCuratorRole/moles:contactDetails/moles:eMail)} 197 else 198 if (exists($DataCuratorRoleHolder/contactDetails/eMail)) then 199 (element Email {string($DataCuratorRoleHolder/moles:contactDetails/moles:eMail)}) 200 else (), 201 if (exists($DataCuratorRole/moles:contactDetails/moles:telephone)) then 202 element Phone {string($DataCuratorRole/moles:contactDetails/moles:telephone)} 203 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:telephone)) then 204 element Phone {string($DataCuratorRoleHolder/moles:contactDetails/moles:telephone)} 205 else (), 206 if (exists($DataCuratorRole/moles:contactDetails/moles:fax)) then 207 element Fax {string($DataCuratorRole/moles:contactDetails/moles:fax)} 208 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:fax)) then 209 element Fax {string($DataCuratorRoleHolder/moles:contactDetails/moles:fax)} 210 else (), 211 if (exists($DataCuratorRole/moles:contactDetails/moles:address)) then 212 element Contact_Address { 213 for $addressline in $DataCuratorRole/moles:contactDetails/moles:address/moles:addressline 214 return element Address {data($addressline)}, 215 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:city)) then 216 element City {string($DataCuratorRole/moles:contactDetails/moles:address/moles:city)} 217 else (), 218 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:postcode)) then 219 element Postal_Code {string($DataCuratorRole/moles:contactDetails/moles:address/moles:postcode)} 220 else (), 221 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:country)) then 222 element Country {string($DataCuratorRole/moles:contactDetails/moles:address/moles:country)} 223 else () 224 } 225 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address)) then 226 element Contact_Address { 227 for $addressline in $DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:addressline 228 return element Address {data($addressline)}, 229 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:city)) then 230 element City {string($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:city)} 231 else (), 232 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:postcode)) then 233 element Postal_Code {string($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:postcode)} 234 else (), 235 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:country)) then 236 element Country {string($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:country)} 237 else () 238 } 239 else () 240 } 241 }, 235 242 element Summary {string($DE/moles:dgMetadataDescription/moles:abstract/moles:abstractText)}, 236 243 for $DG in $DE/moles:dgDataEntity/moles:dgDataGranule … … 285 292 for $RelURL_Desc in ($DE/moles:dgMetadataDescription/moles:descriptionSection/moles:descriptionOnlineReference) 286 293 return 294 if (exists($RelURL_Desc/moles:dgSimpleLink)) then 287 295 element Related_URL { 288 if (exist($RelURL_Desc/dgSimpleLink)) then 289 element URL {data($RelURL_Desc/dgSimpleLink/URI)}, 296 element URL {data($RelURL_Desc/moles:dgSimpleLink/URI)}, 290 297 element Description {concat(data($RelURL_Desc/dgSimpleLink/moles:name), ' - ', data($RelURL_Desc/dgSimpleLink/moles:notes))} 291 else ()292 },298 } 299 else (), 293 300 element Metadata_Name {'[CEOS IDN DIF]'}, 294 301 element Metadata_Version {'9.4'}, -
TI07-MOLES/trunk/MDIP/MDIPRelated.spp
r2334 r2358 4 4 <File FilePath=".\Examples\Gemini_MDIP_v0.5.xml" HomeFolder="Yes"/> 5 5 <ExtMountFolder FolderName="C:\test"/> 6 <ExtMountFolder FolderName="C:\Documents and Settings\Kevin\backup\eXist_daily_070327_0301\db\discovery"/> 6 7 </Folder> 7 8 <Folder FolderName="XSL Files" ExtStr="xsl;xslt"/> -
TI07-MOLES/trunk/MOLES.xpr
r2236 r2358 32 32 <file name="v1Schema/Schemae/ndgmetadata1.2.5.xsd"/> 33 33 <file name="v1Schema/Schemae/ndgmetadata1.3.xsd"/> 34 <file name="DIF/XQuery/test.xquery"/> 34 35 <file name="StubB/XQuery/testquery.xquery"/> 35 36 </projectTree> -
TI07-MOLES/trunk/PythonCode/wsgi/ndg_xqueries.py
r2335 r2358 1519 1519 declare variable $repositoryIdentifier as xs:string {'RepositoryID'}; 1520 1520 declare variable $localIdentifier as xs:string {'LocalID'}; 1521 1522 1521 for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 1523 1524 1525 1526 1527 1522 exists('moles:dgDataEntity') 1523 and moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 1524 and moles:dgMetadataID/moles:repositoryIdentifier=$repositoryIdentifier 1525 and moles:dgMetadataID/moles:localIdentifier=$localIdentifier] 1526 return 1528 1527 element DIF { 1529 attribute xsi:schemaLocation {'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/ http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/dif_v9.4.xsd'}, 1530 element Entry_ID {concat($DE/moles:dgMetadataID/moles:repositoryIdentifier, $utillib:moles_id_separator, 'DIF', $utillib:moles_id_separator, $DE/moles:dgMetadataID/moles:localIdentifier)}, 1531 element Entry_Title {string($DE/moles:name)}, 1532 element Data_Set_Citation { 1533 for $DataCreatorRole in $DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCreator/moles:dgRoleHolder[not(exists(moles:endDate)) or moles:endDate=''][1] 1534 return 1535 for $DataCreatorRoleHolder in collection($targetCollection)/moles:dgMetadata/*[(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 1536 and moles:dgMetadataID/moles:repositoryIdentifier=$DataCreatorRole/*/moles:repositoryIdentifier 1537 and moles:dgMetadataID/moles:localIdentifier=$DataCreatorRole/*/moles:localIdentifier)] 1538 return 1539 element Dataset_Creator { 1540 if (exists($DataCreatorRoleHolder/moles:name/moles:initials)) then 1541 string(concat(string($DataCreatorRoleHolder/moles:name/moles:initials), ' ', string($DataCreatorRoleHolder/moles:name/moles:familyName))) 1542 else 1543 string($DataCreatorRoleHolder/moles:abbreviation) 1544 }, 1545 element Dataset_Title {string($DE/moles:name)} 1546 }, 1547 for $StructuredKeyword in ($DE//(moles:dgStructuredKeyword | moles:dgStdParameterMeasured)[(voclib:spot-vocab($voclib:gcmd_science_valids, moles:dgValidTermID/moles:ParentListID) or voclib:spot-vocab($voclib:gcmd_science_valids_correct, moles:dgValidTermID/moles:ParentListID) or voclib:spot-vocab($voclib:gcmd_science_valids_categories, moles:dgValidTermID/moles:ParentListID))] 1548 ) 1549 return if (exists($StructuredKeyword/*/moles:dgValidTerm)) then 1550 element Parameters { 1551 element Category {string($StructuredKeyword/*/moles:dgValidTerm)}, 1552 if (exists($StructuredKeyword//moles:dgValidSubterm) 1553 and $StructuredKeyword//moles:dgValidSubterm != '' 1554 and $StructuredKeyword//moles:dgValidSubterm != ' ') then 1555 for $Subterm in $StructuredKeyword//moles:dgValidSubterm[exists(moles:dgValidTerm)] 1556 where exists($Subterm/moles:dgValidSubterm) 1557 order by $Subterm/moles:ListLevel 1558 return 1559 if ($Subterm/moles:ListLevel=1) then element Topic {string($Subterm/moles:dgValidSubterm/moles:dgValidTerm)} 1560 else if ($Subterm/moles:ListLevel=2) then element Term {string($Subterm/moles:dgValidSubterm/moles:dgValidTerm)} 1561 else if ($Subterm/moles:ListLevel=3) then element Variable {string($Subterm/moles:dgValidSubterm/moles:dgValidTerm)} 1562 else if ($Subterm/moles:ListLevel=4) then element Detailed_Variable {string($Subterm/moles:dgValidSubterm/moles:dgValidTerm)} 1563 else element GCMD_Science_Valid {string($Subterm/moles:dgValidSubterm/moles:dgValidTerm)} 1564 else() 1565 } 1566 else(), 1567 for $StructuredKeyword in ($DE//(moles:dgStructuredKeyword | moles:dgDataEntity/moles:dgDataSummary/moles:dgParameterSummary/moles:dgStdParameterMeasured)[voclib:spot-vocab($voclib:gcmd_science_valids, moles:dgValidTermID/moles:ParentListID) or voclib:spot-vocab($voclib:gcmd_science_valids_correct, moles:dgValidTermID/moles:ParentListID) or voclib:spot-vocab($voclib:gcmd_science_valids_deprecated, moles:dgValidTermID/moles:ParentListID) and (not(exists(moles:ListLevel)) or moles:ListLevel=0)]) 1568 return 1569 element Parameters {data($StructuredKeyword/moles:dgValidTerm)}, 1570 for $ISOTopicCategory in ($DE/moles:dgStructuredKeyword[voclib:spot-vocab($voclib:iso_topic_list, moles:dgValidTermID/moles:ParentListID)]) 1571 return 1572 element ISO_Topic_Category {string($ISOTopicCategory/moles:dgValidTerm)}, 1573 for $Keyword in distinct-values($DE//moles:dgStructuredKeyword[ 1574 not (voclib:spot-vocab($voclib:iso_topic_list, moles:dgValidTermID/moles:ParentListID) 1575 or voclib:spot-vocab($voclib:gcmd_science_valids, moles:dgValidTermID/moles:ParentListID) 1576 or voclib:spot-vocab($voclib:gcmd_science_valids_correct, moles:dgValidTermID/moles:ParentListID) 1577 )]/moles:dgValidTerm) 1578 return element Keyword {string($Keyword)}, 1579 for $DepDPT in ($DE/moles:dgDataEntity/moles:RelatedDeployment/moles:DataProductionToolID) 1580 return 1581 element Sensor_Name { 1582 for $DepDPTAbbrev in ((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:abbreviation)) 1583 return element Short_Name {data($DepDPTAbbrev)}, 1584 for $DepDPTName in ((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:name)) 1585 return element Long_Name {data($DepDPTName)} 1586 }, 1587 for $DepObsStn in ($DE/moles:dgDataEntity/moles:RelatedDeployment/moles:ObservationStationID) 1588 return 1589 element Source_Name { 1590 for $DepObsStnAbbrev in ((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:abbreviation)) 1591 return element Short_Name {data($DepObsStnAbbrev)}, 1592 for $DepObsStnName in ((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:name)) 1593 return element Long_Name {data($DepObsStnName)} 1594 }, 1595 for $TemporalRange in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:dgDateRange) 1596 return 1597 element Temporal_Coverage 1598 { 1599 element Start_Date {data($TemporalRange/moles:DateRangeStart)}, 1600 element End_Date {data($TemporalRange/moles:DateRangeEnd)} 1601 }, 1602 for $TemporalTerm in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:dgArea[voclib:spot-vocab($voclib:gcmd_chronostratigraphic_valids, moles:dgValidTermID/moles:ParentListID)]/moles:dgValidTerm) 1603 return element Paleo_Temporal_Coverage {element Chronostratigraphic_Unit {data($TemporalTerm)}}, 1604 for $Data_Set_Progress in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataStatus/moles:dgDatasetClosure) 1605 return element Data_Set_Progress {data($Data_Set_Progress)}, 1606 for $BoundingBox in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:BoundingBox) 1607 return 1608 element Spatial_Coverage { 1609 element Southernmost_Latitude {data($BoundingBox/moles:LimitSouth)}, 1610 element Northernmost_Latitude {data($BoundingBox/moles:LimitNorth)}, 1611 element Westernmost_Longitude {data($BoundingBox/moles:LimitWest)}, 1612 element Easternmost_Longitude {data($BoundingBox/moles:LimitEast)} 1613 }, 1614 for $Location in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:dgArea[voclib:spot-vocab($voclib:gcmd_location_valids, moles:dgValidTermID/moles:ParentListID)]) 1615 return element Location {data($Location/moles:dgValidTerm)}, 1616 for $DepAct in ($DE/moles:dgDataEntity/moles:RelatedDeployment/moles:ActivityID) 1617 return 1618 element Project { 1619 for $DepActAbbrev in (collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepAct/moles:repositoryIdentifier and moles:localIdentifier=$DepAct/moles:localIdentifier]]/moles:abbreviation) 1620 return 1621 element Short_Name {data($DepActAbbrev)}, 1622 for $DepActName in (collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepAct/moles:repositoryIdentifier and moles:localIdentifier=$DepAct/moles:localIdentifier]]/moles:name) 1623 return 1624 element Long_Name {data($DepActName)} 1625 }, 1626 if (exists($DE/moles:dgDataEntity/moles:dgDataGranule/moles:accessControlPolicy)) then 1627 for $DG in $DE/moles:dgDataEntity/moles:dgDataGranule 1628 return 1629 element Access_Constraints { 1630 if (exists($DG/moles:dgGranuleSummary/moles:dgGranuleName)) then 1631 concat('For data granule ', $DG/moles:dgGranuleSummary/moles:dgGranuleName, ': ') 1632 else (), 1633 if (exists($DG/moles:accessControlPolicy/moles:accessControlPolicyURL)) then 1634 concat('See access control policy at ', escape-uri($DG/moles:accessControlPolicy/moles:accessControlPolicyURL, true())) 1635 else if (exists($DG/moles:accessControlPolicy/moles:accessControlPolicyText)) then 1636 data($DG/moles:accessControlPolicy/moles:accessControlPolicyText) 1637 else 1638 for $securityCondition in $DG/moles:accessControlPolicy/moles:dgSecurityCondition 1639 return 1640 if (exists($securityCondition/moles:conditionExplanationText)) then 1641 concat('Effect: ', data($securityCondition/moles:effect), ' - ', data($securityCondition/moles:conditionExplanationText)) 1642 else concat('Effect: ', data($securityCondition/moles:effect), 'needs ', data($securityCondition/moles:attauthRole), ' from ', data($securityCondition/moles:dgAttributeAuthority)) 1643 } 1644 else (), 1645 if (exists($DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCreator/moles:dgRoleHolder)) then 1646 for $DataCreatorRole in $DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCreator/moles:dgRoleHolder 1647 order by $DataCreatorRole/moles:startDate empty least 1648 return 1649 for $DataCreatorRoleHolder in collection($targetCollection)/moles:dgMetadata/(moles:dgOrganisation | moles:dgPerson) 1650 [(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 1651 and moles:dgMetadataID/moles:repositoryIdentifier=$DataCreatorRole/(moles:dgOrganisationID | moles:dgPersonID)/moles:repositoryIdentifier 1652 and moles:dgMetadataID/moles:localIdentifier=$DataCreatorRole/(moles:dgOrganisationID | moles:dgPersonID)/moles:localIdentifier)] 1653 return 1654 element Originating_Center { 1655 if (string(local-name($DataCreatorRoleHolder))='dgOrganisation') then 1656 (string($DataCreatorRoleHolder/moles:name)) 1657 else if (string(local-name($DataCreatorRoleHolder))='dgPerson') then 1658 (string(concat(string($DataCreatorRoleHolder/moles:name/moles:initials), ' ', string($DataCreatorRoleHolder/moles:name/moles:familyName)))) 1659 else ('empty content') 1660 } 1661 else (), 1662 for $DataCuratorRole in $DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCurator/moles:dgRoleHolder[not(exists(moles:endDate)) or moles:endDate=''] 1663 return 1664 for $DataCuratorRoleHolder in collection($targetCollection)/moles:dgMetadata/*[(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 1665 and moles:dgMetadataID/moles:repositoryIdentifier=$DataCuratorRole/*/moles:repositoryIdentifier 1666 and moles:dgMetadataID/moles:localIdentifier=$DataCuratorRole/*/moles:localIdentifier)] 1667 return 1668 element Data_Center { 1669 element Data_Center_Name { 1670 element Short_Name { 1671 if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 1672 string(concat(string($DataCuratorRoleHolder/moles:name/moles:initials), ' ', string($DataCuratorRoleHolder/moles:name/moles:familyName))) 1673 else 1674 string($DataCuratorRoleHolder/moles:abbreviation) 1675 }, 1676 element Long_Name { 1677 if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 1678 string(concat(string($DataCuratorRoleHolder/moles:name/moles:initials), ' ', string($DataCuratorRoleHolder/moles:name/moles:familyName))) 1679 else string($DataCuratorRoleHolder/moles:name) 1680 } 1681 }, 1682 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:URI)) then 1683 element Data_Center_URL {data($DataCuratorRoleHolder/moles:contactDetails/moles:URI)} 1684 else (), 1685 for $DGID in $DE/moles:dgDataEntity/moles:dgDataGranule/moles:dataModelID 1686 return 1687 element Data_Set_ID {concat($DGID/moles:repositoryIdentifier, '__', $DGID/moles:schemeIdentifier, '__', $DGID/moles:localIdentifier)}, 1688 element Personnel { 1689 element Role {'Data Center Contact'}, 1690 if (exists($DataCuratorRoleHolder/name/knownAs)) then 1691 element First_Name {string($DataCuratorRoleHolder/moles:name/moles:knownAs)} 1692 else if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 1693 element First_Name {string($DataCuratorRoleHolder/moles:name/moles:initials)} 1694 else (), 1695 element Last_Name { 1696 if (exists($DataCuratorRoleHolder/moles:name/moles:familyName)) then 1697 string($DataCuratorRoleHolder/moles:name/moles:familyName) 1698 else string($DataCuratorRoleHolder/moles:name) 1699 }, 1700 if (exists($DataCuratorRole/moles:contactDetails/moles:eMail)) then 1701 element Email {string($DataCuratorRole/moles:contactDetails/moles:eMail)} 1702 else 1703 if (exists($DataCuratorRoleHolder/contactDetails/eMail)) then 1704 (element Email {string($DataCuratorRoleHolder/moles:contactDetails/moles:eMail)}) 1705 else (), 1706 if (exists($DataCuratorRole/moles:contactDetails/moles:telephone)) then 1707 element Phone {string($DataCuratorRole/moles:contactDetails/moles:telephone)} 1708 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:telephone)) then 1709 element Phone {string($DataCuratorRoleHolder/moles:contactDetails/moles:telephone)} 1710 else (), 1711 if (exists($DataCuratorRole/moles:contactDetails/moles:fax)) then 1712 element Fax {string($DataCuratorRole/moles:contactDetails/moles:fax)} 1713 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:fax)) then 1714 element Fax {string($DataCuratorRoleHolder/moles:contactDetails/moles:fax)} 1715 else (), 1716 if (exists($DataCuratorRole/moles:contactDetails/moles:address)) then 1717 element Contact_Address { 1718 for $addressline in $DataCuratorRole/moles:contactDetails/moles:address/moles:addressline 1719 return element Address {data($addressline)}, 1720 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:city)) then 1721 element City {string($DataCuratorRole/moles:contactDetails/moles:address/moles:city)} 1722 else (), 1723 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:postcode)) then 1724 element Postal_Code {string($DataCuratorRole/moles:contactDetails/moles:address/moles:postcode)} 1725 else (), 1726 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:country)) then 1727 element Country {string($DataCuratorRole/moles:contactDetails/moles:address/moles:country)} 1728 else () 1729 } 1730 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address)) then 1731 element Contact_Address { 1732 for $addressline in $DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:addressline 1733 return element Address {data($addressline)}, 1734 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:city)) then 1735 element City {string($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:city)} 1736 else (), 1737 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:postcode)) then 1738 element Postal_Code {string($DataCuratorRole/moles:contactDetails/moles:postcode)} 1739 else (), 1740 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:country)) then 1741 element Country {string($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:country)} 1742 else () 1743 } 1744 else () 1745 } 1746 }, 1747 element Summary {string($DE/moles:dgMetadataDescription/moles:abstract/moles:abstractText)}, 1748 for $DG in $DE/moles:dgDataEntity/moles:dgDataGranule 1749 return 1750 if ($DG/moles:dataModelID/moles:schemeIdentifier='NDG-A0') then 1751 (element Related_URL { 1752 element URL_Content_Type {'NDG_A_SERVICE'}, 1753 if (exists($DG/instance/URI)) then 1754 element URL {escape-uri($DG/instance/URI, true())} 1755 else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 1756 element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&datasetID=', true())} 1757 else ($DG/moles:dataModelID/moles:repositoryIdentifier), 1758 element Description {'The NDG service delivering data via NDG A metadata.'} 1759 }, 1760 element Related_URL { 1761 element URL_Content_Type {'GET DATA > CSML'}, 1762 if (exists($DG/instance)) then 1763 element URL {escape-uri($DG/instance/URI, true())} 1764 else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 1765 element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&datasetID=', true())} 1766 else (), 1767 element Description {'The NDG service delivering data via NDG A metadata. Additional tag to be more in line with latest version of GCMD valids'} 1768 }) 1769 else if ($DG/moles:dataModelID/moles:schemeIdentifier='CDML-0') then 1770 (element Related_URL { 1771 element URL_Content_Type {'NDG_A_SERVICE'}, 1772 if (exists($DG/instance)) then 1773 element URL {escape-uri($DG/instance/URI, true())} 1774 else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 1775 element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())} 1776 else (), 1777 element Description {'The NDG service delivering data via Data extractor. Additional tag to be more in line with latest version of GCMD valids'} 1778 }, 1779 element Related_URL { 1780 element URL_Content_Type {'GET DATA > DX'}, 1781 if (exists($DG/instance)) then 1782 element URL {escape-uri($DG/instance/URI, true())} 1783 else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 1784 element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())} 1785 else (), 1786 element Description {'The NDG service delivering data via Data extractor. Additional tag to be more in line with latest version of GCMD valids'} 1787 }) 1788 else if ($DG/moles:dataModelID/moles:schemeIdentifier='URI') then 1789 element Related_URL { 1790 element URL {data($DG/moles:instance/moles:URI)}, 1791 if (exists($DG/moles:instance/moles:instanceComment)) then 1792 element Description {data($DG/moles:instance/moles:instanceComment)} 1793 else 1794 element Description {'URL to aid in delivering data. Note that this may point directly to the data or, more likely, point to the web site of the curator.'} 1795 } 1796 else (), 1797 for $RelURL_Desc in ($DE/moles:dgMetadataDescription/moles:descriptionSection/moles:descriptionOnlineReference) 1798 return 1799 element Related_URL { 1800 if (exists($RelURL_Desc/dgSimpleLink)) then ( 1801 element URL {data($RelURL_Desc/dgSimpleLink/URI)}, 1802 element Description {concat(data($RelURL_Desc/dgSimpleLink/moles:name), ' - ', data($RelURL_Desc/dgSimpleLink/moles:notes))} 1803 ) 1804 else () 1805 }, 1806 element Metadata_Name {'[CEOS IDN DIF]'}, 1807 element Metadata_Version {'9.4'}, 1808 if (exists($DE/moles:dgMetadataProvenance/moles:RecordCreation)) then 1809 element DIF_Creation_Date {data($DE/moles:dgMetadataProvenance/moles:RecordCreation/moles:CreatedDate)} 1810 else (), 1811 for $MDUpdt in $DE/moles:dgMetadataProvenance/moles:RecordUpdate 1812 return 1813 element DIF_Revision_History {concat(data($MDUpdt/moles:UpdateDate), ' - ', data($MDUpdt/moles:UpdateSummary), ' - ', data($MDUpdt/moles:UpdatedBy))}, 1814 if (exists($DE/moles:dgMetadataProvenance/moles:RecordReview)) then 1815 element Future_DIF_Review_Date {data($DE/moles:dgMetadataProvenance/moles:RecordReview/moles:ReviewDate)} 1816 else () 1817 }''' 1528 attribute xsi:schemaLocation {'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/ http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/dif_v9.4.xsd'}, 1529 element Entry_ID {concat($DE/moles:dgMetadataID/moles:repositoryIdentifier, $utillib:moles_id_separator, 'DIF', $utillib:moles_id_separator, $DE/moles:dgMetadataID/moles:localIdentifier)}, 1530 element Entry_Title {string($DE/moles:name)}, 1531 element Data_Set_Citation { 1532 for $DataCreatorRole in $DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCreator/moles:dgRoleHolder[not(exists(moles:endDate)) or moles:endDate=''][1] 1533 return 1534 for $DataCreatorRoleHolder in collection($targetCollection)/moles:dgMetadata/*[(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 1535 and moles:dgMetadataID/moles:repositoryIdentifier=$DataCreatorRole/*/moles:repositoryIdentifier 1536 and moles:dgMetadataID/moles:localIdentifier=$DataCreatorRole/*/moles:localIdentifier)] 1537 return 1538 element Dataset_Creator { 1539 if (exists($DataCreatorRoleHolder/moles:name/moles:initials)) then 1540 string(concat(string($DataCreatorRoleHolder/moles:name/moles:initials), ' ', string($DataCreatorRoleHolder/moles:name/moles:familyName))) 1541 else 1542 string($DataCreatorRoleHolder/moles:abbreviation) 1543 }, 1544 element Dataset_Title {string($DE/moles:name)} 1545 }, 1546 for $StructuredKeyword in ($DE//(moles:dgStructuredKeyword | moles:dgStdParameterMeasured)[(voclib:spot-vocab($voclib:gcmd_science_valids, moles:dgValidTermID/moles:ParentListID) or voclib:spot-vocab($voclib:gcmd_science_valids_correct, moles:dgValidTermID/moles:ParentListID) or voclib:spot-vocab($voclib:gcmd_science_valids_categories, moles:dgValidTermID/moles:ParentListID))] 1547 ) 1548 return if (exists($StructuredKeyword/*/moles:dgValidTerm)) then 1549 element Parameters { 1550 element Category {string($StructuredKeyword/*/moles:dgValidTerm)}, 1551 if (exists($StructuredKeyword//moles:dgValidSubterm) 1552 and $StructuredKeyword//moles:dgValidSubterm != '' 1553 and $StructuredKeyword//moles:dgValidSubterm != ' ') then 1554 for $Subterm in $StructuredKeyword//moles:dgValidSubterm[exists(moles:dgValidTerm)] 1555 where exists($Subterm/moles:dgValidSubterm) 1556 order by $Subterm/moles:ListLevel 1557 return 1558 if ($Subterm/moles:ListLevel=1) then element Topic {string($Subterm/moles:dgValidSubterm/moles:dgValidTerm)} 1559 else if ($Subterm/moles:ListLevel=2) then element Term {string($Subterm/moles:dgValidSubterm/moles:dgValidTerm)} 1560 else if ($Subterm/moles:ListLevel=3) then element Variable {string($Subterm/moles:dgValidSubterm/moles:dgValidTerm)} 1561 else if ($Subterm/moles:ListLevel=4) then element Detailed_Variable {string($Subterm/moles:dgValidSubterm/moles:dgValidTerm)} 1562 else element GCMD_Science_Valid {string($Subterm/moles:dgValidSubterm/moles:dgValidTerm)} 1563 else() 1564 } 1565 else(), 1566 for $StructuredKeyword in ($DE//(moles:dgStructuredKeyword | moles:dgDataEntity/moles:dgDataSummary/moles:dgParameterSummary/moles:dgStdParameterMeasured)[voclib:spot-vocab($voclib:gcmd_science_valids, moles:dgValidTermID/moles:ParentListID) or voclib:spot-vocab($voclib:gcmd_science_valids_correct, moles:dgValidTermID/moles:ParentListID) or voclib:spot-vocab($voclib:gcmd_science_valids_deprecated, moles:dgValidTermID/moles:ParentListID) and (not(exists(moles:ListLevel)) or moles:ListLevel=0)]) 1567 return 1568 element Parameters {data($StructuredKeyword/moles:dgValidTerm)}, 1569 for $ISOTopicCategory in ($DE/moles:dgStructuredKeyword[voclib:spot-vocab($voclib:iso_topic_list, moles:dgValidTermID/moles:ParentListID)]) 1570 return 1571 element ISO_Topic_Category {string($ISOTopicCategory/moles:dgValidTerm)}, 1572 for $Keyword in distinct-values($DE//moles:dgStructuredKeyword[ 1573 not (voclib:spot-vocab($voclib:iso_topic_list, moles:dgValidTermID/moles:ParentListID) 1574 or voclib:spot-vocab($voclib:gcmd_science_valids, moles:dgValidTermID/moles:ParentListID) 1575 or voclib:spot-vocab($voclib:gcmd_science_valids_correct, moles:dgValidTermID/moles:ParentListID) 1576 )]/moles:dgValidTerm) 1577 return element Keyword {string($Keyword)}, 1578 for $DepDPT in ($DE/moles:dgDataEntity/moles:RelatedDeployment/moles:DataProductionToolID) 1579 return 1580 element Sensor_Name { 1581 for $DepDPTAbbrev in ((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:abbreviation)) 1582 return element Short_Name {data($DepDPTAbbrev)}, 1583 for $DepDPTName in ((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:name)) 1584 return element Long_Name {data($DepDPTName)} 1585 }, 1586 for $DepObsStn in ($DE/moles:dgDataEntity/moles:RelatedDeployment/moles:ObservationStationID) 1587 return 1588 element Source_Name { 1589 for $DepObsStnAbbrev in ((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:abbreviation)) 1590 return element Short_Name {data($DepObsStnAbbrev)}, 1591 for $DepObsStnName in ((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:name)) 1592 return element Long_Name {data($DepObsStnName)} 1593 }, 1594 for $TemporalRange in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:dgDateRange) 1595 return 1596 element Temporal_Coverage 1597 { 1598 element Start_Date {data($TemporalRange/moles:DateRangeStart)}, 1599 element End_Date {data($TemporalRange/moles:DateRangeEnd)} 1600 }, 1601 for $TemporalTerm in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:dgArea[voclib:spot-vocab($voclib:gcmd_chronostratigraphic_valids, moles:dgValidTermID/moles:ParentListID)]/moles:dgValidTerm) 1602 return element Paleo_Temporal_Coverage {element Chronostratigraphic_Unit {data($TemporalTerm)}}, 1603 for $Data_Set_Progress in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataStatus/moles:dgDatasetClosure) 1604 return element Data_Set_Progress {data($Data_Set_Progress)}, 1605 for $BoundingBox in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:BoundingBox) 1606 return 1607 element Spatial_Coverage { 1608 element Southernmost_Latitude {data($BoundingBox/moles:LimitSouth)}, 1609 element Northernmost_Latitude {data($BoundingBox/moles:LimitNorth)}, 1610 element Westernmost_Longitude {data($BoundingBox/moles:LimitWest)}, 1611 element Easternmost_Longitude {data($BoundingBox/moles:LimitEast)} 1612 }, 1613 for $Location in ($DE/moles:dgDataEntity/moles:dgDataSummary/moles:dgDataCoverage//moles:dgArea[voclib:spot-vocab($voclib:gcmd_location_valids, moles:dgValidTermID/moles:ParentListID)]) 1614 return element Location {data($Location/moles:dgValidTerm)}, 1615 for $DepAct in ($DE/moles:dgDataEntity/moles:RelatedDeployment/moles:ActivityID) 1616 return 1617 element Project { 1618 for $DepActAbbrev in (collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepAct/moles:repositoryIdentifier and moles:localIdentifier=$DepAct/moles:localIdentifier]]/moles:abbreviation) 1619 return 1620 element Short_Name {data($DepActAbbrev)}, 1621 for $DepActName in (collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepAct/moles:repositoryIdentifier and moles:localIdentifier=$DepAct/moles:localIdentifier]]/moles:name) 1622 return 1623 element Long_Name {data($DepActName)} 1624 }, 1625 if (exists($DE/moles:dgDataEntity/moles:dgDataGranule/moles:accessControlPolicy)) then 1626 for $DG in $DE/moles:dgDataEntity/moles:dgDataGranule 1627 return 1628 element Access_Constraints { 1629 if (exists($DG/moles:dgGranuleSummary/moles:dgGranuleName)) then 1630 concat('For data granule ', $DG/moles:dgGranuleSummary/moles:dgGranuleName, ': ') 1631 else (), 1632 if (exists($DG/moles:accessControlPolicy/moles:accessControlPolicyURL)) then 1633 concat('See access control policy at ', escape-uri($DG/moles:accessControlPolicy/moles:accessControlPolicyURL, true())) 1634 else if (exists($DG/moles:accessControlPolicy/moles:accessControlPolicyText)) then 1635 data($DG/moles:accessControlPolicy/moles:accessControlPolicyText) 1636 else 1637 for $securityCondition in $DG/moles:accessControlPolicy/moles:dgSecurityCondition 1638 return 1639 if (exists($securityCondition/moles:conditionExplanationText)) then 1640 concat('Effect: ', data($securityCondition/moles:effect), ' - ', data($securityCondition/moles:conditionExplanationText)) 1641 else concat('Effect: ', data($securityCondition/moles:effect), 'needs ', data($securityCondition/moles:attauthRole), ' from ', data($securityCondition/moles:dgAttributeAuthority)) 1642 } 1643 else (), 1644 if (exists($DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCreator/moles:dgRoleHolder)) then 1645 for $DataCreatorRole in $DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCreator/moles:dgRoleHolder 1646 order by $DataCreatorRole/moles:startDate empty least 1647 return 1648 for $DataCreatorRoleHolder in collection($targetCollection)/moles:dgMetadata/(moles:dgOrganisation | moles:dgPerson) 1649 [(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 1650 and moles:dgMetadataID/moles:repositoryIdentifier=$DataCreatorRole/*/moles:repositoryIdentifier 1651 and moles:dgMetadataID/moles:localIdentifier=$DataCreatorRole/*/moles:localIdentifier)] 1652 return 1653 element Originating_Center { 1654 if (string(local-name($DataCreatorRoleHolder))='dgOrganisation') then 1655 (string($DataCreatorRoleHolder/moles:name)) 1656 else if (string(local-name($DataCreatorRoleHolder))='dgPerson') then 1657 (string(concat(string($DataCreatorRoleHolder/moles:name/moles:initials), ' ', string($DataCreatorRoleHolder/moles:name/moles:familyName)))) 1658 else ('empty content') 1659 } 1660 else (), 1661 for $DataCuratorRole in $DE/moles:dgDataEntity/moles:dgDataRoles/moles:dgDataCurator/moles:dgRoleHolder 1662 [not(exists(moles:endDate)) or moles:endDate=''] 1663 return 1664 for $DataCuratorRoleHolder in collection($targetCollection)/moles:dgMetadata/(moles:dgOrganisation | moles:dgPerson) 1665 [(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 1666 and moles:dgMetadataID/moles:repositoryIdentifier=$DataCuratorRole/*/moles:repositoryIdentifier 1667 and moles:dgMetadataID/moles:localIdentifier=$DataCuratorRole/*/moles:localIdentifier)] 1668 return 1669 element Data_Center { 1670 element Data_Center_Name { 1671 element Short_Name { 1672 if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 1673 string(concat(string($DataCuratorRoleHolder/moles:name/moles:initials), ' ', string($DataCuratorRoleHolder/moles:name/moles:familyName))) 1674 else 1675 string($DataCuratorRoleHolder/moles:abbreviation) 1676 }, 1677 element Long_Name { 1678 if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 1679 string(concat(string($DataCuratorRoleHolder/moles:name/moles:initials), ' ', string($DataCuratorRoleHolder/moles:name/moles:familyName))) 1680 else string($DataCuratorRoleHolder/moles:name) 1681 } 1682 }, 1683 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:URI)) then 1684 element Data_Center_URL {data($DataCuratorRoleHolder/moles:contactDetails/moles:URI)} 1685 else (), 1686 for $DGID in $DE/moles:dgDataEntity/moles:dgDataGranule/moles:dataModelID 1687 return 1688 element Data_Set_ID {concat($DGID/moles:repositoryIdentifier, $utillib:moles_id_separator, $DGID/moles:schemeIdentifier, $utillib:moles_id_separator, $DGID/moles:localIdentifier)}, 1689 element Personnel { 1690 element Role {'Data Center Contact'}, 1691 if (exists($DataCuratorRoleHolder/name/knownAs)) then 1692 element First_Name {string($DataCuratorRoleHolder/moles:name/moles:knownAs)} 1693 else if (exists($DataCuratorRoleHolder/moles:name/moles:initials)) then 1694 element First_Name {string($DataCuratorRoleHolder/moles:name/moles:initials)} 1695 else (), 1696 element Last_Name { 1697 if (exists($DataCuratorRoleHolder/moles:name/moles:familyName)) then 1698 string($DataCuratorRoleHolder/moles:name/moles:familyName) 1699 else string($DataCuratorRoleHolder/moles:name) 1700 }, 1701 if (exists($DataCuratorRole/moles:contactDetails/moles:eMail)) then 1702 element Email {string($DataCuratorRole/moles:contactDetails/moles:eMail)} 1703 else 1704 if (exists($DataCuratorRoleHolder/contactDetails/eMail)) then 1705 (element Email {string($DataCuratorRoleHolder/moles:contactDetails/moles:eMail)}) 1706 else (), 1707 if (exists($DataCuratorRole/moles:contactDetails/moles:telephone)) then 1708 element Phone {string($DataCuratorRole/moles:contactDetails/moles:telephone)} 1709 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:telephone)) then 1710 element Phone {string($DataCuratorRoleHolder/moles:contactDetails/moles:telephone)} 1711 else (), 1712 if (exists($DataCuratorRole/moles:contactDetails/moles:fax)) then 1713 element Fax {string($DataCuratorRole/moles:contactDetails/moles:fax)} 1714 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:fax)) then 1715 element Fax {string($DataCuratorRoleHolder/moles:contactDetails/moles:fax)} 1716 else (), 1717 if (exists($DataCuratorRole/moles:contactDetails/moles:address)) then 1718 element Contact_Address { 1719 for $addressline in $DataCuratorRole/moles:contactDetails/moles:address/moles:addressline 1720 return element Address {data($addressline)}, 1721 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:city)) then 1722 element City {string($DataCuratorRole/moles:contactDetails/moles:address/moles:city)} 1723 else (), 1724 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:postcode)) then 1725 element Postal_Code {string($DataCuratorRole/moles:contactDetails/moles:address/moles:postcode)} 1726 else (), 1727 if (exists($DataCuratorRole/moles:contactDetails/moles:address/moles:country)) then 1728 element Country {string($DataCuratorRole/moles:contactDetails/moles:address/moles:country)} 1729 else () 1730 } 1731 else if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address)) then 1732 element Contact_Address { 1733 for $addressline in $DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:addressline 1734 return element Address {data($addressline)}, 1735 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:city)) then 1736 element City {string($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:city)} 1737 else (), 1738 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:postcode)) then 1739 element Postal_Code {string($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:postcode)} 1740 else (), 1741 if (exists($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:country)) then 1742 element Country {string($DataCuratorRoleHolder/moles:contactDetails/moles:address/moles:country)} 1743 else () 1744 } 1745 else () 1746 } 1747 }, 1748 element Summary {string($DE/moles:dgMetadataDescription/moles:abstract/moles:abstractText)}, 1749 for $DG in $DE/moles:dgDataEntity/moles:dgDataGranule 1750 return 1751 if ($DG/moles:dataModelID/moles:schemeIdentifier='NDG-A0') then 1752 (element Related_URL { 1753 element URL_Content_Type {'NDG_A_SERVICE'}, 1754 if (exists($DG/instance/URI)) then 1755 element URL {escape-uri($DG/instance/URI, true())} 1756 else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 1757 element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&datasetID=', true())} 1758 else ($DG/moles:dataModelID/moles:repositoryIdentifier), 1759 element Description {'The NDG service delivering data via NDG A metadata.'} 1760 }, 1761 element Related_URL { 1762 element URL_Content_Type {'GET DATA > CSML'}, 1763 if (exists($DG/instance)) then 1764 element URL {escape-uri($DG/instance/URI, true())} 1765 else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 1766 element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&datasetID=', true())} 1767 else (), 1768 element Description {'The NDG service delivering data via NDG A metadata. Additional tag to be more in line with latest version of GCMD valids'} 1769 }) 1770 else if ($DG/moles:dataModelID/moles:schemeIdentifier='CDML-0') then 1771 (element Related_URL { 1772 element URL_Content_Type {'NDG_A_SERVICE'}, 1773 if (exists($DG/instance)) then 1774 element URL {escape-uri($DG/instance/URI, true())} 1775 else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 1776 element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())} 1777 else (), 1778 element Description {'The NDG service delivering data via Data extractor. Additional tag to be more in line with latest version of GCMD valids'} 1779 }, 1780 element Related_URL { 1781 element URL_Content_Type {'GET DATA > DX'}, 1782 if (exists($DG/instance)) then 1783 element URL {escape-uri($DG/instance/URI, true())} 1784 else if ($DG/moles:dataModelID/moles:repositoryIdentifier='badc.nerc.ac.uk') then 1785 element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())} 1786 else (), 1787 element Description {'The NDG service delivering data via Data extractor. Additional tag to be more in line with latest version of GCMD valids'} 1788 }) 1789 else if ($DG/moles:dataModelID/moles:schemeIdentifier='URI') then 1790 element Related_URL { 1791 element URL {data($DG/moles:instance/moles:URI)}, 1792 if (exists($DG/moles:instance/moles:instanceComment)) then 1793 element Description {data($DG/moles:instance/moles:instanceComment)} 1794 else 1795 element Description {'URL to aid in delivering data. Note that this may point directly to the data or, more likely, point to the web site of the curator.'} 1796 } 1797 else (), 1798 for $RelURL_Desc in ($DE/moles:dgMetadataDescription/moles:descriptionSection/moles:descriptionOnlineReference) 1799 return 1800 if (exists($RelURL_Desc/moles:dgSimpleLink)) then 1801 element Related_URL { 1802 element URL {data($RelURL_Desc/moles:dgSimpleLink/URI)}, 1803 element Description {concat(data($RelURL_Desc/dgSimpleLink/moles:name), ' - ', data($RelURL_Desc/dgSimpleLink/moles:notes))} 1804 } 1805 else (), 1806 element Metadata_Name {'[CEOS IDN DIF]'}, 1807 element Metadata_Version {'9.4'}, 1808 if (exists($DE/moles:dgMetadataProvenance/moles:RecordCreation)) then 1809 element DIF_Creation_Date {data($DE/moles:dgMetadataProvenance/moles:RecordCreation/moles:CreatedDate)} 1810 else (), 1811 for $MDUpdt in $DE/moles:dgMetadataProvenance/moles:RecordUpdate 1812 return 1813 element DIF_Revision_History {concat(data($MDUpdt/moles:UpdateDate), ' - ', data($MDUpdt/moles:UpdateSummary), ' - ', data($MDUpdt/moles:UpdatedBy))}, 1814 if (exists($DE/moles:dgMetadataProvenance/moles:RecordReview)) then 1815 element Future_DIF_Review_Date {data($DE/moles:dgMetadataProvenance/moles:RecordReview/moles:ReviewDate)} 1816 else () 1817 }''' 1818 1818 1819 1819 DublinCoreDEQuery='''import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery';
Note: See TracChangeset
for help on using the changeset viewer.