Changeset 4653 for exist


Ignore:
Timestamp:
16/12/08 10:17:11 (11 years ago)
Author:
sdonegan
Message:

Updated for consistency with other xquery transforms and adjusted so can provide decent MOLES which can then be turned into decent DIFs (previous mdip2moles couldnt!).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/xquery/mdip2moles.xq

    r3841 r4653  
    1 (: Version for one MDIP per dgMetadata instance :) 
     1(: Version for one MDIP per dgMetadata instance :) 
    22(: Note algoritm for creating non-pre-existing organisations :) 
    33(: dgPersons are not created as one can't tell automatically which are people and which are orgs, and orgs are simpler :)   
    44(: Not producing valid MOLES as still got to work out parameter vocabulary namespaces in the subject field :)   
    5 import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'xmldb:exist:///db/xqueryLib/Vocabs/vocab_xquery_lib.xquery'; 
    6 import module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'xmldb:exist:///db/xqueryLib/Utilities/inputParse_xquery_lib.xquery'; 
     5 
     6import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'vocab_xquery_lib.xquery'; 
     7import module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'inputParse_xquery_lib.xquery'; 
    78 
    89declare default element namespace 'http://ndg.nerc.ac.uk/moles'; 
     
    1112declare namespace gco='http://www.isotc211.org/2005/gco'; 
    1213 
    13 declare variable $input_collection as xs:string := 'TargetCollection'; 
    14 declare variable $input_repository as xs:string := 'Input_Repository_Code'; 
    15 declare variable $input_repository_local as xs:string := 'Input_Repository_LocalID'; 
     14declare variable collection($targetCollection) as xs:string := 'TargetCollection'; 
     15declare variable $input_repository as xs:string := 'RepositoryID'; 
     16declare variable $input_repository_local as xs:string := 'repository_localid'; 
    1617declare variable $input_DatasetIdentifier as xs:string := 'Input_Entry_ID'; 
    17 declare variable $output_local_id as xs:string := 'Output_LocalID'; 
    18  
    19 for $MDIP in collection($input_collection)/mdip:Metadata[mdip:DatasetIdentifier=$input_DatasetIdentifier] 
     18(:declare variable $input_DatasetIdentifier as xs:string := 'MRMLN00400000061';:) 
     19declare variable $output_local_id as xs:string := 'LocalID'; 
     20 
     21(:declare variable collection($targetCollection) := doc("AMRMLN00400000061.xml");:) 
     22 
     23for $MDIP in collection($targetCollection)/mdip:Metadata[mdip:DatasetIdentifier=$input_DatasetIdentifier] 
    2024return 
    2125element dgMetadata { 
     
    142146                                                element roleName {'Data Creator'}, 
    143147                                                element abbreviation {'Creator'}, 
    144                                                 for $creator in $MDIP/mdip:Data_Set_Citation/mdip:Dataset_Creator 
     148                                                for $creator in $MDIP/mdip:Originator 
    145149                                                return 
    146150                                                element dgRoleHolder { 
     
    258262                else () 
    259263        } (: </dgMetadataRecord>:), 
    260         for $creator in $MDIP/mdip:Originator 
     264        for $creator in $MDIP/mdip:Distributor 
    261265        return 
    262266                element dgOrganisation { 
     
    270274                                        element localIdentifier {encode-for-uri(concat('generated_orgcit-', string($creator/mdip:OriginatorName), '-', data($MDIP/mdip:DatasetIdentifier)))} 
    271275                        }, 
    272                         element name {data($creator/mdip:OriginatorName)}, 
    273                         element abbreviation {data($creator/mdip:OriginatorName)}, 
    274                         element contactDetails {''} 
     276                        element name {data($creator/mdip:DistributorName/mdip:DistributorNameName)}, 
     277                        element abbreviation {data($creator/mdip:DistributorName/mdip:DistributorNameCode)}, 
     278                        element contactDetails { 
     279                            element eMail {data($creator/mdip:Email)}, 
     280                            element URI {data($creator/../mdip:OnlineResource)}                  
     281                        } 
    275282                } 
    276283} 
Note: See TracChangeset for help on using the changeset viewer.