Hello Nathan,<br><br><div><span class="gmail_quote">On 11/8/06, <b class="gmail_sendername">lumin8</b> &lt;<a href="mailto:lumi.n8@gmail.com">lumi.n8@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Bill,<br><br>Yes exactly.&nbsp;&nbsp;Sounds like you are doing some great work with this.<br>I'm trying to figure out how I can help - at the least I could package<br>it as a rails plugin or gem making it easy for any ruby on rails
<br>developer to get started with it.</blockquote><div><br>I was thinking of eventually creating a GEM so it could be easily installed and used in any Ruby application.&nbsp; <br><br>However, I think a Rails plug-in would be a good idea to provide any extra support that makes sense specific to a Rails application.&nbsp; At the very least, providing a default controller implementation and/or helper methods that could be used in other controllers would be worthwhile.&nbsp; The ActionService web service client support might be a good pattern to start with.
<br><br>Also, right now, there's a limitation with the Sword C flatapi API in that there's limited metadata available for Bible modules.&nbsp; What I mean is you:<br>* Can't get a list of all the books in a Bible.<br>* Given a book name, can't get the number of chapters in the book.
<br>* Given a book name and chapter, can't get the number of verses in that chapter.<br><br>If this information is available in the C++ classes, then it would be worthwhile exposing in the C flatapi.<br><br>So in the meantime, an application using the C flatapi has to provide it's own support to maintain this metadata.&nbsp; As versifications are different in some translations, you can't necessarily use the same information for all translations.
<br><br>In regards to creating a unique key to represent a Bible verse, it may be helpful to create a utility class like VerseKey that can take any verse reference with a variety of abbreviations and return it in OSIS notation.
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Let me know if I can help with anything else.</blockquote><div><br>I'll try to clean up the module and send it to you so you can start experimenting with it.
<br><br>In His Service,<br>-Bill<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">-=nathan<br><br><br>On 11/7/06, Bill Burton &lt;
<a href="mailto:bburton@mail.com">bburton@mail.com</a>&gt; wrote:<br>&gt; Hello,<br>&gt;<br>&gt; I see.&nbsp;&nbsp;You want the module information in a database because it's then<br>&gt; trivial to program a web application using Ruby on Rails ActiveRecord object
<br>&gt; relational mapping support.&nbsp;&nbsp;RoR also supports other logic in controllers<br>&gt; such as web services clients so it's entirely possible to write an<br>&gt; application that calls Sword without using a database but the scaffolding
<br>&gt; code generator won't be able to help much if at all.<br>&gt;<br>&gt; It just so happens I've been working on a Ruby interface to Sword with a<br>&gt; longer term goal of writing a Ruby on Rails application to access it.
<br>&gt; Initially, I couldn't figure out how to build anything with SWIG--there's no<br>&gt; README in the bindings/swig directory.&nbsp;&nbsp;Then it happened I discovered Ruby<br>&gt; can load shared libraries and DLL's and dynamically bind to them on the fly
<br>&gt; using the dynamic loader (DL) module.&nbsp;&nbsp;So I started to write a Sword<br>&gt; interface to the C flatapi in bindings/flatapi.cpp.&nbsp;&nbsp;In the process, I found<br>&gt; a few minor bugs with the flatapi but have created patches to fix them
<br>&gt; (which I'll submit soon).<br>&gt;<br>&gt; Using this Ruby to Sword flatapi interface you can output verses as follows<br>&gt; (I'm doing this from memory so it's not exact):<br>&gt;<br>&gt; include Sword<br>&gt; # SWMgr_new(FMT_HTML)
<br>&gt; Manager.new (Sword::FMT_HTML) do |mgr|<br>&gt; module = mgr.get_module(&quot;KJV&quot;)<br>&gt; # iteration using Sword API's under the covers to verseKey and renderText<br>&gt; module.each_verse_render(&quot;Psalm 133:1-3&quot;) do |verse, text|
<br>&gt; puts &quot;#{verse} #{text}&quot;&nbsp;&nbsp;# verse reference and text<br>&gt; end<br>&gt; end&nbsp;&nbsp;# performs an implicit SWMgr_delete<br>&gt;<br>&gt; So far, I've implemented about two-thirds of the Sword C flatapi.&nbsp;&nbsp;However,
<br>&gt; the one issue I'm just starting to address is how to call these API's within<br>&gt; a multi-threaded multi-user environment such as a web application.&nbsp;&nbsp;Because<br>&gt; the SWMgr_new/newEx and SWModule_* functions have state, it looks like a new
<br>&gt; Manager object will have to be created per user which means establishing a<br>&gt; session and then saving the Manager instance in the session.&nbsp;&nbsp;So I have to<br>&gt; refactor the code to allow multiple instances of a Manager class without
<br>&gt; loading the shared library every time.<br>&gt;<br>&gt; But then last night I was about to send an email to this list asking how to<br>&gt; build the SWIG interface but I looked at it one more time and discovered how
<br>&gt; to do it. With some more investigation I was then able to generate SWIG<br>&gt; bindings for Ruby and build the interface to Sword.&nbsp;&nbsp;So far I've been able<br>&gt; to access some of the methods from the SWMgr and SWModule classes but can't
<br>&gt; output a verse because the binding of set_key to SWModule.SetKey is<br>&gt; incorrect.&nbsp;&nbsp;This may be a bug in the way SWIG generated the binding but I<br>&gt; don't know yet.<br>&gt;<br>&gt; The nice thing about the Ruby dynamic loader interface to Sword is there's
<br>&gt; nothing extra to build which makes it much easier to install as compared<br>&gt; with the SWIG version.&nbsp;&nbsp;However, the C flatapi on which it's based limits<br>&gt; one to getting and setting global options, iterating over modules and
<br>&gt; rendering verses.&nbsp;&nbsp;The SWIG interface to the C++ API's is much more complete<br>&gt; but has to be built. I don't know yet if the Sword C++ API's also have state<br>&gt; which is important to know for a web application.
<br>&gt;<br>&gt; Right now, I'm developing on RedHat ES 3 but plan to test the DL version on<br>&gt; Windows against an installed BibleCS.&nbsp;&nbsp;My time is limited but I'll try to<br>&gt; get this binding in reasonable shape soon so it can be used with Ruby on
<br>&gt; Rails.&nbsp;&nbsp;Building the SWIG version on Windows is not an option for me at this<br>&gt; time due to lack of tools and a dead machine.<br>&gt;<br>&gt; God is merciful,<br>&gt; -Bill<br>&gt;<br>&gt; On 11/7/06, lumin8 &lt;
<a href="mailto:lumi.n8@gmail.com">lumi.n8@gmail.com</a>&gt; wrote:<br>&gt; &gt;<br>&gt; &gt; &gt; I'll leave the question alone as to the value of a relational database<br>&gt; &gt; &gt; for this data over using the SWORD API.
<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; Actually, I am interested in this question if you have time / desire to<br>&gt; enlighten me.&nbsp;&nbsp;I think I can manage the chunk of code you gave me (thanks),<br>&gt; but I have never compiled a program in my life.&nbsp;&nbsp;I have been building web
<br>&gt; applications for about 7 years with PHP, and now Ruby for the last year and<br>&gt; a half.<br>&gt; &gt;<br>&gt; &gt; I am willing to learn the Sword API if I need to, but I can build web<br>&gt; applications very quickly with Ruby on Rails.&nbsp;&nbsp; The rest of my data (user
<br>&gt; info, notes, user generated translations, a wiki like interface for<br>&gt; commentary) will all be in a relational database.&nbsp;&nbsp;Would there be speed<br>&gt; benefits from using the Sword API over the indexing provided by mysql or
<br>&gt; postgre?&nbsp;&nbsp;What about application development time?&nbsp;&nbsp;In the Rails framework,<br>&gt; I hardly even have to write SQL, if I used the Sword API I would have to<br>&gt; learn a bit about c++ and bindings to Ruby...&nbsp;&nbsp;I am willing, but what is the
<br>&gt; advantage?<br>&gt; &gt;<br>&gt; &gt; By the way, I have tried and use many of the Sword front ends and highly<br>&gt; respect the work you all are doing.<br>&gt; &gt;<br>&gt;<br></blockquote></div>