<div dir="ltr">I think the client code has to handle this. A verse is specifically tied to a versification, and presumably its contract is that it represents a meaningful verse in the versification.<div><br></div><div>I think what you're after is a name rather than a verse? so that you can re-use the name/etc. going forward. </div>
<div><br></div><div>Chris</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 19 April 2014 15:13, Martin Denham <span dir="ltr"><<a href="mailto:mjdenham@gmail.com" target="_blank">mjdenham@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Client code can be amended to handle 'invalid verse or passage' responses from the mapping code.<div>
<br></div><div>Either that or implement an 'all v11n verse' (or passage etc) which can hold a verse reference for any v11n.</div>
<div><br></div><div>They are the only ideas I have unless I have misunderstood the issue.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Martin</div></font></span></div><div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><br><div class="gmail_quote">On 19 April 2014 10:27, Chris Burrell <span dir="ltr"><<a href="mailto:chris@burrell.me.uk" target="_blank">chris@burrell.me.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Righto - so isn't it just a question of changing the catch(AIOB) to throw an error?<span><font color="#888888"><div>
<br></div><div>Chris</div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On 19 April 2014 10:22, Martin Denham <span dir="ltr"><<a href="mailto:mjdenham@gmail.com" target="_blank">mjdenham@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The mapping code seems to work fine but QualifiedKey is only used within the v11n mapping code so as soon as the results from the mapping are used outside of the mapping code, errors will occur.<span><font color="#888888"><div>
<br></div>
<div>Martin<br></div></font></span><div><div>
<div class="gmail_extra"><br><div class="gmail_quote">On 19 April 2014 09:54, Chris Burrell <span dir="ltr"><<a href="mailto:chris@burrell.me.uk" target="_blank">chris@burrell.me.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">There might be a bug, but the framework itself does support it. The purpose of the 'qualifiedKey' wrapper is to store this extra information. I.e. you should be able to map across versifications that don't contain the verse.<div>
<br></div><div>But if you're wanting a particular verse that doesn't exist, then it looks like perhaps we simply change the getOrdinal() to throw an exception, rather than just swallowing it?</div><span><font color="#888888"><div>
<br></div><div>
Chris</div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On 19 April 2014 09:47, Martin Denham <span dir="ltr"><<a href="mailto:mjdenham@gmail.com" target="_blank">mjdenham@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Conversion of a verse to a v11n in which it does not exist cannot be done using the current framework so this will need to be checked for in front ends or the JSword Verse will need to be enhanced.<div>
<br></div>
<div>If a verse is not in a v11n an ArrayIndexOutOfBoundsException is thrown and silently caught and the ordinal is set to 0, which is '<span style="font-size:13px;font-family:arial,sans-serif">Bible Introduction 0:0</span>'.</div>
<div><br></div><div><div> public int getOrdinal(Verse verse) {</div><div> try {</div><div> return chapterStarts[bookList.getOrdinal(verse.getBook())][verse.getChapter()] + verse.getVerse();</div><div>
} catch (ArrayIndexOutOfBoundsException e) {</div><div> return 0;</div><div> }</div><div> }</div></div><div><br></div><div><br></div><div><br></div></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">
On 18 April 2014 23:02, Martin Denham <span dir="ltr"><<a href="mailto:mjdenham@gmail.com" target="_blank">mjdenham@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">The v11n mapper does actually map it correctly to Sir.1.1 but when I try to get the verse out of the returned RangedPassage it comes out as '<span style="font-family:arial,sans-serif;font-size:13px">Bible Introduction 0:0</span>'. I have expanded on the above demonstration of the problem below:<div>
<br></div><div><div><div> Key kjvSir1_1 = mapper.mapVerse(CathSir1_1, KJV);</div></div><div> System.out.println(kjvSir1_1); // This is a RangedPassage containing: Sirach 1:1, so the mapping is apparently correct </div>
<div> Verse verse1 = KeyUtil.getVerse(kjvSir1_1);</div><div> System.out.println(verse1); // This is a Verse containing: Bible Introduction 0:0</div></div><div><br></div><div>kjvSir1_1 is a RangedPassage and the root of the RangedPassage TreeSet is Sir.1.1 but when trying to extract the first value the TreeSet iterator gets confused and 'Bible Introduction 0:0' is returned. I haven't managed to work out why yet.</div>
<span><font color="#888888">
<div><br></div><div>Martin</div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On 18 April 2014 22:32, Chris Burrell <span dir="ltr"><<a href="mailto:chris@burrell.me.uk" target="_blank">chris@burrell.me.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Reversify just takes a reference and applies it to the other v11n without any mapping.<div>Mapping to Intro.0.0 seems like a bug. Should either map to empty verse range, or null (empty verse range would be my pref).</div>
<div><br></div><div>In your use case, it should map across to Sir.1.1. I suspect it's because the reversify attempts to reversify first to KJV. The reason for having a 'qualifiedKey' wrapper is exactly for this purpose, to preserve the names of keys that aren't recognised, which doesn't seem to happen. We should check the output of reversify and cater for this.</div>
<div><br></div><div>Chris</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On 18 April 2014 22:07, Martin Denham <span dir="ltr"><<a href="mailto:mjdenham@gmail.com" target="_blank">mjdenham@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">With split screens I try to map all verses in the left v11n to whatever the right v11n is and just display 'Not found in document' if the verse is not in the right v11n but I am having a problem with this approach because the verses not in the right v11n are currently being mapped to 'Bible Introduction 0:0'.<div>
<br></div><div>This test hopefully shows the problem:</div><div><div><br></div><div> final VersificationsMapper mapper = VersificationsMapper.instance();</div><div> Verse CathSir1_1 = new Verse(CATHOLIC, BibleBook.SIR, 1, 1);</div>
<div> // map Sirach.1.1 to KJV where it obviously does not exist<br></div><div> Key kjvSir1_1 = mapper.mapVerse(CathSir1_1, KJV);</div><div> // In the debugger the returned RangedPassage appears to contain Sir.1.1<br>
</div><div> // but however I try to get the verse it gets changed to Bible Introduction 0:0<br></div><div> Verse verse1 = KeyUtil.getVerse(kjvSir1_1);</div><div> System.out.println(verse1); // PROBLEM: Bible Introduction 0:0 (not Sir.1.1)</div>
</div><div><br></div><div>Am I trying to do something that can't be done? </div><div><br></div><div>I notice that the v11n mapping code uses QualifiedKey.reversify which has the warning:</div><div><div> /**</div>
<div>
* Convert this QualifiedKey from one Versification to another.</div><div> * This is a potentially dangerous operation that does no mapping</div><div> * from one versification to another. Use it only when it is known</div>
<div> * to be safe.</div></div><div> */</div><div><br></div><div>Thanks</div><span><font color="#888888"><div>Martin</div></font></span></div>
<br></div></div>_______________________________________________<br>
jsword-devel mailing list<br>
<a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
jsword-devel mailing list<br>
<a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
jsword-devel mailing list<br>
<a href="mailto:jsword-devel@crosswire.org">jsword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
<br></blockquote></div><br></div>