Re: Comment on XPath operators

On 18/07/11 11:06, Kathrin Dentler wrote:
> Dear SPARQL WG,
>
> For medical applications such as guideline-based decision support,
> clinical trial recruitment or the calculation of clinical quality
> indicators, it is often necessary to select patients with a certain age
> at a certain moment; e.g. "select all patients older than 18". To
> retrieve those patients, the current (or some other) date needs to be
> subtracted from the patient's date of birth. This is currently not
> possible in SPARQL.
>
> Some XPath Arithmetic operators for numeric types are already included
> in the SPARQL Working Draft. To enable full usage of the type
> xsd:dateTime, could you also include the operators on durations, dates
> and times from the XQuery 1.0 and XPath 2.0 Functions and Operators
> Recommendation?
>
> The most important one for the use-case above would be:
> op:subtract-dateTimes($arg1 as xs:dateTime, $arg2 as xs:dateTime) as
> xs:dayTimeDuration.
>
> Best regards,
> Kathrin Dentler


Kathrin,

Thank you for your comment about SPARQL's requirement from XQuery/XPath 
Functions and Operators.

SPARQL requires any implementation to provide a core set of datatypes 
and a core set of operations on those datatypes.

It also provide an extensibility mechanism [1] whereby an implementation 
can, within the spec, include additional operators and additional 
coverage by existing operators beyond the core set.

An implementation can add

  op:subtract-dateTimes($arg1 as xs:dateTime, $arg2 as xs:dateTime)
  as xs:dayTimeDuration

so while it is not a requirement of a minimally compliant SPARQL 
processor, implementations are free to add such operation.

There is a balance in the set of datatypes and operators, and the costs 
of implementations in supporting that set. The working group has chosen 
to define a subset of the full XQuery/XPath Functions and Operators as 
being required; many implementations already go beyond this core set.

The required set of datatypes and operators in SPARQL 1.1 for 
xsd:dateTime is the same as that in SPARQL 1.0. The working group feels 
this is the right balance and hope implementations will provide the 
additional specific operators that certain domains require.

Any additional functions can provided by an implementation and called 
directly by their URI:

  op:subtract-dateTimes(?date1, ?date2)

We would be grateful if you would acknowledge that your comment has been 
answered by sending a reply to this mailing list.

Andy, on behalf of the SPARQL-WG

[1] http://www.w3.org/TR/sparql11-query/#operatorExtensibility

Received on Tuesday, 26 July 2011 14:58:34 UTC