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

[Request] substraction of two dates (typed with xsd) returns a xsd:duration #137

Open
MaillPierre opened this issue Sep 13, 2023 · 0 comments

Comments

@MaillPierre
Copy link
Contributor

MaillPierre commented Sep 13, 2023

Is your feature request related to a problem? Please describe.
As part of my project, I store the start and end times of query execution in a dataset. As a post-treatment, I would like to be able to compute the duration of each query execution and add this information to the dataset using a SPARQL query.

Currently, the following query returns no result:

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?duree (DATATYPE(?duree) AS ?dt) WHERE { 
  BIND(("2023-09-12T15:19:41.963Z"^^xsd:datetime - "2023-09-12T14:19:41.963Z"^^xsd:datetime) AS ?duree)
}

Describe the solution you'd like
Ideally, I would like the previous query to return something such as:

duree dt
"PT1H"^^xsd:duration xsd:duration

It would work for operations between literals of the same type such as date, datetime, time, gYear, etc.
Operations between literals of different types maybe more complex to implement.

Describe alternatives you've considered
The alternative right now is to decompose each datetime to its component (day, hours, minutes, etc.) and do arithmetic operations on them, or do the computation outside the query.

Additional context
Tested on Corese server corese-server-4.4.1.jar

@MaillPierre MaillPierre changed the title [Request] substraction of two dates (type with xsd) returns a xsd:duration [Request] substraction of two dates (typed with xsd) returns a xsd:duration Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants