Add SEP for Alignment of SPARQL Functions with ISO SQL Standard#214
Add SEP for Alignment of SPARQL Functions with ISO SQL Standard#214domel wants to merge 2 commits into
Conversation
|
Why?? Most of these are either already supported or covered by Extending the lists of expected functions taken from new versions of XPath and XQuery and SEP-0002. |
|
There are two considerations:
|
| ### Date/Time functions | ||
| - `DATE_ADD(date, interval)` | ||
| - `TIMESTAMPDIFF(unit, t1, t2)` | ||
| - Support for `INTERVAL` literals (e.g., `INTERVAL '7' DAY`) |
There was a problem hiding this comment.
Isn't it already covered by xsd: duration that is supported by a few implementations?
There was a problem hiding this comment.
xsd:duration is indeed supported in some implementations, but it only provides the datatype. What is missing are standardized functions and operators (e.g., DATE_ADD, TIMESTAMPDIFF) that make such durations practically usable within queries across engines.
You are right that some of the proposed functions are already supported or covered by SEP-0002 and the plan to adopt functions from XPath/XQuery. However, the motivation here is slightly different:
I see this SEP as complementary to SEP-0002: the XPath/XQuery path ensures alignment with XML technologies, while this proposal highlights ISO SQL alignment. Both perspectives help broaden SPARQL’s adoption. Perhaps the SQL-related functions could be integrated as an extension to SEP-0002, or tracked separately for clarity. |
I agree that adding functions increases the burden on implementers, especially for non-commercial projects, so a staged or optional profile could help ease adoption while still improving interoperability. I also acknowledge that SQL and F&O differ in evaluation models, particularly for date/time. The aim is not strict equivalence but functional parity where it makes sense, with semantics adapted to RDF datatypes while staying close enough to SQL to support translation and interoperability. |
comments on contentnullifInstead of SELECT ?test
WHERE
{
BIND(1 AS ?a)
BIND(1 AS ?b)
BIND(IF(?a = ?b, ?a = ?b, UNDEF) AS ?test)
}greatest/leastI think these functions should just be called min/max even if they are already aggregate functions. Which actually leads to a different request that aggregate functions could be used inside the where clause. comment on mergingThat said, I don't object for this SEP to exist, or be merged. I would like a few more links to relevant SQL concepts, or if no free/other source the postgresql documentation. |
I would also appreciate this (having resorted to e.g. |
Let's enumerate the places.
|
Good point! IIRC, that'd be enough for my cases (and certainly both simpler and easier to use). |
This PR adds a new SEP: “Alignment of SPARQL Built-in Functions with ISO SQL Standard Functions”.
Highlights
sparql-sql-functions.md).Motivation
SPARQL 1.1 lacks many functions common in SQL. Aligning with ISO SQL:
References