6 ms·
You can download an xml or sql file from here https://tanzil.net/download/ https://tanzil.net/download/ They also provide metadata for download https://tanzi
by hsn915 5y ago
You can download an xml or sql file from here
https://tanzil.net/download/ https://tanzil.net/download/
They also provide metadata for download
https://tanzil.net/docs/Quran_Metadata https://tanzil.net/docs/Quran_Metadata
If you instead send an http request to antoher server, you are just introducing a pointless dependency in your system. It will make your system generally slower because it will take more time to get answers. There's absolutely no benefit.
- friendly_chap 5y agoI can think of a few: - type safe clients provided by M3o - reducing app/webapp/binary space by relying on APIs to get a subset of the content you need - a web interface to query the data There are probably a few more, YMMV
- hsn915 5y agoHow is it type safe? Type safety is worse for http calls because you literlly have no idea at compile time what the data will be. Where as, when all the data is in your repository, you can verify the data matches what you expect. Reudcing space? Really? The data is actually very small. Your npm modules take a lot more space. If anything is really cheap and not worth worrying about, it's disk space.
- schoen 5y agoAbove I suggested that reducing space could sometimes be relevant -- I think interactive maps are a very familiar example, although offline maps are great for privacy and for being able to use them in the wilderness. Even though I don't think that the Quran API will benefit many applications, you could probably envision some, like very tiny embedded systems that don't have even megabytes of spare local storage (but do have some kind of user interface).
- friendly_chap 5y agoHave a look at the Go clients for example. There are proper type safe clients for each API generated form our protobuf definitions. > Type safety is worse for http calls because you literlly have no idea at compile time what the data will be. We promise we will return data as per API spec ;) > The data is actually very small For this particular example, I guess you are right. Our vision is that all APIs will have uniform clients, docs etc, so in aggregate it will provide a very convenient workflow. So instead of downloading a.json and b.xml and c.yaml (if possible at all due to size) and defining data structures yourself, just import our library and you are good to go. But as I said, YMMV. If it's not your cup of tea, I understand that too.
- schoen 5y ago> We promise we will return data as per API spec ;) Unfortunately, I don't think that an assumption about the data that's returned from a web API based on a developer's statement on an online forum is really what's meant by "type safety". :-)
- hsn915 5y ago> We promise we will return data as per API spec ;) ok sure, but that does not mean that "type safety" is an advantage of using your API.
- asim 5y agoSometimes its a preference of use. If the API is simple and easy to use, if it provides translations and transliterations you prefer, if it means not needing to process xml or sql which I believe a lot of us would prefer not to do.
- schoen 5y agoSure, at the cost of having something that usually has a higher latency for lookups, that only works online, that could have outages due to data center or network problems, that could get hacked and made to return corrupted data, and that may or may not be available forever. Those seem like pretty high costs to me mainly to avoid processing a local database. Especially if someone could wrap the local database with a library that has the same interface as the network API! (That library could stop being maintained, but the failure modes are much narrower than the failure modes of a network service.) A lot of the comments in this thread are suggesting that an API to search small public data is not a very productive approach compared to having that data present locally in programs that will use it. I can think of lots of advantages that network APIs could have: * querying nonpublic data (including nonpublic data that the end user is fully entitled to access all of, but doesn't want to cache on a mobile device because of its sensitivity) * applying a sophisticated algorithm to the data * offloading computation or storage to a more powerful device * dealing with frequent updates or edits to the data * ... However, none of those seem to apply readily to the case of searching a specific religious or literary text, because downloading the complete text is usually a very practical option. (I guess the "nonpublic data" part could also apply because some of the translations and transliterations and associated information might be under copyright, and the copyright holder might choose to authorize the API but not authorize bulk downloads of the database. That could also be true for modern commentaries and annotations.) The only other one that comes to mind for me in terms of people's enthusiasm for this API approach (and indeed in the comment I'm replying to) is * developers are very used to querying web APIs (and don't like writing their own parsers) That's fair, but I feel like it's best mitigated by having someone develop a reliable library for parsing a particular database or dataset, with a nice API that the developers will be happy with.
- anosidium 5y agoSo the entire Qur'an in XML or SQL file? Is that how some Qur'an apps are able to provide offline reading?
- donkeybeer 5y agoI hope my question isn't seen as rude, but have you worked on a non-web app before? Its been the natural thing to bundle all data needed offline and locally along with the app throughout history. I emphasize I don't mean to sound rude, your question just felt surprising to me. (It seems you are been downvoted and I gave you an up personally.)
- anosidium 5y agoNo offence taken and I appreciate the upvote. I am a macOS/iOS developer. I expected the Qur'an to be bundled with the app but I wondered about the technical nature. How it is actually done? It could be a database file or a text file etc. There are many ways to accomplish this.
- schoen 5y agoProbably so! Here's a list of electronic text resources for the Christian Bible https://hackathon.bible/data/ https://hackathon.bible/data/ of which (surprisingly to me) many are also APIs rather than downloads. But there are lots of downloads like XML and text files. One that I found of the King James Version translation has lines like Gen|4|26| And to Seth, to him also there was born a son; and he called his name Enos: then began men to call upon the name of the LORD.~ i.e. book of Genesis, chapter 4, verse 26, followed by an ASCII string of that verse. The Quran download mentioned in the grandparent comment at https://tanzil.net/download/ https://tanzil.net/download/ includes text files with lines like 2|150|ﻮَﻤِﻧْ ﺢَﻴْﺛُ ﺥَﺮَﺠْﺗَ ﻑَﻮَﻟِّ ﻮَﺠْﻬَﻛَ ﺶَﻃْﺭَ ﺎﻠْﻤَﺴْﺟِﺩِ ﺎﻠْﺣَﺭَﺎﻣِ ۚ ﻮَﺤَﻴْﺛُ ﻡَﺍ ﻚُﻨﺘُﻣْ ﻑَﻮَﻟُّﻭﺍ ﻮُﺟُﻮﻬَﻜُﻣْ ﺶَﻃْﺮَﻫُ ﻞِﺌَﻟَّﺍ ﻲَﻛُﻮﻧَ ﻞِﻠﻧَّﺎﺳِ ﻊَﻠَﻴْﻜُﻣْ ﺢُﺟَّﺓٌ ﺈِﻟَّﺍ ﺎﻟَّﺬِﻴﻧَ ﻆَﻠَﻣُﻭﺍ ﻢِﻨْﻬُﻣْ ﻒَﻟَﺍ ﺖَﺨْﺷَﻮْﻬُﻣْ ﻭَﺎﺨْﺷَﻮْﻨِﻳ ﻮَﻟِﺄُﺘِﻣَّ ﻦِﻌْﻤَﺘِﻳ ﻊَﻠَﻴْﻜُﻣْ ﻮَﻠَﻌَﻠَّﻜُﻣْ ﺖَﻬْﺗَﺩُﻮﻧَ i.e. surah 2, ayah 150, followed by a Unicode string of the text of that ayah. (There's no "book" field because of the sufficiency of the surah numbers.) This file is about 1.3 megabytes uncompressed, although of course it doesn't include additional data that a user might want to have presented (the transliterations or translations mentioned elsewhere in this thread, for example). There are probably lots of mobile apps that have graphics files alone that are larger than this 1.3 megabyte Quran text file. (Not that mobile apps are the only application for the APIs or anything.) Another online text at https://www.sacred-texts.com/isl/htq/index.htm https://www.sacred-texts.com/isl/htq/index.htm gives each surah in a separate file (less convenient for downloading, although you could still do it in a few minutes!), so that ayah is 150 وَمِنْ حَيْثُ خَرَجْتَ فَوَلِّ وَجْهَكَ شَطْرَ ٱلْمَسْجِدِ ٱلْحَرَامِ ۚ وَحَيْثُ مَا كُنتُمْ فَوَلُّوا۟ وُجُوهَكُمْ شَطْرَهُۥ لِئَلَّا يَكُونَ لِلنَّاسِ عَلَيْكُمْ حُجَّةٌ إِلَّا ٱلَّذِينَ ظَلَمُوا۟ مِنْهُمْ فَلَا تَخْشَوْهُمْ وَٱخْشَوْنِى وَلِأُتِمَّ نِعْمَتِى عَلَيْكُمْ وَلَعَلَّكُمْ تَهْتَدُونَ There's some kind of Unicode issue where the letters in the second version seem to be connecting better (e.g. مَا rather than ﻡَﺍ), but my knowledge of Arabic isn't enough to make it obvious to me whether the second one is a more correct encoding or the first one is just making more assumptions about the rendering or something.
- foobarian 5y agoIf you use the API, the service maintainer can transparently to you switch to a better storage format, or query engine, or invent a whole new CMS.
- bastawhiz 5y agoYour phone can scan the whole dump in-memory, byte by byte faster than your eyes can blink. If the query engine is the problem, you've chosen a very bad query engine.
- hasmanean 5y agoYeah and technically the Quran has a lot of repetition too so it compresses well. It’s so easy to memorize that 13 year old kids routinely do it. Don’t think it’s possible? There are 114 suras. The longest one is like the screenplay of Star Wars, something many of know by heart even if we can’t recite it. The smallest bunch of suras resemble song lyrics. Most people have memorized considerably more than 114 songs. Replaying them just requires the right stimulus.
- Zababa 5y ago> If you instead send an http request to antoher server, you are just introducing a pointless dependency in your system. It will make your system generally slower because it will take more time to get answers. There's absolutely no benefit. To expand on that, here downloading the file is a way of caching the data. Caching invalidation can be tricky, but for something like this it's actually easy, so you can afford all the benefits of a cache.
- bastawhiz 5y agoWhat about the Quran is changing often enough for cache invalidation to be a problem?
- weird-eye-issue 5y ago"Caching invalidation can be tricky, but for something like this it's actually easy"
- bastawhiz 5y agoThe point is that you shouldn't need it at all. There's nothing to invalidate. You don't even need to cache it because there's nothing complex enough to cache. The full dataset is tiny. Adding caching might make it slower, because the cost of computing the data is less than the cost of a cache miss.
- Zababa 5y agoMy point was that downloading the whole thing compared to using the API could be thought as a form of caching. Since it's with data that doesn't change much, the usual difficulty that comes with caching is not here.
- Zababa 5y agoFrom my limited understanding, not much which is why I think caching is safe in that case.