Wimmics/corese

[Bug] Corese sparql binds multiples NOW() value in one query

MaillPierre opened this issue · 2 comments

Issue Description:

During one query, if NOW() is bound to a variable in the results, the variable will have as many values as the number of milliseconds taken to execute the query.

Steps to Reproduce:

  1. Create test_query.rq containg:
PREFIX pav: <http://purl.org/pav/>

CONSTRUCT {
    <> pav:lastUpdateOn ?date .
}
WHERE {
    ?s ?p ?o .
    BIND(NOW() AS ?date)
}
  1. Execute the following query, you can replace the target with any large enough file:
    java -jar corese-command-4.5.0.jar sparql -q test_query.rq -i https://raw.githubusercontent.com/Wimmics/IndeGx/main/catalogs/all_catalog_edited.ttl

  2. The result will look something like:

@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix pav: <http://purl.org/pav/> .

<> pav:lastUpdateOn "2024-01-10T11:06:04.503+01:00"^^xsd:dateTime ;
  pav:lastUpdateOn "2024-01-10T11:06:04.504+01:00"^^xsd:dateTime ;
  pav:lastUpdateOn "2024-01-10T11:06:04.505+01:00"^^xsd:dateTime ;
  pav:lastUpdateOn "2024-01-10T11:06:04.506+01:00"^^xsd:dateTime ;
  pav:lastUpdateOn "2024-01-10T11:06:04.507+01:00"^^xsd:dateTime ;
  pav:lastUpdateOn "2024-01-10T11:06:04.508+01:00"^^xsd:dateTime ;
  pav:lastUpdateOn "2024-01-10T11:06:04.509+01:00"^^xsd:dateTime ;
  pav:lastUpdateOn "2024-01-10T11:06:04.510+01:00"^^xsd:dateTime .

Expected Behavior:
The result should contain only one binding for NOW(), either at the start of the execution or at the end, at the developer's discretion. This is the behavior expected by the SPARQL 1.1 standard

Note to Developers:

Correcting this bug could slightly speed up querying because this implies a lot of unnecessary calls to the NOW() function.

Hello Pierre,

Thank you for your report. After testing, we've found that the problem is reproducible and is not limited to the Corese command but affects Corese in general, including all interfaces. We will investigate this further and work on a fix.

Hello,

The issue with the now function has been fixed and will be available in the next release.