Abstract
Triplestores that support query languages such as SPARQL are emerging as the preferred and scalable solution to represent data and meta-data as massive heterogeneous graphs using Semantic Web standards. With increasing adoption, the desire to conduct graph-theoretic mining and exploratory analysis has also increased. Addressing that desire, this paper presents a solution that is the marriage of Graph Theory and the Semantic Web. We present software that can analyze Linked Data using graph operations such as counting triangles, finding eccentricity, testing connectedness, and computing PageRank directly on triple stores via the SPARQL interface. We describe the process of optimizing performance of the SPARQL-based implementation of such popular graph algorithms by reducing the space-overhead, simplifying iterative complexity and removing redundant computations by understanding query plans. Our optimized approach shows significant performance gains on triplestores hosted on stand-alone workstations as well as hardware-optimized scalable supercomputers such as the Cray XMT.
Introduction
The Semantic Web relies on the Resource Description Framework (RDF) to link data together, creating massive, heterogeneous graphs. While SPARQL is the gold standard for querying this data, it was not originally designed for heavy-duty graph analytics like calculating "node eccentricity" (the maximum distance from one node to any other) or "triangle counting" (a measure of network clustering).
Currently, researchers often have to export their data from a triplestore into a specialized graph processing system to perform these analyses. This "export-process-import" cycle is slow and cumbersome. The challenge is that naive SPARQL implementations of graph algorithms are notoriously inefficient, often producing massive amounts of redundant intermediate data that can crash a standard workstation or even a supercomputer.
Methodology: Optimizing Graph Operations
Researchers at Oak Ridge National Laboratory have developed a systematic way to run complex graph algorithms directly on RDF triplestores using highly optimized SPARQL queries. Their approach focuses on three key areas:
Query Plan Analysis
By looking "under the hood" of the Apache Jena query engine, the team discovered that standard JOIN operations are "staged" (blocking), meaning they wait for all input data before proceeding. By strategically reordering query blocks, they forced the engine to use SEQUENCE operations, which are "staging-free" and stream data more efficiently.
Lexicographical Ordering
To avoid counting the same triangle multiple times (e.g., counting triangle A-B-C as B-C-A, C-A-B, etc.), they implemented filter conditions that enforce a strict ID order (Node X < Node Y < Node Z). This prunes the search space significantly.
Iterative Complexity Reduction
For algorithms like Connected Components, which use a "min-label propagation" approach, they used NOT EXISTS filters and temporary named graphs to ensure that only updated nodes are processed in each iteration, preventing the engine from re-calculating known values.
Experimental Evaluation
The study evaluated these optimizations using seven real-world datasets from the Stanford Network Analysis Platform (SNAP), ranging from social networks (soc-LiveJournal) to web crawls (web-Google).
Key Results
The optimizations yielded dramatic improvements across different triplestore engines:
- Triangle Counting: Performance improved by 64–93% on Jena and 36–74% on Sesame.
- Connected Components: On the Jena engine, the optimized query was at least 38 times faster than the initial version. In some cases, the initial version failed to complete within an hour, while the optimized version finished in minutes.
- Scalability: When tested on the Cray uRiKA (a graph-optimized supercomputer), the optimized Node Eccentricity algorithm processed graphs with millions of nodes and tens of millions of edges in under 100 seconds.
Conclusion
The primary limitation is that these optimizations currently require manual intervention. The authors suggest that the next logical step is to build an automated framework or a query rewriter. This tool would take a standard graph-theoretic query and automatically apply these optimization patterns based on the specific triplestore being used, bringing high-performance graph analytics to the broader Semantic Web community.
Summary updated