Changeset 1806 for TI07-MOLES/trunk


Ignore:
Timestamp:
04/12/06 16:31:51 (13 years ago)
Author:
ko23
Message:

Correct ID error

Location:
TI07-MOLES/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/DIF/XQuery/DIF2MOLES.xquery

    r1800 r1806  
    77declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance';  
    88declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
    9 declare variable $input_collection as xs:string {'/db/discovery'}; 
     9declare variable $input_collection as xs:string {'TargetCollection'}; 
    1010declare variable $unknown_vocab_id as xs:string {'http://vocab.ndg.nerc.ac.uk/null'}; 
    1111declare variable $ndg_data_provider_vocab as xs:string {'http://vocab.ndg.nerc.ac.uk/N010'}; 
     
    1616declare variable $iso_topic_list as xs:string {'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_TopicCategoryCode'}; 
    1717declare variable $input_repository as xs:string {'Input_Repository_Code'}; 
    18 declare variable $input_repository_local as xs:string {'Input_Repository_Code_LocalID'}; 
     18declare variable $input_repository_local as xs:string {'Input_Repository_LocalID'}; 
     19declare variable $input_entry_id as xs:string {'Input_Entry_ID'}; 
    1920 
    20 for $DIF in collection($input_collection)/dif:DIF[dif:Entry_ID='NOCSDAT100'] 
     21for $DIF in collection($input_collection)/dif:DIF[dif:Entry_ID=$input_entry_id] 
    2122return 
    2223element dgMetadata { 
     
    5051                                                                element dgValidTerm {'dummy'}, 
    5152                                                                element dgValidTermID { 
    52                                                                         element ParentListID {'http://vocabs.ndg.nerc.ac.uk/null.'}, 
     53                                                                        element ParentListID {$unknown_vocab_id}, 
    5354                                                                        element TermID {escape-uri('dummy unit', true())} 
    5455                                                                } 
     
    5960                                                element dgValidTerm {'dummy'}, 
    6061                                                element dgValidTermID { 
    61                                                         element ParentListID {'http://vocabs.ndg.nerc.ac.uk/null.'}, 
     62                                                        element ParentListID {$gcmd_science_valids}, 
    6263                                                        element TermID {escape-uri('dummy term', true())} 
    6364                                                } 
     
    7374                                                                return 
    7475                                                                        element BoundingBox { 
    75                                                                                 element Limit_North {string($boundingbox/dif:Northernmost_Latitude)}, 
    76                                                                                 element Limit_South {string($boundingbox/dif:Southernmost_Latitude)}, 
    77                                                                                 element Limit_West {string($boundingbox/dif:Westernmost_Longitude)}, 
    78                                                                                 element Limit_East {string($boundingbox/dif:Easternmost_Longitude)} 
     76                                                                                element LimitNorth {string($boundingbox/dif:Northernmost_Latitude)}, 
     77                                                                                element LimitSouth {string($boundingbox/dif:Southernmost_Latitude)}, 
     78                                                                                element LimitWest {string($boundingbox/dif:Westernmost_Longitude)}, 
     79                                                                                element LimitEast {string($boundingbox/dif:Easternmost_Longitude)} 
    7980                                                                        } 
    8081                                                        } 
  • TI07-MOLES/trunk/JavaCode/BuildMOLES/ndg/services/buildmoles/Main.java

    r1800 r1806  
    2727public class Main { 
    2828        // Class constants 
    29         static boolean debug = false; 
     29        static boolean debug = true; 
    3030        static boolean trace = false; 
    3131        static boolean no_output = false; 
     
    323323                                                } 
    324324                                        else if (inputType.equals("DIF")) { 
    325                                                 repositoryID = DEListInstanceXML.getDocumentElement().getElementsByTagName("repositoryID").item(0).getFirstChild().getNodeValue(); 
    326  
    327                                                 xquery = "declare default element namespace 'http://ndg.nerc.ac.uk/moles';declare namespace dif='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/';declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance'; declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions';declare variable $input_collection as xs:string {'/db/discovery'};declare variable $unknown_vocab_id as xs:string {'http://vocab.ndg.nerc.ac.uk/null'};declare variable $ndg_data_provider_vocab as xs:string {'http://vocab.ndg.nerc.ac.uk/N010'};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 $gcmd_iso_topic_list as xs:string {'http://gcmd.gsfc.nasa.gov/Resources/valids/iso_topic_list.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'};declare variable $input_repository as xs:string {'Input_Repository_Code'};declare variable $input_repository_local as xs:string {'Input_Repository_Code_LocalID'};for $DIF in collection($input_collection)/dif:DIF[dif:Entry_ID='Input_Entry_ID'] return element dgMetadata {element dgMetadataRecord {element dgMetadataID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {string($DIF/dif:Entry_ID)}},element dgMetadataDescription {element metadataDescriptionID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {concat('generated_desc-', string($DIF/dif:Entry_ID))}},element metadataDescriptionLastUpdated {current-date()},element abstract {element abstractText {string($DIF/dif:Summary)}}},element name {string($DIF/dif:Entry_Title)},element abbreviation {string($DIF/dif:Entry_Title)},element dgDataEntity {element dgDataSetType {''},element dgDataSummary {element dgParameterSummary {element dgParameterValue {element dgValueDataParameter {element Value {''},element dgStandardUnit {element dgValidTerm {'dummy'},element dgValidTermID {element ParentListID {'http://vocabs.ndg.nerc.ac.uk/null.'},element TermID {escape-uri('dummy unit', true())}}}}},element dgStdParameterMeasured {element dgValidTerm {'dummy'},element dgValidTermID {element ParentListID {'http://vocabs.ndg.nerc.ac.uk/null.'},element TermID {escape-uri('dummy term', true())}}},element ParameterName {'dummy term'},element ParameterAbbreviation {'dummy term'}},if (exists($DIF/(dif:Spatial_Coverage)) or exists($DIF/dif:Temporal_Coverage)) then element dgDataCoverage {if (exists($DIF/dif:Spatial_Coverage/dif:Northernmost_Latitude)) then element dgSpatialCoverage {for $boundingbox in $DIF/dif:Spatial_Coverage[exists(dif:Northernmost_Latitude)] return element BoundingBox {element Limit_North {string($boundingbox/dif:Northernmost_Latitude)},element Limit_South {string($boundingbox/dif:Southernmost_Latitude)},element Limit_West {string($boundingbox/dif:Westernmost_Longitude)},element Limit_East {string($boundingbox/dif:Easternmost_Longitude)}}} else (),if (exists($DIF/dif:Temporal_Coverage/dif:Start_Date)) then element dgTemporalCoverage {for $temporalcoverage in $DIF/dif:Temporal_Coverage[exists(dif:Start_Date) and exists(dif:Stop_Date)] return element DateRange {element DateRangeStart {string($temporalcoverage/dif:Start_Date)},element DateRangeEnd {string($temporalcoverage/dif:Stop_Date)}}} else ()} else ()},element dgDataRoles {if (exists($DIF/(dif:Data_Set_Citation/dif:Dataset_Creator | dif:Originating_Center))) then element dgDataCreator {element dgMetadataID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {concat('generated_creator-', string($DIF/dif:Entry_ID))}},element roleName {'Data Creator'},element abbreviation {'Creator'},for $creatorID in $DIF/(dif:Data_Set_Citation/dif:Dataset_Creator | dif:Originating_Center) return element dgRoleHolder {element dgOrganisationID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier  {escape-uri(concat('generated_orgcit-', string($creatorID)), true())}},element startDate {current-date()}}} else (),element dgDataCurator {element dgMetadataID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {concat('generated_curator-', string($DIF/dif:Entry_ID))}},element roleName {'Data Curator'},element abbreviation {'Curator'},element dgRoleHolder {element dgOrganisationID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {$input_repository_local}},element startDate {current-date()}}}}},element dgStructuredKeyword {element dgValidTerm {'MDIP'},element dgValidTermID {element ParentListID {$ndg_data_provider_vocab},element TermID {'NDGO0001'}}},for $structuredKeywords in $DIF/dif:Keywords return  element dgStructuredKeyword {element dgValidTerm {$structuredKeywords},element dgValidTermID {element ParentListID {$unknown_vocab_id},element TermID {escape-uri($structuredKeywords, true())}}},for $structuredKeywords in $DIF/dif:ISO_Topic_Category return  element dgStructuredKeyword {element dgValidTerm {string($structuredKeywords)},element dgValidTermID {element ParentListID {$gcmd_iso_topic_list},element TermID {escape-uri($structuredKeywords, true())}}},if (exists($DIF/dif:DIF_Creation_Date) or exists($DIF/dif:Last_DIF_Revision_Date)) then  element dgMetadataProvenance {if (exists($DIF/dif:DIF_Creation_Date)) then element RecordCreation {element CreatedDate {if (string($DIF/dif:DIF_Creation_Date) castable as xs:date) then  string($DIF/dif:DIF_Creation_Date) cast as xs:date else (current-date())},element CreatedBy {$input_repository}} else element RecordCreation {element CreatedDate {current-date()},element CreatedBy {'MOLES Import'}},if (exists($DIF/dif:Last_DIF_Revision_Date)) then element RecordUpdate {element UpdateDate {if (string($DIF/dif:Last_DIF_Revision_Date) castable as xs:date) then  string($DIF/dif:Last_DIF_Revision_Date) cast as xs:date else (current-date())},element UpdatedBy {$input_repository}} else ()} else ()},for $creator in distinct-values($DIF/(dif:Data_Set_Citation/dif:Dataset_Creator | dif:Originating_Center)) return element dgOrganisation {element dgMetadataID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {escape-uri(concat('generated_orgcit-', string($creator)), true())}},element name {string($creator)},element abbreviation {string($creator)},element contactDetails {''}}}"; 
     325                                                localID = DEListInstanceXML.getDocumentElement().getElementsByTagName("repositoryID").item(0).getFirstChild().getNodeValue(); 
     326 
     327                                                xquery = "declare default element namespace 'http://ndg.nerc.ac.uk/moles';declare namespace dif='http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/';declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance'; declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions';declare variable $input_collection as xs:string {'TargetCollection'};declare variable $unknown_vocab_id as xs:string {'http://vocab.ndg.nerc.ac.uk/null'};declare variable $ndg_data_provider_vocab as xs:string {'http://vocab.ndg.nerc.ac.uk/N010'};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 $gcmd_iso_topic_list as xs:string {'http://gcmd.gsfc.nasa.gov/Resources/valids/iso_topic_list.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'};declare variable $input_repository as xs:string {'Input_Repository_Code'};declare variable $input_repository_local as xs:string {'Input_Repository_LocalID'};declare variable $input_entry_id as xs:string {'Input_Entry_ID'};for $DIF in collection($input_collection)/dif:DIF[dif:Entry_ID=$input_entry_id] return element dgMetadata {element dgMetadataRecord {element dgMetadataID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {string($DIF/dif:Entry_ID)}},element dgMetadataDescription {element metadataDescriptionID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {concat('generated_desc-', string($DIF/dif:Entry_ID))}},element metadataDescriptionLastUpdated {current-date()},element abstract {element abstractText {string($DIF/dif:Summary)}}},element name {string($DIF/dif:Entry_Title)},element abbreviation {string($DIF/dif:Entry_Title)},element dgDataEntity {element dgDataSetType {''},element dgDataSummary {element dgParameterSummary {element dgParameterValue {element dgValueDataParameter {element Value {''},element dgStandardUnit {element dgValidTerm {'dummy'},element dgValidTermID {element ParentListID {$unknown_vocab_id},element TermID {escape-uri('dummy unit', true())}}}}},element dgStdParameterMeasured {element dgValidTerm {'dummy'},element dgValidTermID {element ParentListID {$gcmd_science_valids},element TermID {escape-uri('dummy term', true())}}},element ParameterName {'dummy term'},element ParameterAbbreviation {'dummy term'}},if (exists($DIF/(dif:Spatial_Coverage)) or exists($DIF/dif:Temporal_Coverage)) then element dgDataCoverage {if (exists($DIF/dif:Spatial_Coverage/dif:Northernmost_Latitude)) then element dgSpatialCoverage {for $boundingbox in $DIF/dif:Spatial_Coverage[exists(dif:Northernmost_Latitude)] return element BoundingBox {element LimitNorth {string($boundingbox/dif:Northernmost_Latitude)},element LimitSouth {string($boundingbox/dif:Southernmost_Latitude)},element LimitWest {string($boundingbox/dif:Westernmost_Longitude)},element LimitEast {string($boundingbox/dif:Easternmost_Longitude)}}} else (),if (exists($DIF/dif:Temporal_Coverage/dif:Start_Date)) then element dgTemporalCoverage {for $temporalcoverage in $DIF/dif:Temporal_Coverage[exists(dif:Start_Date) and exists(dif:Stop_Date)] return element DateRange {element DateRangeStart {string($temporalcoverage/dif:Start_Date)},element DateRangeEnd {string($temporalcoverage/dif:Stop_Date)}}} else ()} else ()},element dgDataRoles {if (exists($DIF/(dif:Data_Set_Citation/dif:Dataset_Creator | dif:Originating_Center))) then element dgDataCreator {element dgMetadataID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {concat('generated_creator-', string($DIF/dif:Entry_ID))}},element roleName {'Data Creator'},element abbreviation {'Creator'},for $creatorID in $DIF/(dif:Data_Set_Citation/dif:Dataset_Creator | dif:Originating_Center) return element dgRoleHolder {element dgOrganisationID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier  {escape-uri(concat('generated_orgcit-', string($creatorID)), true())}},element startDate {current-date()}}} else (),element dgDataCurator {element dgMetadataID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {concat('generated_curator-', string($DIF/dif:Entry_ID))}},element roleName {'Data Curator'},element abbreviation {'Curator'},element dgRoleHolder {element dgOrganisationID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {$input_repository_local}},element startDate {current-date()}}}}},element dgStructuredKeyword {element dgValidTerm {'MDIP'},element dgValidTermID {element ParentListID {$ndg_data_provider_vocab},element TermID {'NDGO0001'}}},for $structuredKeywords in $DIF/dif:Keywords return element dgStructuredKeyword {element dgValidTerm {$structuredKeywords},element dgValidTermID {element ParentListID {$unknown_vocab_id},element TermID {escape-uri($structuredKeywords, true())}}},for $structuredKeywords in $DIF/dif:ISO_Topic_Category return  element dgStructuredKeyword {element dgValidTerm {string($structuredKeywords)},element dgValidTermID {element ParentListID {$gcmd_iso_topic_list},element TermID {escape-uri($structuredKeywords, true())}}},if (exists($DIF/dif:DIF_Creation_Date) or exists($DIF/dif:Last_DIF_Revision_Date)) then  element dgMetadataProvenance {if (exists($DIF/dif:DIF_Creation_Date)) then element RecordCreation {element CreatedDate {if (string($DIF/dif:DIF_Creation_Date) castable as xs:date) then  string($DIF/dif:DIF_Creation_Date) cast as xs:date else (current-date())},element CreatedBy {$input_repository}} else element RecordCreation {element CreatedDate {current-date()},element CreatedBy {'MOLES Import'}},if (exists($DIF/dif:Last_DIF_Revision_Date)) then element RecordUpdate {element UpdateDate {if (string($DIF/dif:Last_DIF_Revision_Date) castable as xs:date) then  string($DIF/dif:Last_DIF_Revision_Date) cast as xs:date else (current-date())},element UpdatedBy {$input_repository}} else ()} else ()},for $creator in distinct-values($DIF/(dif:Data_Set_Citation/dif:Dataset_Creator | dif:Originating_Center)) return element dgOrganisation {element dgMetadataID {element schemeIdentifier {'NDG-B0'},element repositoryIdentifier {$input_repository},element localIdentifier {escape-uri(concat('generated_orgcit-', string($creator)), true())}},element name {string($creator)},element abbreviation {string($creator)},element contactDetails {''}}}"; 
    328328                                                xquery = xquery.replaceFirst("Input_Repository_Code", repositoryID); 
    329                                                 xquery = xquery.replaceFirst("Input_Repository_Code_Local", repositoryLocalID); 
    330                                                 xquery = xquery.replaceFirst("Input_Entry_ID", repositoryID); 
     329                                                xquery = xquery.replaceFirst("Input_Repository_LocalID", repositoryLocalID); 
     330                                                xquery = xquery.replaceFirst("Input_Entry_ID", localID); 
    331331                                                xquery = xquery.replaceAll("TargetCollection", targetCollection);                                                        
    332332                                                } 
Note: See TracChangeset for help on using the changeset viewer.