[jsword-devel] Best way of keying verses in a separate database

DM Smith dmsmith at crosswire.org
Mon Jul 2 07:32:27 MST 2012


Replying to the thread as a whole.

The BibleInfo.getOrdinal() is gone for good. The reason is simple, it was an offset into the KJV versification starting w 0 at Gen 1.1 and continuing until the last verse in Rev. Originally, it did not account for Book 0, Chapter 0 and Verse 0 (aka titles/headings). In fact BibleInfo will go away.

There is no way BibleInfo.getOrdinal would work in and of itself. It is only of value w/in a versification. So a pair is needed, the v11n and the offset in that work.

However, the notion is still there: See Versification.getOrdinal(Verse).
The basic idea is that everywhere that needs to work with a Verse needs to work with it in the context of a Versification.

So you should be able to ask of a Book to get its Versification.

When working within a Versification, you can get the ordinal value of the Verse either globally or within the testament. This value is only useful within a bitmap for that Versification.

When going from one Versification to another, one needs to bridge with the Verse not the ordinal value.

As Peter points out, the problem of alignment between versifications is currently a problem and is no worse with this scheme.

If you ask a Versification for the ordinal value of a Verse that does not make sense, it should try its best to come back with something that makes sense. Right now I think it will throw an Array Out of Bounds Exception.

The Versification.patch method will actually bridge a bad verse into something workable. The code in it is rather old and hasn't been used in years. I'm not sure what it'd do if it were handed a BibleBook not in the versification. It probably should handle that as well.

So given two av11ns "a" and "b" and an ordinal value "ord" of a verse in "a"

Verse aVerse = a.decodeOrdinal(ord);
Verse bVerse = b.patch(a.getBook(), a.getChapter(), a.getVerse());

So far I've avoided having a Verse know it's Versification and it no longer will validate itself against any versification (it used to do it against the KJV). Now it is merely a dumb holder of a BibleBook, chapter and verse.

Hope this helps.

In Him,
DM



On Jul 1, 2012, at 11:15 AM, Chris Burrell wrote:

> Hi
> 
> Any ideas on this? The only way I can think of is to lookup the OSIS ID in one version and hope it's present in a different version. Will this work for Books of different languages?
> Chris
> 
> 
> On 8 June 2012 17:25, Chris Burrell <chris at burrell.me.uk> wrote:
> Hi all
> 
> I used to be using the getOrdinal()  on the verse range to key a set of references in my database against particular resources. Now that it's deprecated, what's the best way. I'm happy to assume that my database will be keyed in a particular known version (e.g. KJV). I need a way to key this in numerical form to allow me to do intersection of ranges, etc.
> 
> Should getOrdinal be re-instated? Also, is there a way to translate from one versification to another? So if the user is looking at version x, I'd like to translate what he's looking at to the version stored in the database.
> 
> Any ideas?
> 
> Chris
> 
> 
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20120702/d289d807/attachment.html>


More information about the jsword-devel mailing list