The problem is that xs:duration is not fully comparable. So we need a fully 
comparable subtype of xs:duration. Without looking at the XQuery recommendation 
we can find one with this expression:

xdmp:describe(current-time() - current-time())
=>
xs:dayTimeDuration("PT0S")

...and that fixes the problem for me:

xquery version "1.0-ml";
declare namespace foo = "http://x.y.z";;
cts:search(
  /foo:data,
  cts:element-range-query(xs:QName("foo:duration"), ">=", 
xs:dayTimeDuration("PT10M")))

For the gory details:

* http://www.w3.org/TR/xmlschema-2/#duration "3.2.6.2 Order relation on 
duration"

* http://www.w3.org/TR/xpath-functions/#duration-subtypes

-- Mike

On 28 Feb 2013, at 04:26 , Iain Tatch <[email protected]> wrote:

> I've tried to simplify this issue I'm having as much as possible.
> 
> Here's my test document:
> 
> <data xmlns="http://x.y.z";>
>     <duration>PT15M</duration>
> </data>
> 
> I have created an element range index:
>   Type = dayTimeDuration
>   Namespace URI = http://x.y.z
>   Localname = "duration"
> 
> And I'd like to be able to cts:search() for various durations.
> 
> But if I try to run the following
> 
> xquery version "1.0-ml";
> declare namespace foo = "http://x.y.z";;
> cts:search(
>   /foo:data,
>   cts:element-range-query(xs:QName("foo:duration"), ">=", 
> xs:duration("PT10M"))
> )
> 
> MarkLogic (6.0-1.1) gives me
> 
> [1.0-ml] XDMP-COMPUTE: (err:FORG0006) 
> cts:element-range-query(xs:QName("foo:duration"), ">=", xs:duration("PT10M")) 
> -- Cannot compute min((xs:duration("PT10M"), xs:duration("PT10M")))
> 
> 
> I've not found much in the way of documentation about the circumstances in 
> which XDMP-COMPUTE gets thrown.  Can anyone explain what I might be doing 
> wrong?
> 
> 
> Many thanks.
> 
> Iain
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to