Known SPARQL Issues

DISTINCT Queries

The default data returned from SPARQL may contain duplicate rows. Mulgara currently only returns DISTINCT rows.

Mulgara was initially designed to have "set semantics", meaning that there should never be any duplicates. While this was considered for SPARQL, allowing duplicates was permitted for performance considerations.

A fix for this deficiency (with corresponding performance improvements) has already been written. However, it involves such large changes to the way that queries are resolved, that this code has been left in a separate branch until the full SPARQL test suite is available.

To take advantage of the performance improvements that this branch offers, TQL is being updated to include a NONDISTINCT keyword. The difference in the keyword here reflects the inverted default between TQL and SPARQL.

ORDER BY

Mulgara currently only allows results to be ordered by variables. SPARQL permits ordering by complex expressions as well.

A work around is to assign a variable to the required expression, and to sort on that variable.

For example:

  prefix data: <http://datastuff.com/data>
  SELECT * WHERE {
    ?s a data:Datapoint ;
       data:hasX ?x ;
       data:hasY ?y .
    LET (?distSquared := (?x * ?x + ?y * ?y))
  } ORDER BY ?distSquared