Changeset 4258 for TI01-discovery


Ignore:
Timestamp:
01/10/08 13:35:41 (11 years ago)
Author:
cbyrom
Message:

Extend idget function to cope with MDIP records and implement usage of this

  • to remove the need for the DIF and MDIP models - delete these from the codebase.
Location:
TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch
Files:
3 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/Utilities.py

    r4027 r4258  
    142142def idget(xml,dataType='DIF'): 
    143143    ''' Given an xml document (string), parse it using ElementTree and  
    144     find the identifier within it. Supports dataTypes of 'DIF' ... 
    145     (actually only DIF for now). 
     144    find the identifier within it. Supports dataTypes of 'DIF' and 'MDIP'... 
    146145    ''' 
    147146    et=loadET(xml) 
     
    149148    if dataType=='DIF': 
    150149        return helper.getText(et,'Entry_ID') 
     150    elif dataType == 'MDIP': 
     151        return helper.getText(self.tree,'DatasetIdentifier') 
    151152    else: 
    152153        raise TypeError,'idget does not support datatype [%s]'%dataType 
  • TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/oai_document_ingester.py

    r4257 r4258  
    99from time import strftime 
    1010from SchemaNameSpace import SchemaNameSpace 
    11 from DIF import DIF 
    12 from MDIP import MDIP 
    1311import ndgUtils 
    1412from ndgUtils.ndgXqueries import ndgXqueries 
     
    1614from PostgresRecord import PostgresRecord 
    1715from PostgresDAO import PostgresDAO 
     16from Utilities import idget 
    1817import db_funcs 
    1918 
     
    2625 
    2726        def getID(self, filename): 
    28                 '''  
    29                 Gets the identifier out of an input metadata xml record.  
    30                 Copes with DIF and MDIP currently. 
    31                 @param filename - name of document file being processed 
    32                 @return: ID - id to use to refer to the document 
    33                 ''' 
    34                 logging.info("Retrieving identifier for metadata record " + filename) 
    35                 xml=file(filename).read() 
    36                 if self._datacentre_format == "DIF": 
    37                     d=DIF(xml) 
    38                     ID=d.entryID 
    39                 elif self._datacentre_format == "MDIP": 
    40                     d=MDIP(xml) 
    41                     ID=d.id 
    42                 else: 
    43                     raise TypeError, "Only handles DIF or MDIP here." 
    44          
    45                 logging.info("Found identifier: " + ID) 
    46                 return ID 
     27                ''' 
     28                Gets the identifier out of an input metadata xml record.  
     29                @param filename - name of document file being processed 
     30                @return: ID - id to use to refer to the document 
     31                ''' 
     32                logging.info("Retrieving identifier for metadata record " + filename) 
     33                xml=file(filename).read() 
     34                ID = idget(xml) 
     35                return ID 
    4736         
    4837         
Note: See TracChangeset for help on using the changeset viewer.