This example shows how to use the Location class to access a verse. A location references a position within the Quranic text by chapter number, verse number or by token number. In this example, we create a new location that references verse (27:30), and then retrieve the verse at this location. By default, the verse will be displayed using Buckwalter transliteration.
Java Example
public class LocationExample { public static void main() { // Get verse (27:30) by location. Location location = new Location(27, 30); Verse verse = Document.getVerse(location); // Display the verse. System.out.println(verse); } }
Program Output
(27:30) <in~ahu, min sulayoma`na wa<in~ahu, bisomi {ll~ahi {lr~aHoma`ni {lr~aHiymi
Discussion
Elements of the orthography model can be accessed directly by chapter number and verse number, or location references can be used. Each chapter, verse and token in the model has a getLocation() accessor which returns the location of the current element.
See Also
- Java API Examples
- Verse (27:30) - the verse in the Quran used above