blackbeam / rust-marc

Apache License 2.0
16 stars 5 forks source link

Modifying a record #5

Open lannonbr opened 8 years ago

lannonbr commented 8 years ago

Hey AnatolyI,

Our next task we wanted to add was the ability to modify a Record. what I was thinking on how to implement this was to have the ability to be able to add, modify, or remove a field / subfield at first. When you would do this, you would have to change the directory based on these modifications and then change the length of the record which is stored in the leader.

If you have any other suggestions on how it should be implemented, feel free to respond.

~ Benjamin

blackbeam commented 8 years ago

Record modification is a tricky topic for me.

Current modification-related primitives (RecordBuilder::filter_fields, RecordBuilder::filter_subfields and FieldRepr::filter_subfields) was implemented because i faced a concrete task earlier.

I was needed to remove every 979$a fields in a record and add one concrete 979$a field but MARC allows records to have any amount of fields with same tag and any amount of subfields with same identifier and i saw such combinations in records provided for this task. So i come up with mentioned methods as a convenient way to remove every XXX or XXX$y in a record which hides the actual field-subfield layout complexity.

I did not really see a task related to record modification or record creation that requires something bigger than current RecordBuilder and FieldRepr API so i have nothing to tell about the topic.

If your case reveals some problems with convenience or functionality of current API and you will come up with a solution - it will be great.