PoC mapping the given object to MARC record

MDEXP-59 - Getting issue details... STATUS  

Sources: https://github.com/Igor-Gorchakov/mapping-processor


The purpose of the PoC is to provide a viable solution for converting the incoming JSON entity to MARC record based on the given mapping rules. The data-export uses Inventory objects - instances, holdings, items for further converting to MARC record.


The solution is to provide 3 self-responsible components to drive conversion work: EntityReader, RecordWriter, and MappingProcessor. 

1) EntityReader interface is used to specify the behavior for reading the data from an underlying entity by the given rule. There is only one implementation - JPathEntityReader that is responsible to read data in JsonPath notation, that is the most simple in implementation. For other versions of syntax (dot.separated syntax) we have to use specific third-party libraries - fasterxml.jackson and others.

RuleValue: The values that can be read by the given rule are classified by 2 groups: simple values (String, ListOfString) and composite values. The mission of composite value is to represent array of object with multiple string fields - inventory contributors, classifications, identifiers.


2) RecordWriter interface is used to specify the behavior for writing the data to the underlying entity, marc record, whatever. There are 3 implementations responsible to write control fields and data fields: MarcRecordWriter, XmlRecordWriter, JsonRecordWriter. All the 3 implementations work with using the marc4j library under the scene.


3) MappingProcessor is the component that uses both EntityReader and  RecordWriter, with a purpose to iterate mapping rules calling EntityReader and RecordWriter along the road. 

Translations: FOLIO inventory instance contains fields that are represented by keys and those will need to be replaced by their values when generating MARC bib record. In many cases, which field in MARC record will be populated depends on the value of the key. MappingProcessor calls java functions (TranslationFunctions) to bring up an ability to check the field value and conditionally replace it.