-
Notifications
You must be signed in to change notification settings - Fork 2
old_ _Creating_a_converter
- WARNING**: I believe this to be old now. It should be modified or maybe eliminated.
This is a rough guide to creating a JUMBOConverter
Notes added as PMR created a GAMESSUK-PUNCH converter. We assume you are creating a converter for the BarComp system - replace "BarComp" by your own system. Be consistent in the use of classNames and variables
You will need:
* a set of exemplar files * JUMBOConverters in a Development environment (e.g. Eclipse, NetBeans, IntelliJ...) with maven enabled * the program manual. This is optional and I have written converters without manuals but it helps to know what the output actually means and how it is structured. * a modest unerstanding of Mercurial and Maven * a reasonable understanding of Java, regexes, * a long day
This is written with an Eclipse flavour - others should work by analogy.
We have written a set of templates for a fictitious format "foo" in . You should copy all resources into a new package . Then rename the classes (*using the refactoring tools*) and you should now have:
* BarComp2XMLConverter (converts BarComp format to rawCML) * BarCompBlock.java (holds the blocks in the BarComp2XML parse * BarCompProcessor (helper application for BarComp2XMLConverter to create and process the blocks) * BarCompXML2CMLConverter (converts rawCML to completeCML) * BarCompXMLProcessor (helper application for BarCompXML2CMLConverter to add CML structure and semantics )
This will fail to compile and you have to make some manual changes:
* globally replace the string "FOO_" by "BARCOMP_" * in BarComp2XMLConverter find the two lines: {{{
public static final String BARCOMP_PREFIX = "foo"; public static final String BARCOMP_URI = "http://wwmm.ch.cam.ac.uk/dict/foo"; }}} and change them to: This establishes the dictionary namespace. (We may change this to use properties files or central dictionary locations later)
Now you should only have two compile errors with undeclared variables:
You will need to edit them into the class. *This must be done even more carefully as if you corrupt this file you'll screw up other people*. There are THREE edits required in three different locations. (Yes, we'll probably change this to a *.properties file...). Please keep the code in structured form.
* Clone the FOO declarations to create and add (in alphabetical order) {{{
public static final Type BARCOMP; public static final Type BARCOMP_XML; }}}
* Clone the FOO assignments to create and add (in alphabetical order): {{{
BARCOMP = new Type("chemical/x-barcomp", ObjectType.TEXT, "barcomp"); BARCOMP_XML = new Type("chemical/x-barcomp-xml", ObjectType.XML, "barcomp.xml"); }}}
- If there is a chemical MIME type for either or both of these, please use them.* If there isn't, liaise with PMR or Henry Rzepa to have one registered. You may also need to liaise with the program developers.
* Then clone and edit the lines and add (in alphabetical order) : {{{
typeList.add(BARCOMP); typeList.add(BARCOMP_XML); }}}
Now it should compile...
to be continued