dydra / support

4 stars 1 forks source link

Fix xsd:dateTime comparisons for values with fractional seconds #34

Closed jerdeb closed 9 years ago

jerdeb commented 9 years ago

I am trying to do the following query on my endpoint (http://dydra.com/jerdeb/swj_daq/):

PREFIX daq:<http://purl.org/eis/vocab/daq#>
PREFIX sdmx-dimension:<http://purl.org/linked-data/sdmx/2009/dimension#>

SELECT DISTINCT ?metric ?value {
    ?obs a daq:Observation .
    ?obs daq:metric ?metric_instance .
    ?obs daq:value ?value .
    ?obs sdmx-dimension:timePeriod ?dateTime .

    FILTER NOT EXISTS {
        ?obs2 daq:metric ?metric_instance .
        ?obs2 sdmx-dimension:timePeriod ?newerDateTime  .
        FILTER (?newerDateTime > ?dateTime) 
    } 

    ?metric_instance a ?metric .
}

This query works well on OpenRDF Workbench [1] - results in the first image, but not on the Dydra endpoint. The problem seems to be in the FILTER NOT EXISTS { ... } block, as the query works without that block.

openrdf

Both workbenches have the same turtle file loaded. Could this be a bug in Dydra?

[1] http://rdf4j.org

lisp commented 9 years ago

i would not have expected the discrepancy to follow from "(not) exists" itself. while we do exhibit some discrepancies in that regard (http://api.dydra.com/sparql/earl.html#Negation) the known issues are limited and understood.

lacking any background information on your dataset, i entered your query in the web interface to explore your dataset and deconstructed to to isolate what appears to be the issue: your data reveals an error in our algebra operations on dates with fractional components. if you work through variations in your query, you will observe, that an error occurs in the filter form, which suppresses it error, which may have led you to misconstrue it as a problem with the not exists rather than the '<' operation.

we are investigating further. for the moment, we have added a fractional test to the suite ( https://github.com/dydra/http-api-tests/blob/master/extensions/sparql-protocol/temporal-data/dateTime.sh ) you can check back to see when it passes. if there are any other notable features to your temporal values, please advise.

jerdeb commented 9 years ago

There are no notable features. Just FYI, the time is generated in java using Calendar.getInstance()

artob commented 9 years ago

This issue has now been fixed in our development branch. We expect to deploy the fix to dydra.com tomorrow.

jerdeb commented 9 years ago

is the fix deployed to dydra.com?

lisp commented 9 years ago

not yet. we folded the correction into a larger release which is still in staging. for the moment, the workaround would be to truncate the fractional values.

lisp commented 9 years ago

the query, above, should now return the intended results.