def handle_statements(self, data): text_content = data.get('text') if text_content: cite = vocab.BiographyStatement(ident='', content=text_content) data['referred_to_by'].append(cite) source_content = data.get('source') if source_content: cite = vocab.BibliographyStatement(ident='', content=source_content) data['referred_to_by'].append(cite) project = data.get('project') if project: data['referred_to_by'].append( vocab.SourceStatement(ident='', content=project)) awards = { l.strip() for l in data.get('medal_received', '').split(';') } - {''} for award in awards: cite = vocab.Note( ident='', content=award ) # TODO: add proper classification for an Awards Statement data['referred_to_by'].append(cite)
def add_private_sellers(self, data: dict, sellers, sale_type, transaction, transaction_types): parent = data['parent_data'] auction_data = parent['auction_of_lot'] cno, lno, date = object_key(auction_data) own_info_source = f'Listed as the seller of object in {cno} {lno} ({date}) that was privately sold' note = vocab.SourceStatement(ident='', content=own_info_source) rel = 'leading to the previous ownership of' return self.add_sellers(data, sale_type, transaction, sellers, rel, source=note)
def handle_prev_post_owner(self, data, hmo, tx_data, sale_type, lot_object_key, owner_record, record_id, rev, ts=None, make_label=None): current_tx = get_crom_object(tx_data) sales_record = get_crom_object(data['_record']) if rev: rel = f'leading to the previous ownership of' source_label = 'Source of information on history of the object prior to the current sale.' else: rel = f'leading to the subsequent ownership of' source_label = 'Source of information on history of the object after the current sale.' owner_record.update({ 'pi_record_no': data['pi_record_no'], 'ulan': owner_record.get('ulan', owner_record.get('own_ulan')), }) self.add_person(owner_record, record=sales_record, relative_id=record_id, role='artist') owner = get_crom_object(owner_record) # TODO: handle other fields of owner_record: own_auth_d, own_auth_q, own_ques, own_so if owner_record.get('own_auth_l'): loc = owner_record['own_auth_l'] current = parse_location_name(loc, uri_base=self.helper.uid_tag_prefix) place_data = self.helper.make_place(current) place = get_crom_object(place_data) owner.residence = place data['_owner_locations'].append(place_data) if owner_record.get('own_auth_p'): content = owner_record['own_auth_p'] owner.referred_to_by = vocab.Note(ident='', content=content) data.setdefault('_other_owners', []) data['_other_owners'].append(owner_record) # The Provenance Entry URI must not share a prefix with the object URI, otherwise # we run the rist of provenance entries being accidentally merged during URI # reconciliation as part of the prev/post sale rewriting. tx_uri = self.helper.prepend_uri_key(hmo.id, f'PROV-{record_id}') tx_label_args = tuple([self.helper, sale_type, 'Sold', rel] + list(lot_object_key)) tx, _ = self.related_procurement(hmo, tx_label_args, current_tx, ts, buyer=owner, previous=rev, ident=tx_uri, make_label=make_label) if owner_record.get('own_auth_e'): content = owner_record['own_auth_e'] tx.referred_to_by = vocab.Note(ident='', content=content) own_info_source = owner_record.get('own_so') if own_info_source: note = vocab.SourceStatement(ident='', content=own_info_source, label=source_label) tx.referred_to_by = note ptx_data = tx_data.copy() data['_prov_entries'].append(add_crom_data(data=ptx_data, what=tx))
def handle_prev_post_owner(self, data, hmo, tx_data, sale_type, lot_object_key, owner_record, record_id, rev, ts=None, make_label=None): current_tx = get_crom_object(tx_data) sales_record = get_crom_object(data['_record']) if rev: rel = f'leading to the previous ownership of' source_label = 'Source of information on history of the object prior to the current sale.' else: rel = f'leading to the subsequent ownership of' source_label = 'Source of information on history of the object after the current sale.' owner_record.update({ 'pi_record_no': data['pi_record_no'], 'ulan': owner_record.get('ulan', owner_record.get('own_ulan')), 'auth_name': owner_record.get('auth_name', owner_record.get('own_auth')), 'name': owner_record.get('name', owner_record.get('own')), }) self.add_person(owner_record, record=sales_record, relative_id=record_id, role='artist') owner = get_crom_object(owner_record) # TODO: handle other fields of owner_record: own_auth_d, own_auth_q, own_ques, own_so if owner_record.get('own_auth_l'): loc = owner_record['own_auth_l'] current = parse_location_name(loc, uri_base=self.helper.uid_tag_prefix) place_data = self.helper.make_place(current) place = get_crom_object(place_data) owner.residence = place data['_owner_locations'].append(place_data) data.setdefault('_other_owners', []) data['_other_owners'].append(owner_record) tx_uri = hmo.id + f'-{record_id}-Prov' tx_label_args = tuple([self.helper, sale_type, 'Sold', rel] + list(lot_object_key)) tx, _ = self.related_procurement(hmo, tx_label_args, current_tx, ts, buyer=owner, previous=rev, ident=tx_uri, make_label=make_label) own_info_source = owner_record.get('own_so') if own_info_source: note = vocab.SourceStatement(ident='', content=own_info_source, label=source_label) tx.referred_to_by = note ptx_data = tx_data.copy() data['_prov_entries'].append(add_crom_data(data=ptx_data, what=tx))