[sword-devel] SWKey index

Chris Burrell christopher.burrell at gmail.com
Sun Mar 1 01:23:01 MST 2015

You might want to store the versification alongside it if you're working across multiple modules.

-----Original Message-----
From: "Troy A. Griffitts" <scribe at crosswire.org>
Sent: ‎01/‎03/‎2015 08:19
To: "SWORD Developers' Collaboration Forum" <sword-devel at crosswire.org>; "Daniel Sheffield" <d.j.yotta at gmail.com>
Subject: Re: [sword-devel] SWKey index

Hi Daniel, the most concise way to store an SWKey is to store the string from: SWKey::getOSISRefRangeText

This should return OSIS (or something close to OSIS) and include any range is present, as well.

SWKey::Index is certainly not persistable. It might change between API versions and almost certainly will be different between versification (v11n) schemes from different Bibles.

Hope this helps.


On February 28, 2015 10:47:07 PM MST, Daniel Sheffield <d.j.yotta at gmail.com> wrote:
Hi all,I'm just wondering what is the correct way to go about storing scriptural references (specifically for use with SWORD) in a database?Currently, I'm storing references in the form Gen. 1.1 or Gen. 1:1 etc. and I'm thinking about being more consistent by first parsing the reference with VerseKey to the expanded form Genesis 1:1 before inserting into the database.I don't like the idea of storing strings everywhere though - I know I'm being pedantic - it just doesn't seem right.I would rather store the SWKey index - which I gather is simply an integer of some kind, which would both decrease the size of the database and provide some consistency in how references are stored in the db.In short: is the index for a particular scripture guaranteed never to change between SWORD versions?ie, will (SWKey("Gen. 1.1")).getIndex() always return the same across sword api versions?I've come across this in the API documentation, but I couldn't find anything about SWKey::index itself   SWKey::SWKey   (  const char *    ikey = 0   )     initializes instance of SWKey from a string All keys can be reduced to a string representation which should be able to be used to again set the key to the same position   Parameters:     ikey string to use for initializing this new keyOn the other hand, I like being able to store distcontiguous ranges (eg, Gen. 1.1-3.4,5.6) which can be loaded into VerseKey and iterated over fairly easily, but knowing whether or not the SWKey index is invariant across api versions will help me to decide on how I should store references in the db. There may also be another option that I am not aware of which is better than both of these methods.Cheers,Daniel SheffieldSoftware EngineerLevel 9, KPMG CentreAlexander StreetHamilton+64 21 1408 708 Mobilehttp://www.emulex.comsword-devel mailing list: sword-devel at crosswire.orghttp://www.crosswire.org/mailman/listinfo/sword-develInstructions to unsubscribe/change your settings at above page
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20150301/ff14bb18/attachment-0001.html>

More information about the sword-devel mailing list