Enabling Complex Wikipedia Queries - Technical Report
Abstract
Researchers from Ben-Gurion University have developed and released a specialized relational database schema designed to make Wikipedia’s massive dataset easily queryable for complex research tasks. By structuring raw Wikipedia data into a relational format that includes paragraph hierarchies, link positions, and stemmed anchor text, they enable researchers to perform sophisticated information retrieval and data mining tasks using standard SQL on a single laptop.
The Challenge of Unstructured Wikipedia Data
Wikipedia is an invaluable resource for fields ranging from sociology to computer science, but its raw data is notoriously difficult to work with. While the English Wikipedia contains millions of entries, its standard XML dumps are unstructured and massive. Researchers who want to perform "complex queries"—such as finding links located specifically in the first paragraph of a page or analyzing the anchor text of redirects—typically have to write custom, one-off parsers or set up heavy "Big Data" infrastructure like Hive or NoSQL clusters. This report addresses the need for a standardized, accessible, and highly granular relational structure that allows researchers to extract deep insights without the overhead of complex data engineering.
A Granular Relational Schema
The authors chose to represent Wikipedia using a relational database (SQL), arguing that for a dataset of this size (~50GB), the benefits of primary/foreign keys, data verification, and indexing far outweigh the perceived need for distributed "Big Data" solutions.
The schema consists of five core tables:
- Tbl_Wiki_Page: The master list of pages, including titles, file paths to raw text, and page types (entity, redirect, or category).
- Tbl_Wiki_Page_Redirect: Maps redirect titles to their actual entity IDs.
- Tbl_Wiki_Page_Categories: A many-to-many mapping of pages to their respective categories.
- Tbl_Wiki_Page_Links: Detailed information on every link, including the source/target IDs, the exact character offset (position) in the page, and the anchor text.
- Tbl_Wiki_Page_Paragraphs: A structural map of each page, including paragraph indices, character offsets, and hierarchy levels (e.g., identifying sub-paragraphs).
A notable addition is the inclusion of stemmed fields (using the Lovins Stemmer). By storing pre-stemmed versions of titles and anchor text, the schema allows for immediate use in Information Retrieval (IR) tasks where word-form normalization is required.
Dataset and the "Laptop-Scale" Philosophy
The report utilizes the English Wikipedia, which at the time of writing contained over 4.6 million pages. The authors provide the schema and the processed content (approximately 50GB, including indices) for public download.
One of the most significant insights in the paper is the rejection of "Big Data" for the sake of it. Since Wikipedia’s growth is linear rather than exponential, the authors argue that a well-indexed relational database on a standalone server (or even a high-end laptop) is more efficient for most researchers than a distributed NoSQL environment.
Key Insights and Results
The authors explicitly designed the schema to track where information appears, operating on the assumption that content in the lead paragraph or a top-level section is more significant than content buried in a sub-section. By enforcing primary and foreign keys on Wikipedia's often messy internal link structure, the authors provide a "cleaned" version of the data that prevents common errors in graph analysis.
The power of the schema was demonstrated through several use-case SQL queries that would be extremely difficult to execute on raw XML:
- Category Filtering: Identifying all pages within a specific category via a simple
JOIN. - Link Analysis between Groups: Finding all links from one specific set of pages to another.
- Structural Extraction: A query that identifies all pages pointed to specifically from the second paragraph of a given entry.
Conclusion and Future Work
The primary limitation acknowledged by the authors is that the schema is static, based on a specific Wikipedia dump. To address this, the authors are working on documenting and releasing the processing code used to generate the database. This will allow other researchers to run the pipeline against the most recent Wikipedia dumps to create their own up-to-date relational versions.
Summary updated