def setUp(self):
     mods_doc = etree.XML(mods_oral_history_fixure)
     redis_mods = mods.mods()
     redis_mods.load_xml(mods_doc)
     self.series_work = frbr.Work(redis_server=redis_server,
                                  **{'titleOfTheWork':redis_mods.relatedItems[0].titleInfos[0]})
     self.work = frbr.Work(redis_server=redis_server,
                           **{'containedInWork':self.series_work,
                              'creators':redis_mods.names[0],
                              'formOfWork':redis_mods.typeOfResources[0],
                              'titleOfTheWork':redis_mods.titleInfos[0],
                              'subjects':redis_mods.subjects})
     expression_params = {
         'abstractOfExpression':redis_mods.abstracts[0],
         'dateOfCaptureExpression':redis_mods.originInfos[0].dateCaptured,
         'dateOfExpression':redis_mods.originInfos[0].dateCreated,
         'languageOfExpression':redis_mods.languages[0]}
     self.expression = frbr.Expression(redis_server=redis_server,
                                       **expression_params)
     manifestation_params = {
         'electronicReproductionManifestation':redis_mods.physicalDescriptions[0].digitalOrigin,
         'noteOnChangesInCarrierCharacteristicsManifestation':redis_mods.notes[1],
         'placeOfProductionManifestation':redis_mods.originInfos[0].places[0],
         'publishersNameManifestation':redis_mods.originInfos[0].publishers[0],
         'titleProperOfSeriesManifestation':redis_mods.relatedItems[0].titleInfos[0],
         'uniformResourceLocatorManifestation':redis_mods.locations[0].urls[0]}
     
     self.manifestation = frbr.Manifestation(redis_server=redis_server,
                                             **manifestation_params)
    def setUp(self):
        mods_doc = etree.XML(mods_book_fixure)
        self.mods = mods.mods()
        self.mods.load_xml(mods_doc)
        author_params = {
            'Name': self.mods.names[0]}
        author = frbr.Person(redis_server=redis_server,
                             **author_params)
        work_params = {
            'creators':author,
            'formOfWork':self.mods.typeOfResources[0],
            'subjects':self.mods.subjects,
            'titleOfTheWork':self.mods.titleInfos[0]}
            
            
        self.work = frbr.Work(redis_server=redis_server,
                              **work_params)
        expression_params = {
            'contentTypeExpression':self.mods.genres[0],
            'dateOfExpression':self.mods.originInfos[0].dateIssueds,
            'identifierForTheExpression':self.mods.classifications + self.mods.identifiers,
            'languageOfTheContentExpression':self.mods.languages[0].languageTerms[0]}
        
        self.expression = frbr.Expression(redis_server=redis_server,
                                          **expression_params)

        manifestation_params = {
            'modeOfIssuanceManifestation':self.mods.originInfos[0].issuance,
            'noteOnStatementOfResponsibilityManifestation':self.mods.notes[0],
            'placeOfPublicationManifestation':self.mods.originInfos[0].places,
            'publishersNameManifestation':self.mods.originInfos[0].publishers[0]}
        self.manifestation = frbr.Manifestation(redis_server=redis_server,
                                                **manifestation_params)
 def setUp(self):
     mods_doc = etree.XML(raw_thesis_xml)
     self.mods = mods.mods()
     self.mods.load_xml(mods_doc)
     self.maxDiff = None
     self.thesis_note1 = self.mods.notes[0]
     self.thesis_note2 = self.mods.notes[1]
     self.thesis_note3 = self.mods.notes[2]
     self.bibliography = self.mods.notes[3]
     self.dataset_abstract = self.mods.notes[4]
     self.dataset_info = self.mods.notes[5]
def ingest_xml_record_into_redis(step,xml_type):
    """
    Function ingests an XML document into Redis datastore

    :param xml_type: type of XML
    """
    if xml_type == 'MODS':
        world.mods = mods.mods()
        world.mods.load_xml(world.mods_doc)
    else:
        assert False
    def setUp(self):
        mods_doc = etree.XML(mods_music_fixure)
        self.mods = mods.mods()
        self.mods.load_xml(mods_doc)
        constituent_work_one = frbr.Work(redis_server=redis_server,
                                         **{'titleOfTheWork':self.mods.relatedItems[1].titleInfos[0],
                                            'creators':self.mods.relatedItems[1].names[0]})
        constituent_work_two = frbr.Work(redis_server=redis_server,
                                         **{'creators':self.mods.relatedItems[2].names[0],
                                            'titleOfTheWork':self.mods.relatedItems[2].titleInfos[0]})
        constituent_work_three = frbr.Work(redis_server=redis_server,
                                           **{'creators':self.mods.relatedItems[3].names[0],
                                              'titleOfTheWork':self.mods.relatedItems[3].titleInfos[0]})
        constituent_work_four = frbr.Work(redis_server=redis_server,
                                          **{'titleOfTheWork':self.mods.relatedItems[4].titleInfos[0]})
        constituent_work_five = frbr.Work(redis_server=redis_server,
                                          **{'titleOfTheWork':self.mods.relatedItems[5].titleInfos[0]})        
        work_params = {
            'creators':self.mods.names[0],
            'containsWork':[constituent_work_one,
                            constituent_work_two,
                            constituent_work_three,
                            constituent_work_four,
                            constituent_work_five],
            'formOfWork':self.mods.typeOfResources[0],
            'subjects':self.mods.subjects,
            'titleOfTheWork':self.mods.titleInfos[0]}
        self.work = frbr.Work(redis_server=redis_server,
                              **work_params)
        
        expression_params = {
            'dateOfExpression':self.mods.originInfos[0].dateIssueds,
            'formatOfNotatedMusicExpression':self.mods.physicalDescriptions[0].forms[0],
            'identifierForTheExpression':self.mods.classifications,
            'languageOfTheContentExpression':self.mods.languages[1],
            'languageOfExpression':self.mods.languages[0].languageTerms[0]}

        self.expression = frbr.Expression(redis_server=redis_server,
                                          **expression_params)
        manifestation_params = {
            'extentManifestation':self.mods.physicalDescriptions[0].extents[0],
            'modeOfIssuanceManifestation':self.mods.originInfos[0].issuance,
            'noteManifestation':self.mods.notes[1:],
            'noteOnStatementOfResponsibilityManifestation':self.mods.notes[0],
            'parallelOtherTitleInformationOfSeriesManifestation':self.mods.relatedItems[0].titleInfos[0],
            'placeOfProductionManifestation':self.mods.originInfos[0].places,
            'publishersNameManifestation':self.mods.originInfos[0].publishers[0]}
        self.manifestation = frbr.Manifestation(redis_server=redis_server,
                                                **manifestation_params)
 def setUp(self):
     mods_doc = etree.XML(mods_ejournal_fixure)
     self.mods = mods.mods()
     self.mods.load_xml(mods_doc)
     first_author_params = {
         'family':self.mods.names[0].nameParts[0].value_of,
         'given':self.mods.names[0].nameParts[1].value_of}
     first_author = frbr.Person(redis_server=redis_server,
                                **first_author_params)
     second_author_params = {
         'family':self.mods.names[1].nameParts[0].value_of,
         'given':self.mods.names[1].nameParts[1].value_of}
     second_author = frbr.Person(redis_server=redis_server,
                                 **second_author_params)
     series_work_params = {
         'titleOfTheWork':self.mods.relatedItems[0].titleInfos[0]}
     self.series_work = frbr.Work(redis_server=redis_server,
                                  **series_work_params)
     work_params = {
         'creators':[first_author,second_author],
         'formOfWork':self.mods.typeOfResources[0],
         'titleOfTheWork':self.mods.titleInfos[0],
         'inSeriesWork':self.series_work}
     self.work = frbr.Work(redis_server=redis_server,
                           **work_params)
     expression_params = {
         
         }
     self.expression = frbr.Expression(redis_server=redis_server,
                                       **expression_params)
     manifestation_params = {
         'dateOfPublicationManifestation':self.mods.relatedItems[0].parts[0].dates[0],
         'extentManifestation':self.mods.relatedItems[0].parts[0].extents[0],
         'identifierForTheManifestation':self.mods.identifiers,
         'modeOfIssuanceManifestation':self.mods.relatedItems[0].originInfos[0].issuance,
         'numberingWithinSeriesManifestation':self.mods.relatedItems[0].parts[0].details,
         }
     self.manifestation = frbr.Manifestation(redis_server=redis_server,
                                             **manifestation_params)
     item_params = {
         }
     self.item = frbr.Item(redis_server=redis_server,
                           **item_params)
    def setUp(self):
        mods_doc = etree.XML(mods_motionpicture_fixure)
        self.mods = mods.mods()
        self.mods.load_xml(mods_doc)
        corporate_body_params = {
            'Name':self.mods.names[0]}
        corporate_body = frbr.CorporateBody(redis_server=redis_server,
                                            **corporate_body_params)
        work_params = {
            'abstract':self.mods.abstracts[0],
            'creators':corporate_body,
            'formOfWork':self.mods.typeOfResources[0],
            'intendedAudienceWork':self.mods.targetAudiences[0],
            'titleOfTheWork':self.mods.titleInfos[0],
            'subjects':self.mods.subjects}
        self.work = frbr.Work(redis_server=redis_server,
                              **work_params)
        expression_params = {
            'contentTypeExpression':self.mods.genres[0],
            'dateOfExpression':self.mods.originInfos[0].dateIssueds[0],
            'languageOfTheContentExpression':self.mods.languages[0].languageTerms[0]}
        self.expression = frbr.Expression(redis_server=redis_server,
                                          **expression_params)

        manifestation_params = {
            'modeOfIssuanceManifestation':self.mods.originInfos[0].issuance,
            'noteManifestation':self.mods.notes[2],
            'noteOnChangesInCarrierCharacteristicsManifestation':self.mods.notes[3],
            'noteOnStatementOfResponsibilityManifestation':self.mods.notes[0],
            'noteOnTitleManifestation':self.mods.notes[1],
            'placeOfProductionManifestation':self.mods.originInfos[0].places,
            'publishersNameManifestation':self.mods.originInfos[0].publishers[0]}
        self.manifestation = frbr.Manifestation(redis_server=redis_server,
                                                **manifestation_params)
        item_params = {
            'extentItem':self.mods.physicalDescriptions[0].extents[0]}
        self.item = frbr.Item(redis_server=redis_server,
                              **item_params)
unit_test_info_re = re.compile(r"Ran (\d+) tests in (\d+.\d+)")
project = Project()
setattr(project,'name','FRBR-Redis-Datastore')
setattr(project,'url','https://github.com/jermnelson/FRBR-Redis-Datastore')

#! RUN CHECK TO SEE IF LOG directory exists, otherwise create

# LOAD LOC MODS collection
loc_mods = {}
for filename in ['modsbook.xml',
                 'modsmusic.xml']:
    file_object = open('fixures/%s' % filename,'rb')
    file_contents = file_object.read()
    file_object.close()
    new_mods = mods.mods()
    new_doc = etree.XML(file_contents)
    new_mods.load_xml(new_doc)
    work = frbr.Work(redis_server=code4lib_redis,
                     **{'titleOfTheWork':new_mods.titleInfos[0]})
    expression = frbr.Expression(redis_server=code4lib_redis,
                                 **{'dateOfExpression':new_mods.originInfos[0].dateIssueds,
                                    'realizationOf':work})
    manifestation = frbr.Manifestation(redis_server=code4lib_redis,
                                       **{'publishersNameManifestation':new_mods.originInfos[0].publishers[0],
                                          'embodimentOf':expression})
    item = frbr.Item(redis_server=code4lib_redis,
                     **{'examplarOf':manifestation})
    loc_mods[filename] = {'mods':new_mods,
                          'mods_xml':new_doc,
                          'work':work,