[sword-devel] osis2mod linking bug

DM Smith dmsmith555 at yahoo.com
Thu Sep 4 11:05:17 MST 2008

I'm trying to solve an osis2mod linking bug that was exposed by several 
beta modules.

Here is the scenario:
<verse osisID="XXX.1.29 XXX.1.30 XXX.1.31">Text for the last three 
verses of XXX, chapter 1 in the KJV versification</verse>
<verse osisID="XXX.1.32 XXX.1.33">Text for additional verses in the XXX, 
chapter 1 in the non-KJV versification</verse>

1) osis2mod links 1.30 and 1.31 by writing out the start and offset of 
the data for 1.29. That means that 1.29 has to be written first. In the 
index file the result is that all three entries have the same start and 
offset. So far so good, if there weren't a bug that writes the links 
first and then the data, resulting in start/offset of 0/0 for the links. 
But I've already figured out how to fix that bug.

2) Now a non-KJV verse is found and osis2mod appends it to the last 
verse of the chapter according to the KJV versification. So the entry 
for XXX.1.31 is found, the raw text is gotten and it is appended and 
this augmented text is written to the data file, at the end of the file. 
Finally the index entry for XXX.1.31 is updated.

The problem is that 1.29 and 1.30 are not updated, they still point to 
the "1.29-1.31" text and now 1.31 points to the "1.29-1.33" text.

3) The other problem is with 1.33, it is noticed that it is out of 
bounds and is changed to 1.31 and then it is linked to 1.32, which does 
not exist and thus 1.31 is re-written to 0/0.

I'm looking for a way to solve these problems. Here is what I am 
thinking and I'd like feedback or a better way.
For 1) I have postponed the writing of the links until the verse is 
written. I could either wait until the next verse is ready to be 
written, or later. I've decided to wait until the very end and do the 
linking then. This might help solve 2 and 3.

For 2) I'm thinking that the verse to append is the last verse in the 
chapter with content. By postponing linking until later, it will append 
to 1.29. Then the linking will propagate the final start/offset values 
for 1.29. The problem I have with this is that this is somewhat disk 
intensive. I start with the last verse in the chapter and get the raw 
text for it. If there is none, I then decrement and refetch until I find 
it. I looked for a way to know if a verse were part of a linked set and 
what the members of that set were, but I didn't see any in the SWORD 
engine. Am I missing it?

For 3) this is fairly simple, one should not link verses that are not in 
the KJV versification.

In Christ,

More information about the sword-devel mailing list