def populate_object_statements(data: dict, default_unit=None): hmo = get_crom_object(data) sales_record = get_crom_object(data.get('_record')) format = data.get('format') if format: formatstmt = vocab.PhysicalStatement(ident='', content=format) if sales_record: formatstmt.referred_to_by = sales_record hmo.referred_to_by = formatstmt materials = data.get('materials') if materials: matstmt = vocab.MaterialStatement(ident='', content=materials) if sales_record: matstmt.referred_to_by = sales_record hmo.referred_to_by = matstmt dimstr = data.get('dimensions') if dimstr: dimstmt = vocab.DimensionStatement(ident='', content=dimstr) if sales_record: dimstmt.referred_to_by = sales_record hmo.referred_to_by = dimstmt for dim in extract_physical_dimensions(dimstr, default_unit=default_unit): if sales_record: dim.referred_to_by = sales_record hmo.dimension = dim else: pass
def test_linguistic_object_boundary(self): vocab.add_linked_art_boundary_check() jrnl = vocab.JournalText(label="journal") issue = vocab.IssueText(label="issue") issue.part_of = jrnl issue.referred_to_by = vocab.MaterialStatement(content="Statement") js = factory.toJSON(issue) # Have not embedded journal in issue self.assertTrue(not 'classified_as' in js['part_of'][0]) # Have embedded statement in issue self.assertTrue('content' in js['referred_to_by'][0]) self.assertTrue('type' in js['referred_to_by'][0]['classified_as'][0]['classified_as'][0])
bts.begin_of_the_begin = js['artistBeginDate'] bts.end_of_the_end = js['artistBeginDate'] bts.identified_by = model.Name(value=js['artistBeginDate']) born.timespan = bts artist.born = born if js['artistEndDate']: death = model.Death() bts = model.TimeSpan() bts.begin_of_the_begin = js['artistEndDate'] bts.end_of_the_end = js['artistEndDate'] bts.identified_by = model.Name(value=js['artistBeginDate']) death.timespan = bts artist.died = death if js['medium']: artwork.referred_to_by = vocab.MaterialStatement(value=js['medium']) if js['dimensions']: artwork.referred_to_by = vocab.DimensionStatement( value=js['dimensions']) if js['creditLine']: artwork.referred_to_by = vocab.CreditStatement(value=js['creditLine']) if js['geographyType'] == "Made in": # Put a place on the Production bestPlace = None if js['country']: country = vocab.Nation() country.identified_by = model.Name(value=js['country']) bestPlace = country if js['state']: state = vocab.Province()