name_space = u'macrepo'
    
    '''
    do ingest
    '''
    #put in the Italian topographical map object
    try:
        collection_label = u'15'
        collection_pid = unicode(name_space + ':' + collection_label)
        collection_policy = u'<collection_policy xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="" xsi:schemaLocation="http://www.islandora.ca http://syn.lib.umanitoba.ca/collection_policy.xsd"> <content_models> <content_model dsid="ISLANDORACM" name="Islandora Collection Model ~ islandora:collectionCModel" namespace="islandora:1" pid="islandora:collectionCModel"/> <content_model dsid="ISLANDORACM" name="Islandora large image content model" namespace="macrepo:1" pid="islandora:sp_large_image_cmodel"/> </content_models> <search_terms/> <staging_area/> <relationship>isMemberOfCollection</relationship> </collection_policy> '
        fedora.getObject(collection_pid)
    except FedoraConnectionException, object_fetch_exception:
        if object_fetch_exception.httpcode in [404]:
            logging.info(name_space + ':itm missing, creating object.\n')
            collection_object = fedora.createObject(collection_pid, label = collection_label)
            #collection_policy
            try:
                collection_object.addDataStream(u'COLLECTION_POLICY', collection_policy, label=u'COLLECTION_POLICY',
                mimeType=u'text/xml', controlGroup=u'X',
                logMessage=u'Added basic COLLECTION_POLICY data.')
                logging.info('Added COLLECTION_POLICY datastream to:' + collection_pid)
            except FedoraConnectionException:
                logging.error('Error in adding COLLECTION_POLICY datastream to:' + collection_pid + '\n')
            
            #add relationships
            collection_object_RELS_EXT = fedora_relationships.rels_ext(collection_object, fedora_model_namespace)
            collection_object_RELS_EXT.addRelationship('isMemberOfCollection','islandora:root')
            collection_object_RELS_EXT.addRelationship(fedora_relationships.rels_predicate('fedora-model','hasModel'),'islandora:collectionCModel')
            collection_object_RELS_EXT.update()
 #name_space = u'HamiltonCivilWar2'
 '''
 do ingest
 '''
 #put in the JapaneseSilentFilmCollection collection object
 try:
     collection_label = u'UnitedStatesCivilWarLetters'
     collection_pid = unicode(name_space + ':' + collection_label)
     collection_policy = u'<collection_policy xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="" xsi:schemaLocation="http://www.islandora.ca">  <content_models>    <content_model dsid="ISLANDORACM" name="Book Content Model" namespace="islandora:1" pid="islandora:bookCModel"></content_model>  </content_models>  <search_terms></search_terms>  <staging_area></staging_area>  <relationship>isMemberOf</relationship></collection_policy>'
     fedora.getObject(collection_pid)
 except FedoraConnectionException, object_fetch_exception:
     if object_fetch_exception.httpcode in [404]:
         logging.info(
             name_space +
             ':UnitedStatesCivilWarLetters missing, creating object.\n')
         collection_object = fedora.createObject(collection_pid,
                                                 label=collection_label)
         #collection_policy
         try:
             collection_object.addDataStream(
                 u'COLLECTION_POLICY',
                 collection_policy,
                 label=u'COLLECTION_POLICY',
                 mimeType=u'text/xml',
                 controlGroup=u'X',
                 logMessage=u'Added basic COLLECTION_POLICY data.')
             logging.info('Added COLLECTION_POLICY datastream to:' +
                          collection_pid)
         except FedoraConnectionException:
             logging.error(
                 'Error in adding COLLECTION_POLICY datastream to:' +
                 collection_pid + '\n')
Beispiel #3
0
    name_space = u'macrepo'

    '''
    do ingest
    '''
        #put in the JapaneseSilentFilmCollection collection object
    try:
        collection_label = u'5946'
        collection_pid = unicode(name_space + ':' + collection_label)
        collection_policy = u'<collection_policy xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="" xsi:schemaLocation="http://www.islandora.ca http://syn.lib.umanitoba.ca/collection_policy.xsd"> <content_models> <content_model dsid="ISLANDORACM" name="Islandora Collection Model ~ islandora:collectionCModel" namespace="islandora:1" pid="islandora:collectionCModel"/> <content_model dsid="ISLANDORACM" name=""Book Content Model" namespace="macrepo:1" pid="islandora:bookCModel"/> </content_models> <search_terms/> <staging_area/> <relationship>isMemberOfCollection</relationship> </collection_policy> '
        fedora.getObject(collection_pid)
    except FedoraConnectionException, object_fetch_exception:
        if object_fetch_exception.httpcode in [404]:
            logging.info(name_space + ':conversationReport missing, creating object.\n')
            collection_object = fedora.createObject(collection_pid, label = collection_label)
            #collection_policy
            try:
                collection_object.addDataStream(u'COLLECTION_POLICY', collection_policy, label=u'COLLECTION_POLICY',
                mimeType=u'text/xml', controlGroup=u'X',
                logMessage=u'Added basic COLLECTION_POLICY data.')
                logging.info('Added COLLECTION_POLICY datastream to:' + collection_pid)
            except FedoraConnectionException:
                logging.error('Error in adding COLLECTION_POLICY datastream to:' + collection_pid + '\n')

            #add relationships
            collection_object_RELS_EXT = fedora_relationships.rels_ext(collection_object, fedora_model_namespace)
            collection_object_RELS_EXT.addRelationship('isMemberOf','islandora:root')
            collection_object_RELS_EXT.addRelationship(fedora_relationships.rels_predicate('fedora-model','hasModel'),'islandora:collectionCModel')
            collection_object_RELS_EXT.update()
    '''
    #create a movie and benshi object because parent pids must be known
    mods_file_name = mods_file_names[0]

    #put in the JapaneseSilentFilmCollection collection object
    try:
        collection_label = u'JapaneseSilentFilmCollection'
        collection_pid = unicode(name_space + ':' + collection_label)
        collection_policy = u'<collection_policy xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="" xsi:schemaLocation="http://www.islandora.ca">  <content_models>    <content_model dsid="ISLANDORACM" name="BenshiMovieCModel" namespace="islandora:1" pid="islandora:benshiMovie"></content_model>  </content_models>  <search_terms></search_terms>  <staging_area></staging_area>  <relationship>isMemberOf</relationship></collection_policy>'
        fedora.getObject(collection_pid)
    except FedoraConnectionException, object_fetch_exception:
        if object_fetch_exception.httpcode in [404]:
            logging.info(
                name_space +
                ':JapaneseSilentFilmCollection missing, creating object.\n')
            collection_object = fedora.createObject(collection_pid,
                                                    label=collection_label)
            #collection_policy
            try:
                collection_object.addDataStream(
                    u'COLLECTION_POLICY',
                    collection_policy,
                    label=u'COLLECTION_POLICY',
                    mimeType=u'text/xml',
                    controlGroup=u'X',
                    logMessage=u'Added basic COLLECTION_POLICY data.')
                logging.info('Added COLLECTION_POLICY datastream to:' +
                             collection_pid)
            except FedoraConnectionException:
                logging.error(
                    'Error in adding COLLECTION_POLICY datastream to:' +
                    collection_pid + '\n')
    
    name_space = u'macrepo'
    
    '''
    do ingest
    '''
    #put in the WWIIJUR collection object
    try:
        collection_label = u'30'
        collection_pid = unicode(name_space + ':' + collection_label)
        collection_policy = u'<collection_policy xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="" xsi:schemaLocation="http://www.islandora.ca">  <content_models>    <content_model dsid="ISLANDORACM" name="object Content Model" namespace="islandora:1" pid="islandora:objectCModel"></content_model>  </content_models>  <search_terms></search_terms>  <staging_area></staging_area>  <relationship>isMemberOf</relationship></collection_policy>'
        fedora.getObject(collection_pid)
    except FedoraConnectionException, object_fetch_exception:
        if object_fetch_exception.httpcode in [404]:
            logging.info(name_space + ':WWIIJUR missing, creating object.\n')
            collection_object = fedora.createObject(collection_pid, label = collection_label)
            #collection_policy
            try:
                collection_object.addDataStream(u'COLLECTION_POLICY', collection_policy, label=u'COLLECTION_POLICY',
                mimeType=u'text/xml', controlGroup=u'X',
                logMessage=u'Added basic COLLECTION_POLICY data.')
                logging.info('Added COLLECTION_POLICY datastream to:' + collection_pid)
            except FedoraConnectionException:
                logging.error('Error in adding COLLECTION_POLICY datastream to:' + collection_pid + '\n')
            
            #add relationships
            collection_object_RELS_EXT = fedora_relationships.rels_ext(collection_object, fedora_model_namespace)
            collection_object_RELS_EXT.addRelationship('isMemberOf','islandora:root')
            collection_object_RELS_EXT.addRelationship(fedora_relationships.rels_predicate('fedora-model','hasModel'),'islandora:collectionCModel')
            collection_object_RELS_EXT.update()
 '''
 do ingest
 '''
 #create a movie and benshi object because parent pids must be known
 mods_file_name = mods_file_names[0]
 
 #put in the JapaneseSilentFilmCollection collection object
 try:
     collection_label = u'JapaneseSilentFilmCollection'
     collection_pid = unicode(name_space + ':' + collection_label)
     collection_policy = u'<collection_policy xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="" xsi:schemaLocation="http://www.islandora.ca">  <content_models>    <content_model dsid="ISLANDORACM" name="BenshiMovieCModel" namespace="islandora:1" pid="islandora:benshiMovie"></content_model>  </content_models>  <search_terms></search_terms>  <staging_area></staging_area>  <relationship>isMemberOf</relationship></collection_policy>'
     fedora.getObject(collection_pid)
 except FedoraConnectionException, object_fetch_exception:
     if object_fetch_exception.httpcode in [404]:
         logging.info(name_space + ':JapaneseSilentFilmCollection missing, creating object.\n')
         collection_object = fedora.createObject(collection_pid, label = collection_label)
         #collection_policy
         try:
             collection_object.addDataStream(u'COLLECTION_POLICY', collection_policy, label=u'COLLECTION_POLICY',
             mimeType=u'text/xml', controlGroup=u'X',
             logMessage=u'Added basic COLLECTION_POLICY data.')
             logging.info('Added COLLECTION_POLICY datastream to:' + collection_pid)
         except FedoraConnectionException:
             logging.error('Error in adding COLLECTION_POLICY datastream to:' + collection_pid + '\n')
         
         #add relationships
         collection_object_RELS_EXT=fedora_relationships.rels_ext(collection_object,fedora_model_namespace)
         collection_object_RELS_EXT.addRelationship('isMemberOf','islandora:root')
         collection_object_RELS_EXT.addRelationship(fedora_relationships.rels_predicate('fedora-model','hasModel'),'islandora:collectionCModel')
         collection_object_RELS_EXT.update()
 #put in the benshi Islandora:BenshiMovie content model