Skip to content

Current deviations from the SPARQL 1.1 standard

Hannah Bast edited this page Aug 12, 2024 · 22 revisions

QLever aims to support the full SPARQL 1.1 standard and is not far away from it anymore.

SPARQL 1.1 features that are not yet implemented, with a workaround or an estimate of when they will be implemented

Feature: QLever currently does not support named graphs (GRAPH, FROM, FROM NAMED).
Plan: We are currently working on it, see PR #1337. Expected to be available by July.

Feature: QLever currently does not support SPARQL 1.1 Update operations.
Plan: We are currently working on it. PR #916 implements a proof of concept that works with the QLever version at that time. Expected to be available by the summer.

Feature: Most built-in functions, as defined in Section 9.8 of the SPARQL standard, grammar rule [121], are implemented by now; see the last section below. Still missing are the more esoteric ones: BNODE, STRLANG, now,
Plan: Let us know (by opening an issue) if you need one of the missing functions urgently. Or consider adding a PR, which implements it, yourself. You can use PR #1047, or one of the other PRs that implement a built-in function and are listed below, as a template. It's relatively easy and schematic.

Feature: QLever does not yet support EXISTS { subquery } or ASK { subquery }, which return false if the subquery is empty, and true otherwise.
Plan: There is a workaround using UNION and COUNT, but it's rather clumsy and ugly. We should implement this very soon!

Feature: QLever does not yet support FILTER NOT EXISTS.
Workaround: For most queries, this is exactly equivalent to MINUS. The subtle differences are explained in the SPARQL 1.1 standard. We will eventually implement it.

Feature: QLever does not yet support DESCRIBE.
Workaround: This can be easily simulated using an ordinary SELECT query. For example, instead of DESCRIBE wd:Q42, one could write SELECT ?s ?p ?o WHERE { BIND(wd:Q42 AS ?s) ?s ?p ?o }. Note that the SPARQL standard does not dictate exactly which triples are returned to "describe" the entity. For example, one could also add triples that have the entity as their object.

Feature: QLever does not yet support ASK.
Workaround: This can also be easily simulated using an ordinary SELECT query. For example, instead of DESCRIBE { ?subject wdt:P31 wd:Q5 . ?subject wdt:P31 wd:Q16521 } one can equivalently write SELECT (COUNT(*) > 0 AS ?exists) { ?subject wdt:P31 wd:Q5 . ?subject wdt:P31 wd:Q16521 }.

SPARQL 1.1 Features that used to be missing, but were added in the meantime

SOLVED BY PR #1366: Support for UUID/STRUUID

SOLVED BY PR #1382: Support for lang/langMatches

SOLVED BY PR #1386: Support for timezone

SOLVED BY PR #1342: Support for MD5, SHA1 etc..

SOLVED BY PR #1401: Support for IRI/URI

SOLVED BY PR #1359: Support for tz.

SOLVED BY PR #1344: Support for IN and NOT IN. Here is an example query.

SOLVED BY PR #1310: Unlimited support for new entities or literal in a query (for example, "this string was probably not in the input data"@en),

SOLVED by PR #1279: Support for everything involving [...] (blank nodes and blank node property lists) in a SPARQL query.

SOLVED by PR #1184: Add built-in functions isIRI, isBlank, isLiteral, isNumeric, bound.

SOLVED by PR #1128: Add built-in function ENCODE_FOR_URI.

SOLVED by PR #1116: Add built-in functions HOURS, MINUTES, and SECONDS.

SOLVED by PR #1057, PR #1060, PR #1065, PR #1070, PR #1074, PR #1085: Add builtin-functions SUBSTR, UCASE, LCASE, STRSTARTS, STRENDS, STRBEFORE, STRAFTER, CONTAINS, IF, COALESCE, CONCAT, and REPLACE.

SOLVED by PR #1047: Add math functions log, exp, sqrt, sin, cos, tan.

SOLVED by PR #793: Support the SERVICE clause. This required a variety of deeper changes, namely code for communicating with a remote server via HTTP or HTTPS (#823 and #900), as well as code for dealing with entities that are not contained in the vocabulary of the original index (#820, #822, #838, and #880). See the commit message of PR #793 for the restrictions.

SOLVED by PR #793: Implement the built-in functions STR, STRLEN, DAY, MONTH, YEAR, and RAND. Using these as templates, it will now be easy to implement more of them.

SOLVED by PR #790: Since this PR, the whole SPARQL query is parsed using ANTRL using the SPARQL grammer from the standard. That way, many idiosyncrasies of QLever's query parsing so far have disappeared.

SOLVED by PR #749: Parse according to the official SPARQL 1.1 grammar. In particular: allow { ... } around a group graph pattern (with the semantics that this part of a query is optimized independently) and don't require a dot before FILTER or OPTIONAL or MINUS. QLever's previous hand-written parser had all kinds of idiosyncrasies, which are all removed by this PR.

SOLVED BY PR #726: Use arbitrary expressions in FILTER or ORDER BY claueses. Before this PR, a workaround was to BIND the expression to a variable and then use this variable in the FILTER or ORDER BY.

SOLVED by PR #726: Allow to write true or 42 as a shorthand for "true"^^xsd:boolean or "42"^^xsd:int.

SOLVED by PR #669: Allow the shorthand a for rdf:type.

SOLVED by PR #657: Full support for not only GET requests, but also POST requests. In particular, support POST request with Content-type: application/sparql-query.