To provide the functionality for generating MARC bib records on the fly to other modules.
There are two options:
- provide an API, other modules can use;
- create a shared java library, other modules can use.
Provide an API in the data-export module, for mapping objects to MARC format, other modules can use.
We will provide an API in the Q3. We don`t have mapping profiles now, so the structure of the endpoint will be provided later when we will have mapping profiles and will be able to provide a solution for this.
2. Create a shared library, that will map JSON object to the MARC format.
The proposed sequence diagram of the library will look like this:
Short descriptions of the mapping process in the library:
- The process(EntityReader, RecordWriter, ReferenceData) method is an entry point of the library;
- EntityReader reads the value of the field by rule;
- TranslationFunction applying the mapped value by provided reference data;
- RecordWriter writes the result mapped field with the tag provided by the rule.
- After all fields, that have rules, are mapped, the writer will return the result MARC object in String format.
Preparation steps for using the library:
- Implement EntityReader with JSON object of the instance to map and RecordWriter. You can use existing implementations of EntityReader and RecordWriter. More about existing implementations you can find here;
- Implement ReferenceData interface, and provide your logic for getting and storing reference data for the fields that required it from Inventory;
- Create a list of Rule objects for the mapping process (default data-export rules located here);
- Create RuleProcessor object with a created list of rules;
- Call process(EntityReader, EntityWriter, Settings) method, and provide all necessary objects for it.
This library converts the given JSON object to the MARC format. Data-export using it for mapping inventory instances, holdings, and items.
In the feature, the library will expand and provide the ability to map using the mapping profile. It will build the rules from the profile,
and use it in the mapping process.
The decision to provide both options - shared library and API, came after the discussion with z39.50 server and oai-pmh teams. We decided to provide both options because:
1 Z39.50 server team not using java, so the shared library is not suitable for them. They need mapping functionality in Q3, therefore we will provide them with an endpoint.
2. The oai-pmh team uses java and needs mapping functionality as soon as possible, that`s why we decided to provide a shared library in Q2.