SPARQL Query Engines | AllegroGraph 9.0.1
Author: Franz Incorporated

Copyright (c) 2005 - 2026 Franz, Incorporated
Last updated 27 May 2026 at 10:34

# SPARQL Query Engines

- Documentation Index
  - Release Notes
  - Quick Start
  - SSL/TLS Quick Start
  - Introduction
  - Setup and Configuration
    - Download
    - Server Installation
    - Server Configuration and Control
    - WebView
    - Database Upgrading
    - Managing Users
  - Server Management
    - Performance Tuning
    - Deleting Duplicate Triples
    - Purging Deleted Triples
    - Auditing
    - Managing Users
    - Replication
    - Point-in-Time Recovery
    - Transaction Log Archiving
    - Security Overview
    - Security Implementation
  - Tools
    - agtool
    - Data Loading
    - Data Export
    - Backup and Restore
    - Querying
    - RDFS++
    - Materializer
    - Event Scheduler
    - SHACL
  - Details
    - Triple Indices
    - Freetext Indices
    - Encoded IDs
    - Connection Pooling
    - N-dimensional Geospatial Overview
    - 2-D Geospatial
    - Temporal
    - Social Network
    - JavaScript
    - Datatypes
    - Data Conversion (Rapper)
    - Stored Procedures
    - Triple Attributes
    - Lineparse Format
  - Querying
    - SPARQL documentation summary
    - SPARQL Reference
    - SPIN
    - SPARQL Magic Properties
    - Prolog
  - 3rd-party tools
    - Solr text Indices
    - MongoDB integration
    - TopBraid Composer Plugin
    - Cloudera
  - Client APIs
    - Gruff
    - GraphTalker
    - REST/HTTP interface
    - HTTP reference
    - Javadocs (Sesame and Jena)
    - Python API
    - Lisp Reference
    - JavaScript
  - Tutorials
    - N-dimensional Geospatial
    - SPARQL Tutorial
    - Java Sesame
    - Java Jena
    - Python Sesame
    - Lisp
    - Prolog
    - More...
  - Other
    - Conferences and Seminars
    - Source Code on Github
    - Amazon EC2
    - Copyrights
  - Franz, Inc.

- Introduction
- Available query engines
- Specifying a query engine
- Do both engines produce the same results?

Documentation Index

## Introduction

AllegroGraph 7.1.0 now offers a supplemental Path Expression optimized query engine we have termed MJQE.

With the release of our FedShard capabilities and parallel SPARQL, our on-going product research found an approach that can significantly improve certain Path Expression queries across shards. AllegroGraph’s MJQE caching methods and merge join operations provide optimizations to AllegroGraph’s highly scalable, parallel distributed query approach that is offered via the FedShard capabilities.

Path Expression queries often require more up-front tuning for a set based query engine (like SBQE) because it is not initially known whether getting from point A to point B requires, say, 2 steps or 30 steps. There is the chance you will get into a combinatorial explosion, exhausting memory and requiring disk paging. This is partly because SPARQL was originally designed to be closer to relational database queries on top of graphs but not as a general tool for algorithms like shortest path or A* search. SPARQL is very powerful for querying graph patterns along with many other features like optional patterns, unions, subqueries, aggregation, and negation and our SBQE approach is highly optimized in these cases.

The SBQE engine is the default and will be fastest for most types of queries. Alternatively, MJQE is an option for queries that need a lot of intermediate state and are prone to combinatorial explosion. Users should test the two engines to see which works best on particular queries.

## Available query engines

The query engines available in AllegroGraph are:

- SBQE: default query engine optimized for most types of SPARQL queries;

- MJQE: optimized for lower memory consumption, path expression queries and use with FedShard deployments.

## Specifying a query engine

Queries will use the SBQE engine by default. To use the MJQE engine, add this Franz option to your query:

    PREFIX franzOption_engine: <franz:mjqe>

So this query (which returns all triples) will use the SBQE query engine:

    SELECT ?s ?p ?o { ?s ?p ?o . }

and this one will use the MJQE emgine:

    PREFIX franzOption_engine: <franz:mjqe>

    SELECT ?s ?p ?o { ?s ?p ?o . }

This prefix will also specify the SBQE engine though it is not necessary as that query engine is the default:

    PREFIX franzOption_engine: <franz:sbqe>

## Do both engines produce the same results?

Yes, so long as the results are not limited (with, for example, LIMIT). The order of the results may differ however.