Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omission in the recommendation SPARQL 1.1 and in the tests : the operators with datetime #6

Open
BorderCloud opened this issue Feb 24, 2015 · 1 comment
Labels

Comments

@BorderCloud
Copy link
Owner

As Sebastian Schaffert said:

Date subtraction not defined by SPARQL 1.1
The test for date subtraction in test Grid Observatory does not conform to the SPARQL 1.1 specification.
The operator "-" is only defined for numeric operands.
http://www.w3.org/TR/sparql11-query/#OperatorMapping

In the recommendation, we can read "The following table associates each of these grammatical productions with the appropriate operands and an operator function defined by either XQuery 1.0 and XPath 2.0 Functions and Operators [FUNCOP] or the SPARQL operators specified in section 17.4.".
In the "operator function defined by either XQuery 1.0 and XPath 2.0", we can see "Backs up the subtract, "-", operator on xs:dateTime values"

Proposition of new test for the substract's operator with datetime :

PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>
SELECT   ?date1 ?date2 ( ?date1-?date2 AS ?funcSubtractDateTimes) 
{ 
    BIND (xsd:dateTime("2005-01-02T00:00:01Z") AS ?date1)
    BIND (xsd:dateTime("2005-01-01T00:00:00Z") AS ?date2)
}

Result expected :

----------------------------------------------------------------------------------------------------------------
| date1                                | date2                                | funcSubtractDateTimes          |
================================================================================================================
| "2005-01-02T00:00:01Z"^^xsd:dateTime | "2005-01-01T00:00:00Z"^^xsd:dateTime | "P1DT0H0M1.000S"^^xsd:dayTimeDuration |
----------------------------------------------------------------------------------------------------------------

What did you think ?

@VladimirAlexiev
Copy link

The row defining - (minus) explicitly says "numeric" and links to https://www.w3.org/TR/xpath-functions/#func-numeric-subtract. So indeed, SPARQL doesn't define subtraction of dates.

Date subtraction is a reasonable extension, but you should somehow mark it as an extension.
Also, you should write 1S instead of 1.000S, #15 raises a similar problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants