An Evolutionary Algorithm to Learn SPARQL Queries for Source-Target-Pairs: Finding Patterns for Human Associations in DBpedia

Jörn Hees, Rouven Bauer, Joachim Folz, Damian Borth, Andreas Dengel · DOI

Abstract

Discovering relationships within massive Linked Data repositories like DBpedia is a significant challenge for non-experts due to the complexity of SPARQL and the underlying data schemas. This paper presents an evolutionary algorithm designed to automatically learn SPARQL Basic Graph Patterns (BGPs) from sets of source-target example pairs. By treating graph patterns as individuals in a population, the system evolves queries that can capture both well-defined relations and "fuzzy" human associations. Our results demonstrate that the algorithm can re-identify simple relations with 100% accuracy and significantly outperforms graph-topology baselines in modeling human word associations.

Introduction

The Semantic Web has grown to encompass billions of facts, yet the barrier to entry for querying this data remains high. To extract meaningful relationships from datasets like DBpedia, a user must possess deep knowledge of specific vocabularies, modeling styles, and the inherent noise of real-world data.

This research addresses the problem of relationship discovery: given a list of examples that share a common but unknown relationship (e.g., "Berlin → Germany"), how can we automatically find the underlying graph patterns that connect them? This is particularly difficult when the relationships are complex or inconsistently modeled, such as the intuitive associations found in human language. We propose an Evolutionary Graph Pattern Learner to bridge this gap between example pairs and structured SPARQL queries.

Methodology

1. Evolutionary Framework

The system treats the search for a SPARQL query as an optimization problem solved via an evolutionary algorithm.

  • Representation: Each individual in the population is represented as a SPARQL Basic Graph Pattern (BGP).
  • Fitness Function: Patterns are evaluated using a multi-dimensional fitness tuple. This includes Recall (the proportion of example pairs the pattern successfully connects), Precision (the ratio of correct targets to total results returned), and Pattern Length (where shorter, more parsimonious patterns are favored).
  • Evolutionary Operators:
    • Mating (Crossover): Two parent patterns exchange triple patterns to produce offspring.
  • Mutation: The algorithm can add or delete triples, or split and merge variables. A specialized "Fix Var Mutation" queries the live database to replace vague variables with actual IRIs or literals, effectively "grounding" the pattern in real data.

2. Coverage and Diversity

To prevent the algorithm from converging on a single "best" pattern that only explains a subset of the data, we implement an iterative coverage mechanic. After a successful run, the example pairs covered by the resulting pattern are devalued. Subsequent generations are then incentivized to focus on the "leftover" pairs, eventually building a comprehensive library of patterns that collectively explain the entire dataset.

3. Scalability and Optimization

Querying DBpedia (containing over 7.9 billion triples) in an evolutionary loop is computationally expensive. To maintain performance, the system utilizes batch queries, strict timeouts, and aggressive client-side caching to minimize the load on the SPARQL endpoint.

Experimental Setup

We evaluated the algorithm using two primary datasets:

  1. Capital-Country Pairs: A "ground truth" dataset of well-modeled relations used to verify the algorithm's ability to identify basic semantic links.
  2. Edinburgh Associative Thesaurus (EAT): A dataset of human word associations (e.g., "Pupil" → "Eye"). We utilized 727 strong associations previously mapped to DBpedia entities to test the system's ability to capture "fuzzy" human logic.

Results and Discussion

Performance on Simple Relations

The algorithm demonstrated high efficiency on structured data, achieving 100% success in re-identifying simple relations like capital cities within the first three minutes of execution.

Modeling Human Associations

On the more challenging EAT dataset, the system achieved a Mean Average Precision (MAP) of 39.9% and a Recall@10 of 63.9%. These results indicate that even seemingly intuitive human associations often follow discoverable graph patterns, such as gold:hypernym links or bidirectional dbo:wikiPageWikiLink properties.

Comparison to Baselines

The evolutionary approach significantly outperformed standard graph-based measures, including PageRank, HITS, and simple in/out-degree metrics. This suggests that specific, learned SPARQL patterns are far more effective at capturing semantic meaning than general graph topology alone.

Conclusion and Future Work

This research demonstrates that evolutionary algorithms are a viable path for automated relationship discovery in Linked Data. By evolving SPARQL queries from examples, we can uncover the hidden logic behind both structured facts and human associations.

Future iterations of the system will focus on incorporating Literals (text, numbers, and dates) into the learning process and introducing FILTER constraints to allow for more granular query generation. Additionally, we aim to explore more sophisticated "late fusion" techniques to better determine which learned patterns should be prioritized for specific prediction tasks.

Summary updated

BibTeX
@inproceedings{hees2016evolutionary,
  author = {Jörn Hees and Rouven Bauer and Joachim Folz and Damian Borth and Andreas Dengel},
  title = {{An Evolutionary Algorithm to Learn SPARQL Queries for Source-Target-Pairs: Finding Patterns for Human Associations in DBpedia}},
  booktitle = {EKAW},
  year = {2016},
  doi = {10.1007/978-3-319-49004-5\_22},
}
Figure