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:

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.