Building Bridges of Knowledge: Uniting Islamic Literature in a Comprehensive Graph Database

Islam&AI
8 min readApr 6, 2024

--

بِسْمِ ٱللَّهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ

Since the start of Islam&AI, our goal has been to provide ease of access to Islamic knowledge to everyone around the globe!

A small effort in that regard was to make a chatbot that would utilize the latest AI technology and answer queries relating to Islam ranging from daily life to complex ones, but the main goal is still far from being achieved

Islamic literature, spanning from the Quran to Hadith and beyond, embodies centuries of wisdom, guidance, and spiritual insight. Yet, accessing and navigating this vast treasure of knowledge can often be challenging. In our digital age, where information is abundant but organization is key, there arises a compelling need to unite Islamic literature in a structured and accessible manner.

We have been trying to cover it somehow and make a single database that encompasses everything, which resulted in the vision of creating a single comprehensive Graph Database that joins all aspects of Islamic literature, providing a seamless pathway for seekers of knowledge.

We feel that a single Graph Database might be the solution for a variety of reasons:

  1. Promotion of Unity: By bringing together diverse sources of Islamic literature in a unified database, we promote unity within the Muslim community. Regardless of cultural background, all users can benefit from shared access to a wealth of knowledge and wisdom.
  2. Accessibility: Creating a single, comprehensive database allows for easier access to Islamic literature for scholars, students, and enthusiasts worldwide. Rather than searching through multiple sources, users can find all relevant information in one centralized location.
  3. Interconnectedness: By modeling Islamic literature as a graph database, we can highlight the interconnectedness of various texts, such as how Quranic verses relate to each other, or how Hadiths provide context for Quranic teachings. This approach fosters a deeper understanding of the holistic nature of Islamic knowledge.
  4. Holistic Learning: A unified database enables users to explore Islamic literature holistically, facilitating comprehensive learning and research. Users can trace themes across different texts, understand historical contexts, and engage with diverse interpretations, enriching their understanding of Islam.
  5. Efficiency: Consolidating Islamic literature into a single database streamlines the research process and saves time for scholars and students. Instead of navigating disparate sources, users can quickly find relevant information, enhancing their productivity and efficiency.
  6. Quality Control: Centralizing Islamic literature in a single database allows for better quality control and standardization of content which is very important when it comes to Islamic knowledge. Through rigorous review processes and community contributions, we can ensure the accuracy and authenticity of the information presented.
  7. Collaborative Platform: Building a comprehensive database provides a collaborative platform for scholars, researchers, and community members to contribute their knowledge and insights. This collective effort fosters a sense of community and fosters the exchange of ideas and interpretations.
  8. Preservation of Knowledge: Digitizing and centralizing Islamic literature helps preserve valuable knowledge for future generations. By ensuring the longevity and accessibility of these texts, we contribute to the ongoing legacy of Islamic scholarship and learning.
  9. Global Reach: A single database accessible online allows users from diverse backgrounds and geographic locations to engage with Islamic literature. This global reach promotes cross-cultural understanding and dialogue, fostering a more interconnected and informed global community.
  10. Educational Resource: The comprehensive database serves as a valuable educational resource for Islamic schools, universities, and educational institutions worldwide. Teachers and students can utilize the platform for teaching, research, and academic pursuits.

The Vision

Imagine a digital repository where every Ayat, Surah, Hadith, Tafseer, Translation, and Event is interconnected in a web of knowledge. This graph database would not only serve as a reservoir of Islamic literature but also as a dynamic platform for exploration, analysis, and discovery. From understanding the relationships between Quranic verses to tracing the historical context of Hadith, this database would empower scholars, students, and enthusiasts to delve deeper into the teachings of Islam with ease and clarity.

The Approach

At the heart of this ambitious endeavor lies the utilization of graph database technology. By modeling Islamic literature as nodes and their relationships as edges, we can construct a rich and versatile framework that captures the essence of interconnectedness. Each Ayat becomes a node, linked to its parent Surah, associated Hadith, translations in multiple languages, relevant Tafseer, and contextual events. Similarly, Surahs are nodes connected to their constituent Ayats, thematic Tafaseer, historical events, and more. This approach not only preserves the integrity of individual texts but also illuminates their interconnected meanings in the broader fabric of Islamic knowledge.

While contemplating this methodology, we encountered remarkable work accomplished by a non-Muslim individual. He adeptly leveraged hadith databases sourced from various online platforms to construct an aesthetically pleasing graph structure. His work enabled the visualization of Hadith Data elegantly, including complex details such as the Sanad (the chain of narrators), the temporal aspects of their birth and demise, and a whole lot of additional information!

You can see his work on GitHub “here” & his blogpost “here

The datasets for hadith can be found in his work mentioned above

A few images from his work are attached below

Hadith and its Sanad which mentions the word “alcohol”
Narration network for Isma’il bin Ja’far
25 scholars, their birth & death place

As you can see, by utilizing graphs we can visualize Islamic knowledge elegantly, making it easy to understand for everyone! As mentioned this work is done by a non-Muslim, who was only playing with graph databases and wanted to utilize them somewhere, when he stumbled upon this data (you can read about why he made this in his blog post linked above)

If this was achieved using only the Hadith database, imagine what can be done if we can encompass the whole of Islamic Literature!

Tentative Structure

We have come up with a tentative structure that needs to be populated with information before we can successfully make such graphs that encompass the Islamic literature

Ayat Structure
{
"ayat_id": 41
"ayat_number": 34,
"surah_number": 2,
"ruku_number": 5,
"text": "وَإِذْ قُلْنَا لِلْمَلَٰٓئِكَةِ ٱسْجُدُوا۟ لِءَادَمَ فَسَجَدُوٓا۟ إِلَّآ إِبْلِيسَ أَبَىٰ وَٱسْتَكْبَرَ وَكَانَ مِنَ ٱلْكَٰفِرِينَ",
"place_of_origin": "Madina",
"time_of_origin": "Early Madinan period (Hijri)",
"event_of_origin": "what was happening when this ayat revealed",
"translations": {
"English": [english_id1, english_id2, …],
"Urdu": [urdu_id1, urdu_id2, …],

// Add more translations if needed
},
"tafaseers": [
"English": [english_id1, english_id2, …],
"Urdu": [urdu_id1, urdu_id2, …],

// Add more tafaseers if needed
],
"related_ayats": [
965, 1830, …
// Add more related ayats if needed
],
"related_hadees": [
hadees_id1, hadees_id2, …
// Add more related hadees if needed
],
"related_events": [
event_id1, event_id2, …
// Add more events if needed
],
"related_videos": [
video_id1, video_id2, …
// Add more videos if needed
]
}

Surah structure
{
"surah_id": 1,
"name": "الفاتحة",
"name_english": "Al-Fatiha",
"revelation_place": "Makkah",
"revelation_order": 5,
"total_verses": 7,
"revealed_in": "1 BH - Before Hijrah",
"main_theme": "Introduction to the Quran, Praise and Prayer, Seeking Guidance",
"related_ayats": [1, 2, 3, 4, 5, 6, 7]
}

Hadees Structure
{
"hadees_id": "1",
"source": "Sahih al-Bukhari",
"chapter_number": 1,
"hadith_number": 1,
"chapter_name": "Revelation - كتاب بدء الوحى",
"hadees_level": "Sahih",
"rawi_ids": [ 30418, 20005, 11062, 11213, 11042, 3 ],
"text": “حَدَّثَنَا الْحُمَيْدِيُّ عَبْدُ اللَّهِ بْنُ الزُّبَيْرِ ، قَالَ : حَدَّثَنَا سُفْيَانُ ، قَالَ : حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ ال……”,
"place_of_origin": "Madina",
"time_of_origin": "Early Madinan period (Hijri)",
"event_of_origin": "what was happening when this ayat revealed",
"tafaseers": [
"English": [english_id1, english_id2, …],
"Urdu": [urdu_id1, urdu_id2, …],

],
"translations": {
"English": [english_id1, english_id2, …],
"Urdu": [urdu_id1, urdu_id2, …],

},
"related_ayats": [
965, 1830, …
],
"related_hadees": [
hadees_id1, hadees_id2, …
],
"related_events": [
event_id1, event_id2, …
],
"related_videos": [
video_id1, video_id2, …
],
}

Rawi Structure
{
"rawi_id": "1",
"name": "Prophet Muhammad (صلى الله عليه وسلم)",
"grade": "Rasool Allah",
"parents": "Abdullah ibn 'Abd al-Muttalib / Amina bint Wahb b 'Abd Munaf bin Zuhrah",
"spouse": "Khadijah, Sawda bint Zam'a, 'Aisha bint Abi Bakr, Hafsa bint Umar, Zaynab bint Khazeemah, Umm Salamah, Zaynab bint Jahsh, Juwayriya bint al-Harith, Umm Habibah bint Abi Sufyan, Safiyya bint Huyayy, Maymuna bint al-Harith, Maria al-Qibtiyya",
"siblings": [],
"children": "al-Qasim bin Muhammad, Zaynab bint Muhammad, Ruqayyah bint Muhammad, Umm Kulthum bint Muhammad, Fatima bint Muhammad, Abdullah bin Muhammad, Ibrahim bin Muhammad",
"birth_date_place": "53 BH/570 CE (9th Rabi' awwal) (Makkah)",
"places_of_stay": ["Makkah", "Medina"],
"death_date_place": "11 AH/632 CE (12th Rabi' awwal (Medina)[ Natural ])",
"teachers": "Abu Bakr As-Siddique, 'Umar ibn al-Khattab, 'Uthman ibn 'Affaan, Ali ibn Abi Talib, Talha ibn 'Ubaidullah, Zubayr ibn al-Awwam, 'Abdur Rahman Ibn 'Awf, Sa'd ibn Abi Waqqas, Abu 'Ubaidah ibn al-Jarrah, ibn Mas'ud, ibn Abbas, ibn Umar, Anas bin Malik, 'Aisha bint Abi Bakr, Umm Salamah",
"students": [],
"area_of_interest": "Tafsir/Quran, Recitation/Quran, Hadith, Commander, Reformer",
"tags": ["Quraish", "B.Hashim", "Prophet", "Rasool", "Badr", "Uhud", "Khandaq"],
"books": [],
"students_inds": ["2", "3", "4", "5", "6", "7", "8", "9", "10", "16", "17", "18", "19", "53", "56"],
"teachers_inds": [],
"birth_place": "Makkah",
"birth_date": "9th Rabi' awwal, Makkah",
"birth_date_hijri": ["53 BH", "570 CE"],
"birth_date_gregorian": "570",
"death_date_hijri": "11",
"death_date_gregorian": "632",
"death_place": "12th Rabi' awwal (Medina)",
"death_reason": "Natural"
}

Tafaseer Structure
{
"tafseer_id": "1",
"author": "Ibn Kathir",
"language": "Urdu",
"text": "Explanation of the Ayat/Hadees by Ibn Kathir...",
"related_ayat": 12,
"related_hadees": 12, //either ayat or hadees
}

Translation Structure
{
"translation_id": "1",
"author": "Ibn Kathir",
"language": "English",
"text": "Translation of the Ayat/Hadees in English..."
"related_ayat": 12,
"related_hadees": 100 //either ayat or hadees
}

Event Structure
{
"event_id": "1",
"name": "Battle of Badr",
"description": "Description of the event..."
"related_ayat": 12,
"related_hadees": 100 //either ayat or hadees
}


Video Structure
{
"video_id": "1",
"title": "Introduction to Surah Al-Fatiha",
"url": "https://www.youtube.com/watch?v=example",
"related_ayats": [1, 2, 3, 4, 5, 6, 7],
"related_hadees": [...]
}

Of course, this is just a starting point

In an era marked by technological advancement and digital connectivity, the potential to harness these tools for the betterment of society is boundless. By uniting Islamic literature in a comprehensive graph database, we not only preserve our rich intellectual heritage but also pave the way for future generations to explore, learn, and grow.

Let us embark on this journey together, hand in hand, as we build bridges of knowledge that span the breadth of Islamic wisdom.

Call to Action

We extend an open invitation to Muslims from all walks of life to join us in this noble endeavor. Whether you are a scholar well-versed in Islamic literature, a developer proficient in database management, or simply a passionate seeker of knowledge, your contributions are invaluable.

Together, we can build a bridge of understanding that transcends borders, languages, and cultures, making Islamic literature accessible and comprehensible to all.

مَنْ أَنصَارِىٓ إِلَى ٱللَّهِ

Ramadan 27, 1445 AH

Link to Dataset: https://www.kaggle.com/datasets/alizahidraja/quran-nlp

Link to discord: https://discord.gg/zzgaAMbKN9

Link to website: https://islamandai.com/

--

--

Islam&AI

Empowering Islamic Education with Artificial Intelligence