JSword & STEP

JSword is a library developed by CrossWire (including me, and hopefully you). STEP uses JSword to read passages from SWORD modules, create and manage and search Bible & Commentary Lucene indexes (different to indexes mentioned below) as well as carry out various operations on scripture references (next chapter, previous chapter, conversions between versifications, etc.)

What is a SWORD module

A SWORD module is essentially a compressed form of a resource. Most modules nowadays are in OSIS. So a SWORD module is typically a compressed form of OSIS. The Sword Utilities provide an osis2mod tool. That tool carries out several tasks, but the main ones are:
  • Breaks down OSIS in a verse by verse form
  • stores and compresses (usually) the content and very rarely encrypt the data
  • creates a lookup table (referred to confusingly as an index table) to the various positions of verses in the resource

How does JSword use a SWORD module

In order to use a SWORD module, JSword (or other libraries) will need to 
  • locate the right part of the module to be read off disk using the index table. 
  • decompress/decrypt the data. 
  • At this stage, JSword will have read a number of verses. 
    • If the stream is OSIS, then no operation is done. 
    • ***** If the stream is another form (e.g. ThML), then this is wrapped in a OSIS verse container.
Thereafter the content is essentially treated as OSIS in the rest of the application.

How does STEP use JSword to use a SWORD module

Typically in JSword, a frontend (STEP) will provide some XSLTs to transform the XML into a viable display alternatives (e.g. HTML for a webpage). STEP will ask JSword to carry out the process above, which will yield OSIS. STEP will then be able to use an XSL transformation to generate HTML. Interlinears, notes, etc. are all handled within an XSL, sometimes with integration to Java classes/services to provide richer data. For example, when the user requests an interlinear, the XSLT calls out to Java for every w tag marked with a strong number.