History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: SES-803
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Jeen Broekstra
Reporter: Jeen Broekstra
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Sesame

support math operations on calendar datatypes

Created: 26/Jul/11 11:01 PM   Updated: 09/Aug/12 02:01 AM
Component/s: SPARQL
Affects Version/s: None
Fix Version/s: 2.7.0

File Attachments: 1. Zip Archive datetime_functions_proposal.zip (2 kb)



 Description   
Currently Sesame only supports mathematical operations (-,+, etc.) on numerical literals, which is conform a minimal interpretation of the SPARQL spec. An extended interpretation would allows us to support such operations on other datatypes, such as xsd:dateTime.

An alternative solution would be to not extend defaut builtin operators, but instead offer a set of custom functions for this purpose. This has the advantage of being much more explicit about being an extension. Overloading the default operators is really not very nice and is asking for confusion about interoperability.

 All   Comments   Change History      Sort Order:
Comment by Kathrin Dentler [27/Jul/11 08:58 AM]
Hi!

I would find this issue extremely important, I just commented on it to the SPARQL WG: http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2011Jul/0014.html!

Best, Kathrin

Comment by Barry Bishop [05/Aug/11 10:39 AM]
I would suggest adding custom functions makes it much more obvious that this is an extension that is not standard.

The danger (as we have seen recently) by extending the range of datatypes that a standard function can accept is that it will lead to different behaviour on different implementations. This causes a lot of confusion for users and leads them to ask questions like "Why does my standard SPARQL query give different results on XXX's database, when compared to YYY's database?"

Also, be careful with XSD date/time/duration data types. They are notoriously difficult to deal with due to having ambiguous sort order and values that are conceptually the same, but with different representations.

Comment by Jeen Broekstra [19/Sep/11 10:59 PM]
I agree that supporting this through custom functions is the way to go. rescheduling to 2.5.2 (for now).

Comment by Marek Surek [09/Aug/12 02:01 AM]
I would like to propose two basic functions, which are implemented as standard SPARQL custom functions.

fn:DATE() is equivalent of NOW(), but instead of xsd:datetime it returns only xsd:date.

fn:DATE_ADD(xsd:datetime/xsd:date, interval) is function responsible for datetime arithmetics. The implementation is based/inspired by SQL date functions (http://www.w3schools.com/sql/func_date_add.asp)

E.g.
(df:DATE_ADD("2012-12-31T10:59:01", "INTERVAL 1 DAY")
has result
2013-01-01T10:59:01+01:00

Current implementation allows to work with these time intervals : MILLISECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, YEAR

The function also permits to substract dates, by using negative integer :
E.g.
(df:DATE_ADD("2012-12-31T10:59:01", "INTERVAL -1 DAY")
has result
2012-12-30T10:59:01+01:00

I could improve these or add new functions to help in Sesame developement.