Changeset 7719 for ndgCommon


Ignore:
Timestamp:
10/11/10 15:01:03 (9 years ago)
Author:
sdonegan
Message:

bug fix for bodc records with personnel and role elements missing!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/xmldb/xquery/dif2stubISO.xq

    r7718 r7719  
    4949 
    5050(: BAS Test DIF  
    51 declare variable $targetCollection as xs:string := 'BAS_00002.xml'; 
     51declare variable $targetCollection as xs:string := 'BAS_00312.xml'; 
    5252declare variable $input_repository as xs:string := 'bas.nerc.ac.uk'; 
    5353declare variable $input_repository_local as xs:string := 'bas.nerc.ac.uk'; 
    54 declare variable $input_entry_id as xs:string := 'GB-NERC-BAS-AEDC-00002'; 
    55 declare variable $output_local_id as xs:string := 'GB-NERC-BAS-AEDC-00002_DIF'; :) 
     54declare variable $input_entry_id as xs:string := 'GB-NERC-BAS-AEDC-00312'; 
     55declare variable $output_local_id as xs:string := 'GB-NERC-BAS-AEDC-00312_DIF'; :) 
    5656  
    5757 
     
    7070declare variable $input_repository_local as xs:string := 'repository_localid'; 
    7171declare variable $input_entry_id as xs:string := 'Input_Entry_ID'; 
    72 declare variable $output_local_id as xs:string := 'LocalID'; 
     72declare variable $output_local_id as xs:string := 'LocalID';  
    7373 
    7474declare variable $thisDateTime as xs:string := substring(current-dateTime() cast as xs:string,1,19); 
     
    106106     
    107107       (:BODC & BGS records - find "technical contact" - this is their "pointOfContact" :) 
    108        if ($DIF/dif:Personnel/dif:Role[.='Technical Contact']) then 
     108      if (exists($DIF/dif:Personnel)) then 
     109        
     110       if ($DIF/dif:Personnel/dif:Role[.='Technical Contact'] or $DIF/dif:Personnel/dif:Role[.='Archive Coordinator']) then 
    109111            
    110112           (:fudge to get DC name - if email in personnel matches that of email in data_center_personnel then take the data_center name :) 
     
    143145                   $DIF/dif:Personnel[1]/dif:Email) 
    144146                    
    145         else(), 
     147       
     148        else (), 
     149         
     150         
     151            (:isolib:pointOfContact ($DIF/dif:Data_Center/dif:Data_Center_Name/dif:Short_Name, 
     152                   concat($DIF/dif:Data_Center/dif:Personnel[1]/dif:First_Name," ",$DIF/dif:Data_Center/dif:Personnel[1]/dif:Last_Name), string(''),  
     153                   string('pointOfContact'), 
     154                   $DIF/dif:Data_Center/dif:Personnel[1]/dif:Phone,  
     155                   $DIF/dif:Data_Center/dif:Personnel[1]/dif:Contact_Address,  
     156                   $DIF/dif:Data_Center/dif:Personnel[1]/dif:Contact_Address/dif:City, 
     157                   $DIF/dif:Data_Center/dif:Personnel[1]/dif:Contact_Address/dif:Postal_Code,  
     158                   $DIF/dif:Data_Center/dif:Personnel[1]/dif:Email), :) 
    146159       
    147160      (:BAS Specialism now - find personnel/role = Data Center Contact.. :) 
     
    157170        else() 
    158171        
    159       }, (: /contact :) 
    160  
     172        (: there is no dif/personnel element - in which case pull it from the dif/data_center element for now - this should catch bodc records with no personnel or data contact role :) 
     173        (:else:) 
     174        else  
     175             isolib:pointOfContact ($DIF/dif:Data_Center/dif:Data_Center_Name/dif:Short_Name, 
     176                   concat($DIF/dif:Data_Center/dif:Personnel[1]/dif:First_Name," ",$DIF/dif:Data_Center/dif:Personnel[1]/dif:Last_Name), string(''),  
     177                   string('pointOfContact'), 
     178                   $DIF/dif:Data_Center/dif:Personnel[1]/dif:Phone,  
     179                   $DIF/dif:Data_Center/dif:Personnel[1]/dif:Contact_Address,  
     180                   $DIF/dif:Data_Center/dif:Personnel[1]/dif:Contact_Address/dif:City, 
     181                   $DIF/dif:Data_Center/dif:Personnel[1]/dif:Contact_Address/dif:Postal_Code,  
     182                   $DIF/dif:Data_Center/dif:Personnel[1]/dif:Email) 
     183        
     184       }, (: /contact :) 
     185       
    161186      (: 
    162187      NOTE: this is the datestamp of the dif=>iso conversion 
Note: See TracChangeset for help on using the changeset viewer.