PersistenceManager pm = PMF.get().getPersistenceManager();
try {
Section section = getSection(chapterNo, verseNo, pm);
JSONObject verses = getYaqbVerse(section);
Verse previousVerse=null;
String previousTransliteration="";;
for (int i=section.getStartVerse();i<=section.getEndVerse();i++) {
JSONObject versions=verses.getJSONObject("" + section.getChapterNo() + ":" + i);
String arabic = getTanzilText(section.getChapterNo(), i);
String transliteration = versions.getString("Transliteration");
transliteration=transliteration.replaceAll("[A][A]", "'");
transliteration=transliteration.replaceAll("[<][b][>]", "<s>");
transliteration=transliteration.replaceAll("[ ][<][/][b][>]", "</s>");
transliteration=transliteration.replaceAll("[<][/][b][>]", "</s>");
transliteration=transliteration.replaceAll("[<][s][t][r][o][n][g][>]", "<s>");
transliteration=transliteration.replaceAll("[<][/][s][t][r][o][n][g][>]", "</s>");
String token="" + section.getChapterNo() + ":" + i;
String translation = versions.getString(TRANSLATOR);
if ("Free_Minds".equals(TRANSLATOR)) {
translation=translationParser.getTranslations().get(token).trim();
}
TreeSet<String> topicList = translationParser.getVerseTopics().get(token);
String topics = flattenStringCollection(topicList);
transliteration = repairShiftedTransliteration(arabic,
transliteration);
Verse verse=section.getVerse(chapterNo,i);
if (null==verse) {
verse=new Verse();
section.addVerse(verse);
}
verse.setChapterNo(chapterNo);
verse.setVerseNo(i);
verse.setText(arabic);
verse.setUthmani(getTanzilUthmani(section.getChapterNo(), i));
verse.setTransliteration(transliteration);
verse.setTranslation(translation);
verse.setTopics(topics);
pm.makePersistent(verse);
if (previousTransliteration.equals(transliteration)) {//suspicious;
repairTransliteration(verse);
repairTransliteration(previousVerse);
}