[sword-devel] SWKey index

Daniel Sheffield d.j.yotta at gmail.com
Sat Feb 28 22:47:07 MST 2015


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



More information about the sword-devel mailing list