Ignore:
Timestamp:
03/10/06 11:37:28 (14 years ago)
Author:
ko23
Message:

Corrected and extended DIF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/JavaCode/bulkdestubbxmldb/ndg/services/bulkdestubb/Main.java

    r1534 r1547  
    4444        static String RawDEMoles = "for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgDataEntity!='' and dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier='RepositoryID' and localIdentifier='LocalID']] return $DE"; 
    4545        static String DublinCoreDEQuery = "declare namespace dc='http://purl.org/dc/elements/1.1/'; declare namespace oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc'; declare variable $gcmd_science_valids as xs:string {'http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html'}; declare variable $gcmd_project_valids as xs:string {'http://gcmd.gsfc.nasa.gov/Resources/valids/projects.html'}; declare variable $cf_standard_names as xs:string {'http://www.cgd.ucar.edu/cms/eaton/cf-metadata/standard_name.html'}; declare variable $iso_topic_list as xs:string {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopicCategoryCode'}; for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgDataEntity!='' and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <oai_dc:dc xmlns:oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc/' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'> { element dc:title {string($DE/name)}, element dc:type {'Dataset'}, element dc:identifier {concat($DE/dgMetadataID/repositoryIdentifier, ':DC:', $DE/dgMetadataID/localIdentifier)}, element dc:description {string($DE/dgMetadataDescription/abstract/abstractText)}, element dc:date { if (exists($DE/(dgMetadataProvenance | DataProvenance)/RecordUpdate/UpdateDate)) then for $updatedate in $DE/(dgMetadataProvenance | DataProvenance)/RecordUpdate/UpdateDate order by xs:date($updatedate) descending return xs:date($updatedate[1]) else string($DE/(dgMetadataProvenance | DataProvenance)/RecordCreation/CreatedDate) }, for $StructuredKeyword in distinct-values($DE/dgStructuredKeyword [dgValidTermID/ParentListID=$cf_standard_names or dgValidTermID/ParentListID=$gcmd_science_valids or dgValidTermID/ParentListID=$gcmd_project_valids or dgValidTermID/ParentListID=$iso_topic_list ]//dgValidTerm ) order by $StructuredKeyword return element dc:subject {string($StructuredKeyword)}, for $StructuredKeyword1 in distinct-values($DE/dgDataEntity/dgDataSummary/dgParameterSummary/dgStdParameterMeasured[dgValidTermID/ParentListID=$cf_standard_names or dgValidTermID/ParentListID=$gcmd_science_valids or dgValidTermID/ParentListID=$gcmd_project_valids]//dgValidTerm) order by $StructuredKeyword1 return element dc:subject {string($StructuredKeyword1)}, for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder order by $DataCreatorRole/startDate empty least, $DataCreatorRole/endDate empty least return for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/(dgOrganisation | dgPerson)[((not(exists($DataCreatorRole/endDate)) or empty($DataCreatorRole/endDate)) and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return element dc:creator { if (string(local-name($DataCreatorRoleHolder))='dgOrganisation') then (string($DataCreatorRoleHolder/name)) else if (string(local-name($DataCreatorRoleHolder))='dgPerson') then (string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName)))) else ('empty content') }, for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return element dc:publisher { if (string(local-name($DataCuratorRoleHolder))='dgOrganisation') then (string($DataCuratorRoleHolder/name)) else if (string(local-name($DataCuratorRoleHolder))='dgPerson') then (string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName)))) else ('empty content') }}</oai_dc:dc>"; 
    46         static String DIFQuery = "for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <DIF xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/' xsi:schemaLocation='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/ http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/dif_v9.4.xsd'> <Entry_ID>{concat($DE/dgMetadataID/repositoryIdentifier, ':DIF:', $DE/dgMetadataID/localIdentifier)}</Entry_ID> <Entry_Title>{string($DE/name)}</Entry_Title> {for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return <Dataset_Citation> {element Data_Creator {if (exists($DataCreatorRoleHolder/name/initials)) then ( string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName))) ) else ( string($DataCreatorRoleHolder/abbreviation) )} } <Dataset_Title>{string($DE/name)}</Dataset_Title> </Dataset_Citation> } {for $StructuredKeyword in ($DE//(dgStructuredKeyword | dgStdParameterMeasured)[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and ListLevel = 0]) return if (exists($StructuredKeyword/*/dgValidTerm)) then ( <Parameters> {element Category {string($StructuredKeyword/*/dgValidTerm)}} {if (exists($StructuredKeyword//dgValidSubterm) and $StructuredKeyword//dgValidSubterm != '' and $StructuredKeyword//dgValidSubterm != ' ') then ( for $Subterm in $StructuredKeyword//dgValidSubterm[exists(dgValidTerm)] where exists($Subterm/dgValidSubterm) order by $Subterm/ListLevel return if ($Subterm/ListLevel=1) then (element Topic {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=2) then (element Term {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=3) then (element Variable {string($Subterm/dgValidSubterm/dgValidTerm)}) else ( if ($Subterm/ListLevel=4) then (element Detailed_Variable {string($Subterm/dgValidSubterm/dgValidTerm)}) else (element GCMD_Science_Valid {string($Subterm/dgValidSubterm/dgValidTerm)})))) ) else()} </Parameters> ) else() } {for $ISOTopicCategory in ($DE/dgStructuredKeyword[dgValidTermID/ParentListID='ISO 19115 Topic Category']) return element ISO_Topic_Category {string($ISOTopicCategory/dgValidTerm)} } {for $Keyword in distinct-values($DE//dgStructuredKeyword[ dgValidTermID/ParentListID!='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and dgValidTermID/ParentListID!='ISO 19115 Topic Category' ]/dgValidTerm) return element Keyword {string($Keyword)} } {for $DepDPT in ($DE/dgDataEntity/RelatedDeployment/DataProductionToolID) return <Sensor_Name> {for $DepDPTAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/abbreviation)) return element Short_Name {data($DepDPTAbbrev)}} {for $DepDPTName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/name)) return element Long_Name {data($DepDPTName)} } </Sensor_Name> } {for $DepObsStn in ($DE/dgDataEntity/RelatedDeployment/ObservationStationID) return <Source_Name> {for $DepObsStnAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/abbreviation)) return <Short_Name>{data($DepObsStnAbbrev)}</Short_Name>} {for $DepObsStnName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/name)) return <Long_Name>{data($DepObsStnName)}</Long_Name>} </Source_Name> } {for $TemporalRange in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgDateRange) return <Temporal_Coverage> {element Start_Date {data($TemporalRange/DateRangeStart)}} {element End_Date {data($TemporalRange/DateRangeEnd)}} </Temporal_Coverage> } {for $TemporalTerm in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea/dgValidTerm) return element Paleo_Temporal_Coverage { element Chronostratigraphic_Unit {data($TemporalTerm)} } } {for $Data_Set_Progress in ($DE/dgDataEntity/dgDataSummary/dgDataStatus/dgDatasetClosure) return element Data_Set_Progress {$Data_Set_Progress} } {for $BoundingBox in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/BoundingBox) return <Spatial_Coverage> {element Southernmost_Latitude {data($BoundingBox/LimitSouth)}} {element Northernmost_Latitude {data($BoundingBox/LimitNorth)}} {element Westernmost_Longitude {data($BoundingBox/LimitWest)}} {element Easternmost_Longitude {data($BoundingBox/LimitEast)}} </Spatial_Coverage> } {for $Location in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_locations.html']) return element Location {$Location} } {for $DepAct in ($DE/dgDataEntity/RelatedDeployment/ActivityID) return <Project> {for $DepActAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/abbreviation)) return <Short_Name>{data($DepActAbbrev)}</Short_Name>} {for $DepActName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/name)) return <Long_Name>{data($DepActName)}</Long_Name>} </Project> } {if (exists($DE/dgDataEntity/dgDataGranule/accessControlPolicy)) then ( element Access_Constraints {''} ) else () } {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return <Data_Center> <Data_Center_Name> {element Short_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) ) else ( string($DataCuratorRoleHolder/abbreviation) )} } {element Long_Name {if (exists($DataCuratorRoleHolder/name/initials)) then ( string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) ) else (string($DataCuratorRoleHolder/name))} } </Data_Center_Name> {if (exists($DataCuratorRoleHolder/contactDetails/URI)) then ( element Data_Center_URL {data($DataCuratorRoleHolder/contactDetails/URI)} ) else ()} {for $DGID in $DE/dgDataEntity/dgDataGranule/dataModelID return element Data_Set_ID {concat($DGID/repositoryIdentifier, ':', $DGID/schemeIdentifier, ':', $DGID/localIdentifier)} } <Personnel> {element Role {'Data Center Contact'}} {if (exists($DataCuratorRoleHolder/name/knownAs)) then ( element First_Name {string($DataCuratorRoleHolder/name/knownAs)} ) else if (exists($DataCuratorRoleHolder/name/initials)) then ( element First_Name {string($DataCuratorRoleHolder/name/initials)} ) else ()} {element Last_Name {if (exists($DataCuratorRoleHolder/name/familyName)) then ( string($DataCuratorRoleHolder/name/familyName) ) else (string($DataCuratorRoleHolder/name))} } {if (exists($DataCuratorRole/contactDetails/eMail)) then ( element Email {string($DataCuratorRole/contactDetails/eMail)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/eMail)) then ( element Email {string($DataCuratorRoleHolder/contactDetails/eMail)} ) else () )} {if (exists($DataCuratorRole/contactDetails/telephone)) then ( element Phone {string($DataCuratorRole/contactDetails/telephone)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/telephone)) then ( element Phone {string($DataCuratorRoleHolder/contactDetails/telephone)} ) else () )} {if (exists($DataCuratorRole/contactDetails/fax)) then ( element Fax {string($DataCuratorRole/contactDetails/fax)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/fax)) then ( element Fax {string($DataCuratorRoleHolder/contactDetails/fax)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/addressline)) then ( for $addressline in $DataCuratorRole/contactDetails/address/addressline return element address {$addressline} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/addressline)) then ( for $addressline in $DataCuratorRoleHolder/contactDetails/address/addressline return element address {$addressline} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/city)) then ( element City {string($DataCuratorRole/contactDetails/city)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/city)) then ( element Cityl {string($DataCuratorRoleHolder/contactDetails/city)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/postcode)) then ( element Postal_Code {string($DataCuratorRole/contactDetails/postcode)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( element email {string($DataCuratorRoleHolder/contactDetails/postcode)} ) else () )} {if (exists($DataCuratorRole/contactDetails/address/country)) then ( element Postal_Code {string($DataCuratorRole/contactDetails/country)} ) else ( if (exists($DataCuratorRoleHolder/contactDetails/postcode)) then ( element Postal_Code {string($DataCuratorRoleHolder/contactDetails/eMail)} ) else () )} </Personnel> </Data_Center> } <Summary>{string($DE/dgMetadataDescription/abstract/abstractText)}</Summary> <Related_URL> {element URL_Content_Type {'NDG_B_SERVICE'}} {element URL {data($DE/dgMetadataID/repositoryIdentifier)}} {element Description {'The NDG service for browsing metadata.'}} </Related_URL> {for $DG in $DE/dgDataEntity/dgDataGranule return if ($DG/dataModelID/schemeIdentifier='NDG-A0') then ( <Related_URL> {element URL_Content_Type {'NDG_A_SERVICE'}} {element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&amp;datasetID=', true())}} {element Description {'The NDG service delivering data via NDG A metadata.'}} </Related_URL> ) else if ($DG/dataModelID/schemeIdentifier='CSML-0') then ( <Related_URL> {element URL_Content_Type {'NDG_A_SERVICE'}} {element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())}} {element Description {'The NDG service delivering data via NDG A metadata.'}} </Related_URL> ) else if ($DG/dataModelID/schemeIdentifier='URI') then ( <Related_URL> {element URL {data($DG/instance/URI)}} {if (exists($DG/instance/instanceComment)) then ( element Description {data($DG/instance/instanceComment)} ) else ( 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 curators.'} ) } </Related_URL> ) else () } <Metadata_Name>[CEOS IDN DIF]</Metadata_Name> {element Metadata_Version {'9.4'}} {if (exists($DE/dgMetadataProvenance/RecordCreation)) then ( element DIF_Creation_Date {data($DE/dgMetadataProvenance/RecordCreation/CreatedDate)} ) else () } {for $MDUpdt in $DE/dgMetadataProvenance/RecordUpdate return element DIF_Revision_History {concat(data($MDUpdt/UpdateDate), ' - ', data($MDUpdt/UpdateSummary), ' - ', data($MDUpdt/UpdatedBy))} } {if (exists($DE/dgMetadataProvenance/RecordReview)) then ( element Future_DIF_Review_Date {data($DE/dgMetadataProvenance/RecordReview/ReviewDate)} ) else () } </DIF>"; 
     46        static String DIFQuery = "for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <DIF xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/' xsi:schemaLocation='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/ http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/dif_v9.4.xsd'> { element Entry_ID {concat($DE/dgMetadataID/repositoryIdentifier, ':DIF:', $DE/dgMetadataID/localIdentifier)}, element Entry_Title {string($DE/name)}, element Data_Set_Citation { for $DataCreatorRole in $DE/dgDataEntity/dgDataRoles/dgDataCreator/dgRoleHolder[not(exists(endDate)) or endDate=''][1] return  for $DataCreatorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCreatorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCreatorRole/*/localIdentifier)] return  element Data_Creator  { if (exists($DataCreatorRoleHolder/name/initials)) then  (string(concat(string($DataCreatorRoleHolder/name/initials), ' ', string($DataCreatorRoleHolder/name/familyName)))) else  (string($DataCreatorRoleHolder/abbreviation)) }, element Dataset_Title {string($DE/name)} }, for $StructuredKeyword in ($DE//(dgStructuredKeyword | dgStdParameterMeasured)[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html' and ListLevel = 0]) return if (exists($StructuredKeyword/*/dgValidTerm)) then ( element Parameters { element Category {string($StructuredKeyword/*/dgValidTerm)}, if (exists($StructuredKeyword//dgValidSubterm)  and $StructuredKeyword//dgValidSubterm != ''  and $StructuredKeyword//dgValidSubterm != ' ') then ( for $Subterm in $StructuredKeyword//dgValidSubterm[exists(dgValidTerm)] where exists($Subterm/dgValidSubterm) order by $Subterm/ListLevel return  if ($Subterm/ListLevel=1) then (element Topic {string($Subterm/dgValidSubterm/dgValidTerm)})  else ( if ($Subterm/ListLevel=2) then (element Term {string($Subterm/dgValidSubterm/dgValidTerm)})  else ( if ($Subterm/ListLevel=3) then (element Variable {string($Subterm/dgValidSubterm/dgValidTerm)})  else ( if ($Subterm/ListLevel=4) then (element Detailed_Variable {string($Subterm/dgValidSubterm/dgValidTerm)})  else (element GCMD_Science_Valid {string($Subterm/dgValidSubterm/dgValidTerm)})))) ) else() } ) else(), for $ISOTopicCategory in ($DE/dgStructuredKeyword[dgValidTermID/ParentListID='http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopicCategoryCode']) return  element ISO_Topic_Category {string($ISOTopicCategory/dgValidTerm)}, for $Keyword in distinct-values($DE//dgStructuredKeyword[ dgValidTermID/ParentListID!='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_parameters.html'  and  dgValidTermID/ParentListID!='http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopicCategoryCode'  ]/dgValidTerm) return element Keyword {string($Keyword)},  for $DepDPT in ($DE/dgDataEntity/RelatedDeployment/DataProductionToolID)  return  element Sensor_Name { for $DepDPTAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/abbreviation)) return element Short_Name {data($DepDPTAbbrev)}, for $DepDPTName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepDPT/repositoryIdentifier and localIdentifier=$DepDPT/localIdentifier]]/name)) return element Long_Name {data($DepDPTName)} }, for $DepObsStn in ($DE/dgDataEntity/RelatedDeployment/ObservationStationID) return  element Source_Name { for $DepObsStnAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/abbreviation)) return element Short_Name {data($DepObsStnAbbrev)}, for $DepObsStnName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepObsStn/repositoryIdentifier and localIdentifier=$DepObsStn/localIdentifier]]/name)) return element Long_Name {data($DepObsStnName)} }, for $TemporalRange in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgDateRange) return  element Temporal_Coverage { element Start_Date {data($TemporalRange/DateRangeStart)}, element End_Date {data($TemporalRange/DateRangeEnd)} }, for $TemporalTerm in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgTemporalCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea/dgValidTerm) return element Paleo_Temporal_Coverage  { element Chronostratigraphic_Unit {data($TemporalTerm)} },  for $Data_Set_Progress in ($DE/dgDataEntity/dgDataSummary/dgDataStatus/dgDatasetClosure) return element Data_Set_Progress {$Data_Set_Progress}, for $BoundingBox in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/BoundingBox) return  element Spatial_Coverage { element Southernmost_Latitude {data($BoundingBox/LimitSouth)}, element Northernmost_Latitude {data($BoundingBox/LimitNorth)}, element Westernmost_Longitude {data($BoundingBox/LimitWest)}, element Easternmost_Longitude {data($BoundingBox/LimitEast)} }, for $Location in ($DE/dgDataEntity/dgDataSummary/dgDataCoverage/(dgSpatialCoverage | dgSpatioTemporalcoverage/dgSpatioTemporalRange/dgSpatialCoverage)/dgArea[dgValidTermID/ParentListID='http://gcmd.gsfc.nasa.gov/Resources/valids/gcmd_locations.html']) return element Location {$Location},  for $DepAct in ($DE/dgDataEntity/RelatedDeployment/ActivityID) return  element Project { for $DepActAbbrev in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/abbreviation)) return  element Short_Name {data($DepActAbbrev)}, for $DepActName in distinct-values((collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[dgMetadataID[schemeIdentifier='NDG-B0' and repositoryIdentifier=$DepAct/repositoryIdentifier and localIdentifier=$DepAct/localIdentifier]]/name)) return  element Long_Name {data($DepActName)} }, if (exists($DE/dgDataEntity/dgDataGranule/accessControlPolicy)) then ( for $DG in $DE/dgDataEntity/dgDataGranule return  element Access_Constraints  { if (exists($DG/dgGranuleSummary/dgGranuleName)) then  concat('For data granule ', $DG/dgGranuleSummary/dgGranuleName, ': ') else (), if (exists($DG/accessControlPolicy/accessControlPolicyURL)) then concat('See access control policy at ', escape-uri($DG/accessControlPolicy/accessControlPolicyURL, true())) else if (exists($DG/accessControlPolicy/accessControlPolicyText)) then ( data($DG/accessControlPolicy/accessControlPolicyText) ) else ( for $securityCondition in $DG/accessControlPolicy/dgSecurityCondition return if (exists($securityCondition/conditionExplanationText)) then concat('Effect: ', data($securityCondition/effect), ' - ', data($securityCondition/conditionExplanationText)) else ( concat('Effect: ', data($securityCondition/effect), 'needs ', data($securityCondition/attauthRole), ' from ', data($securityCondition/dgAttributeAuthority)) ) ) } ) else (), for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[not(exists(endDate)) or endDate=''] return  for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return  element Data_Center { element Data_Center_Name { element Short_Name  { if (exists($DataCuratorRoleHolder/name/initials)) then ( string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName))) ) else  (string($DataCuratorRoleHolder/abbreviation)) }, element Long_Name  { if (exists($DataCuratorRoleHolder/name/initials)) then  (string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName)))) else (string($DataCuratorRoleHolder/name)) } }, if (exists($DataCuratorRoleHolder/contactDetails/URI)) then  ( element Data_Center_URL  {data($DataCuratorRoleHolder/contactDetails/URI)} ) else (), for $DGID in $DE/dgDataEntity/dgDataGranule/dataModelID return  element Data_Set_ID  { concat($DGID/repositoryIdentifier, ':', $DGID/schemeIdentifier, ':', $DGID/localIdentifier) }, element Personnel { element Role {'Data Center Contact'}, if (exists($DataCuratorRoleHolder/name/knownAs)) then  (element First_Name {string($DataCuratorRoleHolder/name/knownAs)}) else if (exists($DataCuratorRoleHolder/name/initials)) then  (element First_Name {string($DataCuratorRoleHolder/name/initials)}) else (), element Last_Name  { if (exists($DataCuratorRoleHolder/name/familyName)) then  (string($DataCuratorRoleHolder/name/familyName)) else (string($DataCuratorRoleHolder/name)) }, if (exists($DataCuratorRole/contactDetails/eMail)) then  (element Email {string($DataCuratorRole/contactDetails/eMail)}) else  (if (exists($DataCuratorRoleHolder/contactDetails/eMail)) then  (element Email {string($DataCuratorRoleHolder/contactDetails/eMail)}) else () ), if (exists($DataCuratorRole/contactDetails/telephone)) then  (element Phone {string($DataCuratorRole/contactDetails/telephone)}) else  (if (exists($DataCuratorRoleHolder/contactDetails/telephone)) then  (element Phone {string($DataCuratorRoleHolder/contactDetails/telephone)}) else () ), if (exists($DataCuratorRole/contactDetails/fax)) then  (element Fax {string($DataCuratorRole/contactDetails/fax)}) else  (if (exists($DataCuratorRoleHolder/contactDetails/fax)) then  (element Fax {string($DataCuratorRoleHolder/contactDetails/fax)}) else () ), if (exists($DataCuratorRole/contactDetails/address)) then  (element Contact_Address { for $addressline in $DataCuratorRole/contactDetails/address/addressline return element address {$addressline}, if (exists($DataCuratorRole/contactDetails/address/city)) then  (element City {string($DataCuratorRole/contactDetails/address/city)}) else (), if (exists($DataCuratorRole/contactDetails/address/postcode)) then  (element Postal_Code {string($DataCuratorRole/contactDetails/address/postcode)}) else (), if (exists($DataCuratorRole/contactDetails/address/country)) then  (element Country {string($DataCuratorRole/contactDetails/address/country)}) else () } ) else if (exists($DataCuratorRoleHolder/contactDetails/address)) then  (element Contact_Address  { for $addressline in $DataCuratorRole/contactDetails/address/addressline return element address {$addressline}, if (exists($DataCuratorRole/contactDetails/address/city)) then  (element City {string($DataCuratorRoleHolder/contactDetails/address/city)}) else (), if (exists($DataCuratorRoleHolder/contactDetails/address/postcode)) then  (element Postal_Code {string($DataCuratorRole/contactDetails/postcode)}) else (), if (exists($DataCuratorRoleHolder/contactDetails/address/country)) then  (element Country {string($DataCuratorRoleHolder/contactDetails/address/country)}) else () } ) else () } }, element Summary {string($DE/dgMetadataDescription/abstract/abstractText)}, element Related_URL  { element URL_Content_Type {'NDG_B_SERVICE'}, element URL {data($DE/dgMetadataID/repositoryIdentifier)}, element Description {'The NDG service for browsing metadata.'} }, for $DG in $DE/dgDataEntity/dgDataGranule return  if ($DG/dataModelID/schemeIdentifier='NDG-A0') then  ( element Related_URL  { element URL_Content_Type {'NDG_A_SERVICE'}, element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&amp;datasetID=', true())}, element Description {'The NDG service delivering data via NDG A metadata.'} }, element Related_URL  { element URL_Content_Type {'GET DATA > CSML'}, element URL {escape-uri('http://dmgdev1.esc.rl.ac.uk/cgi-bin/ndgDataAccess?datasetSource=dmgdev1.esc.rl.ac.uk&amp;datasetID=', true())}, element Description {'The NDG service delivering data via NDG A metadata. Additional tag to be more in line with latest version of GCMD valids'} } ) else if ($DG/dataModelID/schemeIdentifier='CDML-0') then  ( element Related_URL  { element URL_Content_Type {'NDG_A_SERVICE'}, element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())}, element Description {'The NDG service delivering data via Data extractor. Additional tag to be more in line with latest version of GCMD valids'} }, element Related_URL  { element URL_Content_Type {'GET DATA > DX'}, element URL {escape-uri('http://cdat.badc.nerc.ac.uk/cgi-bin/dxui.py?datasetURI_1=/', true())}, element Description {'The NDG service delivering data via Data extractor. Additional tag to be more in line with latest version of GCMD valids'} } ) else if ($DG/dataModelID/schemeIdentifier='URI') then  ( element Related_URL { element URL {data($DG/instance/URI)}, if (exists($DG/instance/instanceComment)) then  ( element Description {data($DG/instance/instanceComment)}  ) else  ( 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 curators.'} ) } ) else (), for $RelURL_Desc in ($DE/dgMetadataDescription/descriptionSection/descriptionOnlineReference)  return element Related_URL { element URL {data($RelURL_Desc)}, element Description {concat(data($RelURL_Desc/name), ' - ', data($RelURL_Desc/notes))}  },  element Metadata_Name {'[CEOS IDN DIF]'}, element Metadata_Version {'9.4'}, if (exists($DE/dgMetadataProvenance/RecordCreation)) then  ( element DIF_Creation_Date {data($DE/dgMetadataProvenance/RecordCreation/CreatedDate)} ) else (), for $MDUpdt in $DE/dgMetadataProvenance/RecordUpdate return  element DIF_Revision_History {concat(data($MDUpdt/UpdateDate), ' - ', data($MDUpdt/UpdateSummary), ' - ', data($MDUpdt/UpdatedBy))} , if (exists($DE/dgMetadataProvenance/RecordReview)) then ( element Future_DIF_Review_Date {data($DE/dgMetadataProvenance/RecordReview/ReviewDate)} ) else () } </DIF>"; 
    4747        static String ISO19139Query = "for $DE in collection('/db/ndg_B_metadata')/dgMetadata/dgMetadataRecord[exists('dgDataEntity') and dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier='RepositoryID' and dgMetadataID/localIdentifier='LocalID'] return <MD_Metadata xmlns='http://www.isotc211.org/2005/gmd' xmlns:gco='http://www.isotc211.org/2005/gco' xmlns:gmd='http://www.isotc211.org/2005/gmd' xmlns:gml='http://www.opengis.net/gml' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.isotc211.org/2005/gmd http://www.isotc211.org/2005/gmd/metadataEntity.xsd'> {element fileIdentifier {element gco:CharacterString {concat($DE/dgMetadataID/repositoryIdentifier, 'ISO 19115:2003(E):', $DE/dgMetadataID/localIdentifier)}}} {element language { element gmd:LanguageCode { attribute codeList {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#LanguageCode'}, attribute codeListValue {'eng'}, 'English'}}} {element hierarchyLevel { element MD_ScopeCode { attribute codeList {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode'}, attribute codeListValue {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode_dataset'}, 'dataset'}}} {for $parent in $DE/dgRelatedDataEntity[RelationID/dgValidTerm='is-part-of'] return element parentIdentifier {element gco:CharacterString {concat($DE/dgMetadataID/repositoryIdentifier, ':', $DE/dgMetadataID/localIdentifier, ':', $DE/dgMetadataID/localIdentifier)}}} {for $DataCuratorRole in $DE/dgDataEntity/dgDataRoles/dgDataCurator/dgRoleHolder[not(exists(endDate)) or endDate=''] return for $DataCuratorRoleHolder in collection('/db/ndg_B_metadata')/dgMetadata/*[(dgMetadataID/schemeIdentifier='NDG-B0' and dgMetadataID/repositoryIdentifier=$DataCuratorRole/*/repositoryIdentifier and dgMetadataID/localIdentifier=$DataCuratorRole/*/localIdentifier)] return <contact > { <CI_ResponsibleParty> { if (string(local-name($DataCuratorRoleHolder))='dgOrganisation') then element organisationName {element gco:CharacterString {string($DataCuratorRoleHolder/name)}} else if (string(local-name($DataCuratorRoleHolder))='dgPerson') then element individualName {element gco:CharacterString {string(concat(string($DataCuratorRoleHolder/name/initials), ' ', string($DataCuratorRoleHolder/name/familyName)))}} else ('empty content')} {element positionName { if (exists($DataCuratorRoleHolder/localName)) then element gco:CharacterString {$DataCuratorRoleHolder/localName} else if (exists($DataCuratorRole/roleName)) then element gco:CharacterString {$DataCuratorRole/roleName} else element gco:CharacterString {'Curator'}}} <contactInfo><gmd:CI_Contact> {if (exists($DataCuratorRole/contactDetails/telephone or $DataCuratorRole/contactDetails/fax or $DataCuratorRoleHolder/contactDetails/telephone or $DataCuratorRoleHolder/contactDetails/fax)) then <phone><gmd:CI_Telephone> {if (exists($DataCuratorRole/contactDetails/telephone)) then element voice { element gco:CharacterString {data($DataCuratorRole/contactDetails/telephone)}} else if (exists($DataCuratorRoleHolder/contactDetails/telephone)) then element voice { element gco:CharacterString {data($DataCuratorRoleHolder/contactDetails/telephone)}} else ()} {if (exists($DataCuratorRole/contactDetails/fax)) then element facsimile { element gco:CharacterString {data($DataCuratorRoleHolder/contactDetails/fax)}} else if (exists($DataCuratorRoleHolder/contactDetails/telephone)) then element facsimile { element gco:CharacterString {data($DataCuratorRoleHolder/contactDetails/fax)}} else ()} </gmd:CI_Telephone></phone> else ()} <address><gmd:CI_Address> {if (exists($DataCuratorRole/contactDetails/address/addressline)) then for $addressline in $DataCuratorRole/contactDetails/address/addressline return element deliveryPoint { element gco:CharacterString {data($addressline)}} else if (exists($DataCuratorRoleHolder/contactDetails/address/addressline)) then for $addressline in $DataCuratorRoleHolder/contactDetails/address/addressline return element deliveryPoint { element gco:CharacterString {data($addressline)}} else ()} {if (exists($DataCuratorRole/contactDetails/address/city)) then element city { element gco:CharacterString {data($DataCuratorRole/contactDetails/address/city)}} else if (exists($DataCuratorRoleHolder/contactDetails/address/city)) then element city { element gco:CharacterString {data($DataCuratorRoleHolder/contactDetails/address/city)}} else ()} {if (exists($DataCuratorRole/contactDetails/eMail)) then element electronicMailAddress { element gco:CharacterString {data($DataCuratorRole/contactDetails/eMail)}} else if (exists($DataCuratorRoleHolder/contactDetails/address/postcode)) then element electronicMailAddress { element gco:CharacterString {data($DataCuratorRoleHolder/contactDetails/eMail)}} else ()} </gmd:CI_Address></address></gmd:CI_Contact></contactInfo> {element role { element CI_RoleCode { attribute codeList {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode'}, attribute codeListValue {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_RoleCode_custodian'}, if (exists($DataCuratorRole/localName)) then data($DataCuratorRole/localName) else if (exists($DataCuratorRoleHolder/localName)) then data($DataCuratorRoleHolder/localName) else 'Curator'}}} </CI_ResponsibleParty>} </contact>} {element dateStamp { element gco:Date { adjust-date-to-timezone(current-date())}}} {element metadataStandardName {element gco:CharacterString {'ISO 19115:2005'}}} {element metadataStandardVersion {element gco:CharacterString {'2005'}}} <identificationInfo><gmd:MD_DataIdentification><citation><gmd:CI_Citation> {element title {element gco:CharacterString {data($DE/name)}}} {if (exists($DE/abbreviation) and not(empty($DE/abbreviation))) then element alternateTitle {element gco:CharacterString {data($DE/abbreviation)}} else ()} {element date { if (exists($DE/*/RecordCreation/CreatedDate)) then element gmd:CI_Date { element date { element gco:Date {adjust-date-to-timezone(data($DE/*/RecordCreation/CreatedDate))}}, element dateType { element CI_DateTypeCode { attribute codeList {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode'}, attribute codeListValue {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode_creation'}, 'Creation'}}} else attribute gco:nilReason {'unknown'}}} </gmd:CI_Citation></citation> {element abstract { element gco:CharacterString {data($DE/dgMetadataDescription/abstract/abstractText)}}} {element language { element gmd:LanguageCode { attribute codeList {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#LanguageCode'}, attribute codeListValue {'eng'}, 'English'}}} {for $ISOTopicCategory in ($DE/dgStructuredKeyword[dgValidTermID/ParentListID='http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopicCategoryCode']) return element topicCategory { element gmd:MD_TopicCategoryCode { attribute codeList {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopicCategoryCode'}, attribute codeListValue {string($ISOTopicCategory/dgValidTerm)}, 'English'}}} </gmd:MD_DataIdentification></identificationInfo></MD_Metadata>"; 
    4848 
Note: See TracChangeset for help on using the changeset viewer.