DiStRDF: Distributed Spatio-temporal RDF Queries on Spark

Panagiotis Nikitopoulos, Akrivi Vlachou, Christos Doulkeridis, George A. VourosEDBT/ICDT Workshops 2018

Abstract

DiStRDF is a distributed query engine built on Apache Spark designed to optimize spatio-temporal SPARQL queries. By integrating location and time data directly into RDF resource identifiers via a specialized 1D encoding scheme, the system enables early data pruning. This approach significantly reduces data movement across distributed clusters and improves query performance over traditional decoupled methods that filter results only after graph pattern matching.

Introduction

The proliferation of spatio-temporal data from sensors and mobile devices—such as GPS tracks for maritime or aerial traffic—has led to a surge in the use of the Resource Description Framework (RDF) for data linking. However, querying this data at scale remains a significant challenge. Traditional "decoupled" approaches typically run a standard SPARQL query to find matching graph patterns first, followed by a secondary filter for spatial and temporal constraints. This often results in the processing of millions of "candidate" triples that are ultimately discarded, leading to massive, unnecessary data movement.

DiStRDF addresses this inefficiency by "baking" metadata into the identifiers themselves, allowing the system to prune irrelevant data at the very start of the query pipeline.

The DiStRDF Architecture

DiStRDF consists of two primary layers: a Storage Layer and a Processing Layer, centered around a novel encoding strategy.

1. Spatio-temporal 1D Encoding

The core innovation of DiStRDF is its 1D encoding scheme. Instead of using standard dictionary encoding with arbitrary integer IDs, DiStRDF maps resources to integers that represent their spatial and temporal context. The world is divided into a grid using a Hilbert space-filling curve to maintain spatial locality, and the timeline is partitioned into discrete intervals.

The 1D encoding scheme bit-level structure, partitioning IDs into time, cell, and unique identifiers.

As shown in the bit-level structure above, an ID is constructed using specific ranges for the time interval, the spatial cell ID, and a uniqueness component. This allows the system to translate complex spatio-temporal queries into simple range filters on integer IDs, enabling Spark to discard irrelevant data during the initial scan before any expensive joins occur.

2. Distributed Storage and Data Organization

DiStRDF utilizes a hybrid storage approach to balance lookup speed and analytical throughput:

  • Dictionary: Stored in Redis to allow for high-speed bi-directional lookups between strings and encoded IDs.
  • Triples: Stored in HDFS using Apache Parquet. Parquet’s columnar format supports predicate pushdown, allowing Spark to skip entire chunks of data if the encoded IDs do not fall within the required spatio-temporal range.
Comparison of storage formats: the standard One-triples-table versus optimized Property tables.

Furthermore, the system supports different data organizations. While a standard One-triples-table stores data in <S, P, O> format, Property Tables group multiple properties of a single subject (e.g., <S, P1, P2, P3>). This organization is particularly effective for "star queries," as it eliminates the need for multiple self-joins.

Evaluation and Key Results

The system was evaluated using a real-world maritime surveillance dataset containing approximately 269 million triples (6GB raw text). The data includes vessel positions, speeds, headings, and status changes.

  • Encoding Efficiency: The 1D spatio-temporal encoding provided at least a 10-second improvement (roughly 20-25% speedup) compared to random encoding across all test cases.
  • Storage Impact: Queries executed on Property Tables were nearly 2x faster than those on the standard One-Triples-Table, completing in approximately 14 seconds versus 24 seconds.
  • Join Performance: For large-scale shuffles, the Sort-merge Join generally outperformed the Broadcast Hash Join.

Conclusion

DiStRDF demonstrates that early pruning via metadata-aware encoding is a powerful strategy for distributed RDF querying. By leveraging spatial locality and temporal partitioning within the resource IDs, the system achieves significant performance gains. Future work will focus on expanding support for the full SPARQL specification and developing a cost-based optimizer to automatically select the most efficient logical plans based on data statistics.

Summary updated

BibTeX
@inproceedings{nikitopoulos2018distrdf,
  author = {Panagiotis Nikitopoulos and Akrivi Vlachou and Christos Doulkeridis and George A. Vouros},
  title = {{DiStRDF: Distributed Spatio-temporal RDF Queries on Spark}},
  booktitle = {EDBT/ICDT Workshops},
  year = {2018},
}
Figure