[
https://issues.apache.org/jira/browse/JENA-1402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16930342#comment-16930342
]
Andy Seaborne edited comment on JENA-1402 at 9/16/19 9:05 AM:
--------------------------------------------------------------
Maybe good - although that is going to make working with the value messy if the
java object class is hopping around. I'll experiment with a few tests cases to
see if Period works for a Year-Month java.time.duration. The javax.xml types do
work and are more focuesdon xsd, just for that duration bug
This is the code for XSD support as a standalone library with minimal
dependencies.
[https://github.com/afs/xsd4ld]
It is the java "value" for the datatype that is the part we are discusssing
here.
was (Author: andy.seaborne):
Maybe good - although that is going to make working with the value messy if the
java object class is hopping around. I'll experiment with a few tests cases to
see if Period works for a Year-Month java.time.duration. The javax.xml types do
work and are more focues on xsd, just for that duration bug.
> Subtracting two xsd:Duration gives incorrect results in SPARQL query
> --------------------------------------------------------------------
>
> Key: JENA-1402
> URL: https://issues.apache.org/jira/browse/JENA-1402
> Project: Apache Jena
> Issue Type: Bug
> Components: ARQ
> Affects Versions: Jena 3.4.0
> Reporter: Greg Albiston
> Priority: Major
>
> There is an issue when subtracting two xsd:durations that include:
> * decimal seconds
> * non-zero minutes
> * second operand has a greater number of seconds than the first operand, i.e.
> the minutes are reduced.
> The result is a large number of minutes and incorrect seconds.
> For example:
> Integer, Larger: "PT2M3S" - "PT1M10S" = "PT0M53S" CORRECT
> Decimal, Smaller: "PT2M3.123S" - "PT1M1.123S" = "PT1M2.000S" CORRECT
> Decimal, Larger, Seconds: "PT0M3.123S" - "PT1M10.123S" = "-PT1M7.000S"
> CORRECT
> Decimal, Larger, Minutes: "PT2M3.123S" - "PT1M10.123S" = "PT883M0.020S"
> INCORRECT
> Decimal, Larger, Hours: "PT1H4M3.123S" - "PT0M10.123S" = "PT1H3883M0.020S"
> INCORRECT
> Example SPARQL:
> {code:sparql}
> SELECT ?res ?op1 ?op2
> WHERE{
> VALUES (?op1 ?op2) {
> ("PT2M3S"^^<http://www.w3.org/2001/XMLSchema#duration>
> "PT1M10S"^^<http://www.w3.org/2001/XMLSchema#duration>)
> ("PT2M3.123S"^^<http://www.w3.org/2001/XMLSchema#duration>
> "PT1M1.123S"^^<http://www.w3.org/2001/XMLSchema#duration>)
> ("PT0M3.123S"^^<http://www.w3.org/2001/XMLSchema#duration>
> "PT1M10.123S"^^<http://www.w3.org/2001/XMLSchema#duration>)
> ("PT2M3.123S"^^<http://www.w3.org/2001/XMLSchema#duration>
> "PT1M10.123S"^^<http://www.w3.org/2001/XMLSchema#duration>)
> ("PT1H4M3.123S"^^<http://www.w3.org/2001/XMLSchema#duration>
> "PT0M10.123S"^^<http://www.w3.org/2001/XMLSchema#duration>)
> }
> BIND(?op1 - ?op2 AS ?res)
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.2#803003)