| 1 |
<%@ page import="jemdros.*" %> |
|---|
| 2 |
<%@ page import="com.qwirx.lex.hebrew.*" %> |
|---|
| 3 |
<%@ page import="com.qwirx.lex.morph.*" %> |
|---|
| 4 |
<form name="nav" method="get"> |
|---|
| 5 |
<table> |
|---|
| 6 |
<tr bgcolor="#ffcccc"><th colspan=4>Navigator</th></tr> |
|---|
| 7 |
<tr bgcolor="#ffeeee"> |
|---|
| 8 |
<th>Book</th> |
|---|
| 9 |
<th>Chapter</th> |
|---|
| 10 |
<th>Verse</th> |
|---|
| 11 |
<th>Clause</th> |
|---|
| 12 |
</tr> |
|---|
| 13 |
<tr bgcolor="#ffcccc"> |
|---|
| 14 |
<td> |
|---|
| 15 |
<select name="book" onChange="document.forms.nav.submit()"> |
|---|
| 16 |
<% |
|---|
| 17 |
|
|---|
| 18 |
String selBook = "Genesis"; |
|---|
| 19 |
|
|---|
| 20 |
{ |
|---|
| 21 |
String selBook2 = (String)( session.getAttribute("book") ); |
|---|
| 22 |
if (selBook2 != null) |
|---|
| 23 |
{ |
|---|
| 24 |
selBook = selBook2; |
|---|
| 25 |
} |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
{ |
|---|
| 29 |
String selBook2 = request.getParameter("book"); |
|---|
| 30 |
if (selBook2 != null) |
|---|
| 31 |
{ |
|---|
| 32 |
selBook = selBook2; |
|---|
| 33 |
} |
|---|
| 34 |
} |
|---|
| 35 |
|
|---|
| 36 |
{ |
|---|
| 37 |
boolean foundBook = false; |
|---|
| 38 |
|
|---|
| 39 |
Table bookTable = emdros.getTable |
|---|
| 40 |
( |
|---|
| 41 |
"SELECT OBJECTS HAVING MONADS IN " + |
|---|
| 42 |
emdros.intersect(userTextAccessSet, min_m, max_m) + |
|---|
| 43 |
" [book]" |
|---|
| 44 |
); |
|---|
| 45 |
|
|---|
| 46 |
StringBuffer id_dList = new StringBuffer(); |
|---|
| 47 |
|
|---|
| 48 |
TableIterator rows = bookTable.iterator(); |
|---|
| 49 |
while (rows.hasNext()) |
|---|
| 50 |
{ |
|---|
| 51 |
TableRow row = rows.next(); |
|---|
| 52 |
id_dList.append(row.getColumn(3)); |
|---|
| 53 |
if (rows.hasNext()) |
|---|
| 54 |
{ |
|---|
| 55 |
id_dList.append(","); |
|---|
| 56 |
} |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|
| 59 |
Table featureTable = emdros.getTable |
|---|
| 60 |
( |
|---|
| 61 |
"GET FEATURES book FROM OBJECTS WITH ID_DS = " + |
|---|
| 62 |
id_dList.toString() + " [book]" |
|---|
| 63 |
); |
|---|
| 64 |
|
|---|
| 65 |
rows = featureTable.iterator(); |
|---|
| 66 |
while (rows.hasNext()) |
|---|
| 67 |
{ |
|---|
| 68 |
TableRow row = rows.next(); |
|---|
| 69 |
String thisBook = row.getColumn(2); |
|---|
| 70 |
|
|---|
| 71 |
if (thisBook.equals(selBook)) |
|---|
| 72 |
{ |
|---|
| 73 |
foundBook = true; |
|---|
| 74 |
Table monadTable = emdros.getTable |
|---|
| 75 |
( |
|---|
| 76 |
"GET MONADS FROM OBJECT WITH ID_D = " + row.getColumn(1) + |
|---|
| 77 |
" [book]" |
|---|
| 78 |
); |
|---|
| 79 |
TableRow monad_row = monadTable.iterator().next(); |
|---|
| 80 |
int new_min_m = Integer.parseInt(monad_row.getColumn(2)); |
|---|
| 81 |
int new_max_m = Integer.parseInt(monad_row.getColumn(3)); |
|---|
| 82 |
if (min_m < new_min_m) min_m = new_min_m; |
|---|
| 83 |
if (max_m > new_max_m) max_m = new_max_m; |
|---|
| 84 |
if (min_m > max_m) max_m = min_m + 1; |
|---|
| 85 |
// System.out.println("book restricts to " + min_m + "-" + max_m); |
|---|
| 86 |
} |
|---|
| 87 |
|
|---|
| 88 |
%> |
|---|
| 89 |
<option <%= |
|---|
| 90 |
thisBook.equals(selBook) ? "SELECTED" : "" |
|---|
| 91 |
%> value="<%= |
|---|
| 92 |
row.getColumn(2) |
|---|
| 93 |
%>"><%= |
|---|
| 94 |
row.getColumn(2) |
|---|
| 95 |
%><% |
|---|
| 96 |
} |
|---|
| 97 |
|
|---|
| 98 |
if (foundBook) |
|---|
| 99 |
{ |
|---|
| 100 |
session.setAttribute("book", selBook); |
|---|
| 101 |
} |
|---|
| 102 |
} |
|---|
| 103 |
|
|---|
| 104 |
%> |
|---|
| 105 |
</select> |
|---|
| 106 |
</td> |
|---|
| 107 |
<td> |
|---|
| 108 |
<select name="chapter" onChange="document.forms.nav.submit()"> |
|---|
| 109 |
<% |
|---|
| 110 |
int selChapNum = 1; |
|---|
| 111 |
|
|---|
| 112 |
{ |
|---|
| 113 |
Integer sessionChapterNum = |
|---|
| 114 |
(Integer)( session.getAttribute("chapterNum") ); |
|---|
| 115 |
if (sessionChapterNum != null) |
|---|
| 116 |
{ |
|---|
| 117 |
selChapNum = sessionChapterNum.intValue(); |
|---|
| 118 |
} |
|---|
| 119 |
} |
|---|
| 120 |
|
|---|
| 121 |
try |
|---|
| 122 |
{ |
|---|
| 123 |
selChapNum = Integer.parseInt(request.getParameter("chapter")); |
|---|
| 124 |
} |
|---|
| 125 |
catch (Exception e) { /* ignore it and use default chapter */ } |
|---|
| 126 |
|
|---|
| 127 |
{ |
|---|
| 128 |
boolean foundChapter = false; |
|---|
| 129 |
|
|---|
| 130 |
Table chapterTable = emdros.getTable |
|---|
| 131 |
( |
|---|
| 132 |
"SELECT OBJECTS HAVING MONADS IN " + |
|---|
| 133 |
emdros.intersect(userTextAccessSet, min_m, max_m) + |
|---|
| 134 |
" [chapter]" |
|---|
| 135 |
); |
|---|
| 136 |
|
|---|
| 137 |
StringBuffer id_dList = new StringBuffer(); |
|---|
| 138 |
|
|---|
| 139 |
TableIterator rows = chapterTable.iterator(); |
|---|
| 140 |
while (rows.hasNext()) |
|---|
| 141 |
{ |
|---|
| 142 |
TableRow row = rows.next(); |
|---|
| 143 |
id_dList.append(row.getColumn(3)); |
|---|
| 144 |
if (rows.hasNext()) |
|---|
| 145 |
{ |
|---|
| 146 |
id_dList.append(","); |
|---|
| 147 |
} |
|---|
| 148 |
} |
|---|
| 149 |
|
|---|
| 150 |
Table featureTable = emdros.getTable |
|---|
| 151 |
( |
|---|
| 152 |
"GET FEATURES chapter FROM OBJECTS WITH ID_DS = " + |
|---|
| 153 |
id_dList.toString() + " [chapter]" |
|---|
| 154 |
); |
|---|
| 155 |
|
|---|
| 156 |
rows = featureTable.iterator(); |
|---|
| 157 |
while (rows.hasNext()) |
|---|
| 158 |
{ |
|---|
| 159 |
TableRow row = rows.next(); |
|---|
| 160 |
int thisChapNum = Integer.parseInt(row.getColumn(2)); |
|---|
| 161 |
|
|---|
| 162 |
if (thisChapNum == selChapNum) |
|---|
| 163 |
{ |
|---|
| 164 |
foundChapter = true; |
|---|
| 165 |
Table monadTable = emdros.getTable |
|---|
| 166 |
( |
|---|
| 167 |
"GET MONADS FROM OBJECT WITH ID_D = " + row.getColumn(1) + |
|---|
| 168 |
" [chapter]" |
|---|
| 169 |
); |
|---|
| 170 |
TableRow monad_row = monadTable.iterator().next(); |
|---|
| 171 |
int new_min_m = Integer.parseInt(monad_row.getColumn(2)); |
|---|
| 172 |
int new_max_m = Integer.parseInt(monad_row.getColumn(3)); |
|---|
| 173 |
System.out.println("before chapter was " + min_m + "-" + max_m); |
|---|
| 174 |
if (min_m < new_min_m) min_m = new_min_m; |
|---|
| 175 |
if (max_m > new_max_m) max_m = new_max_m; |
|---|
| 176 |
if (min_m > max_m) max_m = min_m + 1; |
|---|
| 177 |
System.out.println("chapter restricts to " + min_m + "-" + max_m); |
|---|
| 178 |
} |
|---|
| 179 |
|
|---|
| 180 |
%> |
|---|
| 181 |
<option<%= |
|---|
| 182 |
thisChapNum == selChapNum ? " SELECTED" : "" |
|---|
| 183 |
%>><%= |
|---|
| 184 |
thisChapNum |
|---|
| 185 |
%><% |
|---|
| 186 |
} |
|---|
| 187 |
|
|---|
| 188 |
if (foundChapter) |
|---|
| 189 |
{ |
|---|
| 190 |
session.setAttribute("chapterNum", new Integer(selChapNum)); |
|---|
| 191 |
} |
|---|
| 192 |
} |
|---|
| 193 |
|
|---|
| 194 |
%> |
|---|
| 195 |
</select> |
|---|
| 196 |
</td> |
|---|
| 197 |
<td> |
|---|
| 198 |
<select name="verse" onChange="document.forms.nav.submit()"> |
|---|
| 199 |
<% |
|---|
| 200 |
int selVerseNum = 1; |
|---|
| 201 |
System.out.println("4"); |
|---|
| 202 |
|
|---|
| 203 |
{ |
|---|
| 204 |
Integer sessionVerseNum = |
|---|
| 205 |
(Integer)( session.getAttribute("verseNum") ); |
|---|
| 206 |
if (sessionVerseNum != null) |
|---|
| 207 |
selVerseNum = sessionVerseNum.intValue(); |
|---|
| 208 |
} |
|---|
| 209 |
|
|---|
| 210 |
try |
|---|
| 211 |
{ |
|---|
| 212 |
selVerseNum = Integer.parseInt(request.getParameter("verse")); |
|---|
| 213 |
} |
|---|
| 214 |
catch (Exception e) { /* ignore it and use default chapter */ } |
|---|
| 215 |
|
|---|
| 216 |
{ |
|---|
| 217 |
boolean foundVerse = false; |
|---|
| 218 |
|
|---|
| 219 |
FlatSheaf sheaf = emdros.getFlatSheaf |
|---|
| 220 |
( |
|---|
| 221 |
"GET OBJECTS HAVING MONADS IN " + |
|---|
| 222 |
emdros.intersect(userTextAccessSet, min_m, max_m) + |
|---|
| 223 |
"[verse GET verse, verse_label]" |
|---|
| 224 |
); |
|---|
| 225 |
|
|---|
| 226 |
FlatStrawConstIterator sci = |
|---|
| 227 |
sheaf.const_iterator().next().const_iterator(); |
|---|
| 228 |
|
|---|
| 229 |
while (sci.hasNext()) |
|---|
| 230 |
{ |
|---|
| 231 |
MatchedObject verse = sci.next(); |
|---|
| 232 |
|
|---|
| 233 |
int thisVerseNum = verse.getEMdFValue("verse").getInt(); |
|---|
| 234 |
if (thisVerseNum == selVerseNum) |
|---|
| 235 |
{ |
|---|
| 236 |
foundVerse = true; |
|---|
| 237 |
SetOfMonads som = new SetOfMonads(); |
|---|
| 238 |
verse.getSOM(som, false); |
|---|
| 239 |
min_m = som.first(); |
|---|
| 240 |
max_m = som.last(); |
|---|
| 241 |
// System.out.println("verse restricts to " + min_m + "-" + max_m); |
|---|
| 242 |
} |
|---|
| 243 |
|
|---|
| 244 |
%> |
|---|
| 245 |
<option value="<%= |
|---|
| 246 |
thisVerseNum |
|---|
| 247 |
%>"<%= |
|---|
| 248 |
thisVerseNum == selVerseNum ? " selected=\"selected\"" : "" |
|---|
| 249 |
%>><%= |
|---|
| 250 |
verse.getEMdFValue("verse_label").getString() |
|---|
| 251 |
%></option><% |
|---|
| 252 |
} |
|---|
| 253 |
|
|---|
| 254 |
if (foundVerse) |
|---|
| 255 |
{ |
|---|
| 256 |
session.setAttribute("verseNum", new Integer(selVerseNum)); |
|---|
| 257 |
} |
|---|
| 258 |
} |
|---|
| 259 |
|
|---|
| 260 |
%> |
|---|
| 261 |
</select> |
|---|
| 262 |
</td> |
|---|
| 263 |
<td> |
|---|
| 264 |
<select name="clause" onChange="document.forms.nav.submit()"> |
|---|
| 265 |
<% |
|---|
| 266 |
int selClauseId = 0; |
|---|
| 267 |
System.out.println("5"); |
|---|
| 268 |
|
|---|
| 269 |
{ |
|---|
| 270 |
Integer sessionClauseId = |
|---|
| 271 |
(Integer)( session.getAttribute("clauseId") ); |
|---|
| 272 |
if (sessionClauseId != null) |
|---|
| 273 |
selClauseId = sessionClauseId.intValue(); |
|---|
| 274 |
} |
|---|
| 275 |
|
|---|
| 276 |
try |
|---|
| 277 |
{ |
|---|
| 278 |
selClauseId = Integer.parseInt(request.getParameter("clause")); |
|---|
| 279 |
} |
|---|
| 280 |
catch (Exception e) { /* ignore it and use default chapter */ } |
|---|
| 281 |
|
|---|
| 282 |
MatchedObject verse = null; |
|---|
| 283 |
|
|---|
| 284 |
{ |
|---|
| 285 |
boolean foundSelectedClause = false; |
|---|
| 286 |
int defaultClauseId = 0; |
|---|
| 287 |
HebrewMorphemeGenerator generator = new HebrewMorphemeGenerator(); |
|---|
| 288 |
|
|---|
| 289 |
Sheaf sheaf = emdros.getSheaf |
|---|
| 290 |
( |
|---|
| 291 |
"SELECT ALL OBJECTS IN " + |
|---|
| 292 |
emdros.intersect(userTextAccessSet, min_m, max_m) + |
|---|
| 293 |
" WHERE " + |
|---|
| 294 |
"[clause "+ |
|---|
| 295 |
" [word GET phrase_dependent_part_of_speech, " + |
|---|
| 296 |
" graphical_preformative, " + |
|---|
| 297 |
" graphical_root_formation, " + |
|---|
| 298 |
" graphical_lexeme, " + |
|---|
| 299 |
" graphical_verbal_ending, " + |
|---|
| 300 |
" graphical_nominal_ending, " + |
|---|
| 301 |
" graphical_pron_suffix" + |
|---|
| 302 |
" ]"+ |
|---|
| 303 |
"]"); |
|---|
| 304 |
|
|---|
| 305 |
SheafConstIterator clause_iter = |
|---|
| 306 |
sheaf.const_iterator(); |
|---|
| 307 |
|
|---|
| 308 |
while (clause_iter.hasNext()) |
|---|
| 309 |
{ |
|---|
| 310 |
MatchedObject clause = |
|---|
| 311 |
clause_iter.next().const_iterator().next(); |
|---|
| 312 |
|
|---|
| 313 |
String lexemes = ""; |
|---|
| 314 |
|
|---|
| 315 |
SheafConstIterator word_iter = |
|---|
| 316 |
clause.getSheaf().const_iterator(); |
|---|
| 317 |
|
|---|
| 318 |
while (word_iter.hasNext()) |
|---|
| 319 |
{ |
|---|
| 320 |
MatchedObject word = word_iter.next().const_iterator().next(); |
|---|
| 321 |
|
|---|
| 322 |
lexemes += HebrewConverter.wordTranslitToHtml(word, generator); |
|---|
| 323 |
|
|---|
| 324 |
if (word_iter.hasNext()) |
|---|
| 325 |
{ |
|---|
| 326 |
lexemes += " "; |
|---|
| 327 |
} |
|---|
| 328 |
} |
|---|
| 329 |
|
|---|
| 330 |
int thisClauseId = clause.getID_D(); |
|---|
| 331 |
if (thisClauseId == selClauseId) |
|---|
| 332 |
{ |
|---|
| 333 |
foundSelectedClause = true; |
|---|
| 334 |
} |
|---|
| 335 |
|
|---|
| 336 |
if (defaultClauseId == 0) |
|---|
| 337 |
{ |
|---|
| 338 |
defaultClauseId = thisClauseId; |
|---|
| 339 |
} |
|---|
| 340 |
|
|---|
| 341 |
%> |
|---|
| 342 |
<option value=<%= |
|---|
| 343 |
thisClauseId |
|---|
| 344 |
%><%= |
|---|
| 345 |
thisClauseId == selClauseId ? " SELECTED" : "" |
|---|
| 346 |
%>><%= |
|---|
| 347 |
lexemes |
|---|
| 348 |
%><% |
|---|
| 349 |
} |
|---|
| 350 |
|
|---|
| 351 |
if (!foundSelectedClause) |
|---|
| 352 |
{ |
|---|
| 353 |
selClauseId = defaultClauseId; |
|---|
| 354 |
} |
|---|
| 355 |
|
|---|
| 356 |
session.setAttribute("clauseId", new Integer(selClauseId)); |
|---|
| 357 |
} |
|---|
| 358 |
|
|---|
| 359 |
%> |
|---|
| 360 |
</select> |
|---|
| 361 |
</td> |
|---|
| 362 |
</tr> |
|---|
| 363 |
</table> |
|---|
| 364 |
</form> |
|---|