[jsword-devel] Method to find if BibleBook is contained in a Book

Martin Denham mjdenham at gmail.com
Tue Mar 25 04:38:18 MST 2014


I am having problems getting a list of BibleBooks contained in some AV
modules which we know do not contain certain books.  I can't work out if
the problem is with JSword, the modules, or osis2mod.

There are 2 related problems I can see:

   1. book.contains(nonExistingVerse) returns TRUE
   2. book.getRawText(nonExistingVerse) returns <chapter end tag>

Here is a simple test to show the problem using KAZ which has Synodal v11n
but does not contain any deuterocanonical books:

     SwordBook kaz = (SwordBook)Books.installed().getBook("KAZ");
     Verse esd11Verse = new Verse(kaz.getVersification(), BibleBook.ESD1,
1, 1);
     System.out.println(kaz.contains(esd11Verse)); // prints: *true*
     System.out.println(kaz.getRawText(esd11Verse)); // prints: *<chapter
eID="gen7" osisID="1Esd.1"/>*
     Verse esd12Verse = new Verse(kaz.getVersification(), BibleBook.ESD1,
1, 2);
     System.out.println(kaz.contains(esd12Verse)); // prints: *true*
     System.out.println(kaz.getRawText(esd12Verse)); // prints: *<chapter
eID="gen7" osisID="1Esd.1"/>*

So how does "<chapter eID="gen7" osisID="1Esd.1"/>" get into verse content
unexpectedly?

It seems to me like it could be either:

   1. a module problem; but IBT say they do not add empty verse slots
   2. Sword osis2mod issue
   3. JSword issue: why is JSword returning a chapter end tag instead of
   verse content

Any ideas what might cause this problem?

Thanks
Martin


On 11 March 2014 12:15, DM Smith <dmsmith at crosswire.org> wrote:

> We haven't pushed this down into JSword. So far it is the responsibility
> of the front-end. Chris B has made it efficient to ask a Book whether it
> contains a Verse.
>
> Essentially, when it comes to asking a module if it has meaningful
> content, you want containsAny(Key verses, boolean includeIntros) and
> containsAny(Key verses) { return containsAny(verses, false); }
>
> I think it should ignore verse 0 by default. If it doesn't have verse
> content, then does the content really mean something?
>
> As you have noted contains(Key) is confusing. There are a few places where
> it means containsAny. Usually it means containAll. The name, contains, was
> chosen early as we derived from a container class where the argument was an
> element of the container.  That is, contains is supposed to mean
> isMemberOf. Later we changed the inheritance as it wasn't an "is a"
> relationship.
>
> But we need to be careful of not introducing more confusion.
>
> By the way, the list serve was holding mail for a few days.
>
> In Him,
>         DM
>
> On Mar 8, 2014, at 5:26 PM, Martin Denham <mjdenham at gmail.com> wrote:
>
> > Is there an efficient way to find if a BibleBook is contained in a Book
> (Bible or commentary) using JSword?
> >
> > I recall this subject being discussed but can't recall the outcome.
> >
> > Thanks
> > Martin
> > _______________________________________________
> > jsword-devel mailing list
> > jsword-devel at crosswire.org
> > http://www.crosswire.org/mailman/listinfo/jsword-devel
>
>
> _______________________________________________
> 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/20140325/6e358550/attachment.html>


More information about the jsword-devel mailing list