/** * Create book lists for every type of book. */ public static void refreshBooks() { // Create the array of Bibles Map<Book, String> bnames = getBookMap(BookFilters.getOnlyBibles()); ChoiceFactory.getDataMap().put(BIBLE_KEY, bnames); // Create the array of Commentaries Map<Book, String> cnames = getBookMap(BookFilters.getCommentaries()); ChoiceFactory.getDataMap().put(COMMENTARY_KEY, cnames); // Create the array of Dictionaries Map<Book, String> dnames = getBookMap(BookFilters.getDictionaries()); ChoiceFactory.getDataMap().put(DICTIONARY_KEY, dnames); // Create the array of DailyDevotionals Map<Book, String> rnames = getBookMap(BookFilters.getDailyDevotionals()); ChoiceFactory.getDataMap().put(DAILY_DEVOTIONALS_KEY, rnames); // Create the array of Dictionaries Map<Book, String> greekDef = getBookMap(BookFilters.getGreekDefinitions()); ChoiceFactory.getDataMap().put(GREEKDEF_KEY, greekDef); // Create the array of Dictionaries Map<Book, String> hebrewDef = getBookMap(BookFilters.getHebrewDefinitions()); ChoiceFactory.getDataMap().put(HEBREWDEF_KEY, hebrewDef); // Create the array of Dictionaries Map<Book, String> greekParse = getBookMap(BookFilters.getGreekParse()); ChoiceFactory.getDataMap().put(GREEKPARSE_KEY, greekParse); // Create the array of Dictionaries Map<Book, String> hebrewParse = getBookMap(BookFilters.getHebrewParse()); ChoiceFactory.getDataMap().put(HEBREWPARSE_KEY, hebrewParse); }
/** * Get a list of books by CustomFilter specification * * @param filterSpec * The filter string * @return the list of matching books * @see BookFilters#getCustom(java.lang.String) * @see Books */ public static List<Book> getInstalledBooks(String filterSpec) { return getInstalledBooks(BookFilters.getCustom(filterSpec)); }
public List<Book> getBibles() { log.debug("Getting bibles"); List<Book> documents = Books.installed().getBooks(BookFilters.getBibles()); log.debug("Got bibles, Num="+documents.size()); return documents; }
/** * A filter that accepts everything that's not a Bible or a Commentary, when * commentaries are listed with Bibles. * * @return the desired filter */ public static BookFilter getNonBibles() { if (commentariesWithBibles) { return both(new NotBookCategoryFilter(BookCategory.BIBLE), new NotBookCategoryFilter(BookCategory.COMMENTARY)); } return new NotBookCategoryFilter(BookCategory.BIBLE); }
Set<Book> current = CollectionUtil.createSet(new BookFilterIterator(books, BookFilters.getBooksByDriver(driver)));
/** * A filter that accepts everything that implements Bible or Commentary, * when commentaries are listed with Bibles. * * @return the desired filter */ public static BookFilter getBibles() { if (commentariesWithBibles) { return either(new BookCategoryFilter(BookCategory.BIBLE), new BookCategoryFilter(BookCategory.COMMENTARY)); } return new BookCategoryFilter(BookCategory.BIBLE); }
/** * While Bible and Commentary are very similar, a Dictionary is read in a * slightly different way. It is also worth looking at the JavaDoc for Book * that has a way of treating Bible, Commentary and Dictionary the same. * * @throws BookException * @see Book */ public void readDictionary() throws BookException { // This just gets a list of all the known dictionaries and picks the // first. In a real world app you will probably have a better way // of doing this. List<Book> dicts = Books.installed().getBooks(BookFilters.getDictionaries()); Book dict = dicts.get(0); // If I want every key in the Dictionary then I do this (or something // like it - in the real world you want to call hasNext() on an iterator // before next() but the point is the same: Key keys = dict.getGlobalKeyList(); Key first = keys.iterator().next(); System.out.println("The first Key in the default dictionary is " + first); BookData data = new BookData(dict, first); System.out.println("And the text against that key is " + OSISUtil.getPlainText(data.getOsisFragment())); }
public void testFindAllStrongsRef() { List<Book> bibles = Books.installed().getBooks(BookFilters.getBibles()); for (Book book : bibles) { try { if (book.hasFeature(FeatureType.STRONGS_NUMBERS)) { if (!book.getIndexStatus().equals(IndexStatus.DONE)) { System.out.println("Unindexed:"+book); } else { Key resultsH = book.find("+[Gen 1:1] strong:h7225"); //beginning Key resultsG = book.find("+[John 1:1] strong:g746"); //beginning Key resultsGOT = book.find("+[Gen 1:1] strong:g746"); //beginning if (resultsH.getCardinality()==0 && resultsG.getCardinality()==0 && resultsGOT.getCardinality()==0) { System.out.println("No refs returned in"+book.getInitials()); } else { System.out.println("Ok:"+book.getInitials()+" "+resultsH.getCardinality()+"/"+resultsG.getCardinality()+ "/" + resultsGOT.getCardinality()); } // assertTrue("No refs returned in"+book.getInitials(), resultsH.getCardinality()>0 || resultsG.getCardinality()>0); } } } catch (Exception e) { System.out.println("Error:"+book.getInitials()+":"+e.getMessage()); } } }
/** * Get a list of books in a repository by CustomFilter specification * * @param repositoryName * the name of the repository * @param filterSpec * The filter string * @return the list of books * @see BookFilters#getCustom(java.lang.String) * @see Books */ public List<Book> getRepositoryBooks(String repositoryName, String filterSpec) { return getRepositoryBooks(repositoryName, BookFilters.getCustom(filterSpec)); }
/** * Read all the books that we can get our hands on. * * @param args * @throws IOException */ public static void main(String[] args) throws IOException { out = new PrintWriter(new BufferedWriter(new FileWriter("passages.log"))); // Loop through all the Books log.warn("*** Reading all known Books"); BookFilter filter = BookFilters.getCustom("GlobalOptionFilter=ThMLScripref;Category=Biblical Texts"); List<Book> comments = Books.installed().getBooks(filter); for (Book book : comments) { if (!book.isLocked()) { BookMetaData bmd = book.getBookMetaData(); // Skip PlainText as they do not have references marked up if (bmd.getProperty("SourceType") != null) { Key set = book.getGlobalKeyList(); readBook(book, set); } } } out.flush(); out.close(); }