[sword-devel] SWKey index

Troy A. Griffitts scribe at crosswire.org
Sun Mar 1 01:18:55 MST 2015


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.

Troy

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 key
>
>On 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 Sheffield
>
>Software Engineer
>Level 9, KPMG Centre
>Alexander Street
>Hamilton
>
>+64 21 1408 708 Mobile
>http://www.emulex.com
>
>_______________________________________________
>sword-devel mailing list: sword-devel at crosswire.org
>http://www.crosswire.org/mailman/listinfo/sword-devel
>Instructions 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/be6452d3/attachment.html>


More information about the sword-devel mailing list