Skip to content

"xcore" crashes due to unsupported type duration #217

Description

@thbar

In the process of reactivating the automatic updates of HTML tables (from XSD) in #216, I stumbled upon another error:

Generating documentation tables ...
/home/runner/basex/.basex: writing new configuration file.
*** Dnames excluded:   ".git .github"
*** Count(input XSDs): 86
"Resolve schema imports / inclusions"
"Resolving finished"
"Write edesc report(s)"
"*** Optimization - cache all simple types (548)"
Stopped at /home/runner/work/SIRI/SIRI/docs/xco-stype-description.xqm, 131/28:
[FORG0001] Cannot convert to xs:double: PT0S.

The culprit is that that the code below does not know how to handle a duration type.

https://github.com/SIRI-CEN/SIRI/blob/2d0a216a9a5b45f5d5749dd6378ad2acba12e277/docs/xco-stype-description.xqm#L199-L211

In theory, this error should have appeared as soon as in #188, if the tables had been regenerated then.

But because #188 targeted branch SIRI-CEN:2.2, and a fix like #216 was not yet applied, the regeneration did not occur, and the error was not seen then.

A possible fix could be this:

diff --git a/docs/xco-stype-description.xqm b/docs/xco-stype-description.xqm
index addf83a..768a8bb 100644
--- a/docs/xco-stype-description.xqm
+++ b/docs/xco-stype-description.xqm
@@ -201,9 +201,10 @@ declare function sd:isTypeDescriptionEnumDesc($tdesc as xs:string?)
  :)
 declare function sd:castToComparable($s as xs:string?)
       as item()? {
-    if ($s castable as xs:date) then xs:date($s) 
-    else if ($s castable as xs:dateTime) then xs:dateTime($s) 
-    else if ($s castable as xs:time) then xs:time($s)      
+    if ($s castable as xs:date) then xs:date($s)
+    else if ($s castable as xs:dateTime) then xs:dateTime($s)
+    else if ($s castable as xs:time) then xs:time($s)
+    else if ($s castable as xs:duration) then xs:duration($s)
     else if ($s castable as xs:double) then number($s)
     else if ($s castable as xs:decimal) then number($s)
     else if ($s castable as xs:boolean) then xs:boolean($s) ! number(.)

I'm not sure though:

  • if we want to "fork" our vendored version of xcore (presumably copied from there? Switch to documentation tables based on xcore VDVde/OJP#438)
  • if the behaviour works well for the comment indicated on the method (Casts a string to a value comparable per < and >.) - some verification will be needed in the generated tables!

@haeckerbaer @skinkie @TuThoThai in particular, FYI, to be fixed before v2.3.0 is issued, or the HTML tables will remain out of date!

For now, I will try to integrate the proposed fix in #216

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions