NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Mining Validating Shape for Large Knowledge Graphs via Dynamic Reservoir Sampling

Matteo Lissandrini, Kashif Rabbani, Katja HoseSEBD 2024

Introduction

Knowledge Graphs (KGs) such as Wikidata and DBpedia have become foundational for modern AI applications. However, because these graphs are often constructed semi-automatically from diverse sources, they frequently suffer from inconsistencies and noise. While validation languages like SHACL (Shapes Constraint Language) allow developers to define formal schemas to ensure data quality, manually authoring these shapes for massive, evolving datasets is a Herculean task.

The Challenge of Automated Shape Mining

Existing automated tools for mining validation shapes face three critical hurdles:

  1. Incompleteness: Missing essential cardinality constraints (e.g., ensuring a person has exactly one birthdate).
  2. Spuriousness: Incorrectly identifying noise as schema (e.g., if a few musicians are mislabeled as cities, the tool might suggest all cities have "former members").
  3. Scalability: Processing billions of triples often leads to memory exhaustion or prohibitive runtimes on standard hardware.

QSE: Quality Shapes Extraction

To address these issues, the authors propose QSE (Quality Shapes Extraction). QSE operates in two modes: QSE-Exact, which performs a comprehensive four-phase analysis of the KG, and QSE-Approximate, which utilizes a novel sampling strategy to handle massive datasets.

Example of a Knowledge Graph (a) and its extracted SHACL validation shapes (b).

A core innovation of QSE is the use of Support and Confidence metrics. By setting thresholds for how often a constraint appears (Support) and the ratio of entities that follow it (Confidence), QSE can effectively filter out spurious shapes caused by data entry errors.

Scaling with Dynamic Reservoir Sampling (DRS)

The primary breakthrough for scalability is Dynamic Reservoir Sampling (DRS). Unlike standard sampling, DRS maintains a representative "reservoir" for every entity type in the graph. It dynamically resizes these reservoirs as new data is encountered, ensuring that rare entity types are adequately represented while preventing common types from overwhelming system memory. This "neighbor-based" replacement strategy keeps the most informative entities in the sample, allowing QSE to generate accurate shapes without processing every single triple.

Empirical Evaluation and Results

The researchers evaluated QSE against the previous state-of-the-art tool, SheXer, across several major datasets, including DBpedia, YAGO-4, and the massive Wikidata 2021 (Wdt21) dump containing nearly 2 billion triples.

Performance comparison of QSE vs. SheXer across various Knowledge Graphs.

As shown in the performance table, QSE-Exact is approximately 10x faster than SheXer while using significantly less memory. Most notably, on the Wdt21 dataset, SheXer crashed due to memory exhaustion, whereas QSE-Approximate successfully extracted validation shapes in just 1.3 hours using only 32GB of RAM.

Beyond speed, QSE demonstrated immediate practical utility. When applied to DBpedia, the tool identified 20,916 missing triples and 155 erroneous triples, providing a powerful new resource for data curators.

Conclusion

QSE represents a significant advancement in Knowledge Graph maintenance. By combining statistical data mining with dynamic sampling, it enables the automatic generation of high-quality validation schemas for even the largest datasets. Future work will focus on refining threshold sensitivity and expanding the tool's capability to handle more complex logical and path-based constraints.

Summary updated

BibTeX
@inproceedings{lissandrini2024mining,
  author = {Matteo Lissandrini and Kashif Rabbani and Katja Hose},
  title = {{Mining Validating Shape for Large Knowledge Graphs via Dynamic Reservoir Sampling}},
  booktitle = {SEBD},
  year = {2024},
}
Figure