DOREMUS-ANR / marc2rdf

Converter from UNIMARC/INTERMARC to RDF using the DOREMUS model
Apache License 2.0
6 stars 0 forks source link

Merge BnFParser and PPParser packages #14

Closed pasqLisena closed 8 years ago

pasqLisena commented 8 years ago

The packages BnFParser and PPParser contains a lot of duplicate code.

My purpose is to try to put them to an unique central package.

Some classes are exactly duplicated:

A class is only in BnFParser:

The other ones are quite different, but they share some methods:

For these last ones, could be do an attempt to use a parameter or an initialization phase in the constructor for distinguishing between the two cases. If this will be not possible, we can write them as abstract class and extend in two more specific ones.

pasqLisena commented 8 years ago

Now the parser is unique.

The most difficult class to merge was MarcXmlHandler, because of a difference on tag/field names. I used the builder approach , so that these are now customizable properties (it is also easier to extend the parser for other hypothetical sources). This is an example of how the builder work, e.g. setting the name of record tag to "NOTICE".

I have seen that was previewed also a conversion XML2Marc. It is now accessible by the command gradle run -Pmarc (I documented it also in the README).