~paul-lucas/zorba/bug-932374

« back to all changes in this revision

Viewing changes to test/rbkt/Queries/zorba/index/keys_mod.xqlib

  • Committer: Paul J. Lucas
  • Date: 2012-09-21 20:26:47 UTC
  • mfrom: (10819.2.235 zorba)
  • Revision ID: paul@lucasmail.org-20120921202647-fy9n4jduhrnljrnb
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
module namespace keys-lib = "http://www.example.com/";
 
2
 
 
3
import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
 
4
 
 
5
declare namespace ann = "http://www.zorba-xquery.com/annotations";
 
6
 
 
7
declare %ann:unordered collection keys-lib:foo as node()*;
 
8
 
 
9
declare %ann:automatic %ann:value-equality index keys-lib:FooIdx
 
10
  on nodes dml:collection(xs:QName("keys-lib:foo"))
 
11
  by xs:integer(./@id) as xs:integer;
 
12
 
 
13
declare %ann:automatic %ann:value-range index keys-lib:FooIdx2
 
14
  on nodes dml:collection(xs:QName("keys-lib:foo"))
 
15
  by xs:integer(./@id) as xs:integer;
 
16
 
 
17
declare %ann:automatic %ann:value-range index keys-lib:FooIdx3
 
18
  on nodes dml:collection(xs:QName("keys-lib:foo"))
 
19
  by xs:string(./@id) as xs:string, (if (./@name) then xs:string(./@name) else ()) as xs:string?;
 
20
 
 
21
declare %ann:automatic %ann:general-equality index keys-lib:FooIdx-general
 
22
  on nodes dml:collection(xs:QName("keys-lib:foo"))
 
23
  by 
 
24
  (
 
25
    let $val := fn:data(./@id)
 
26
    return
 
27
      if (./@string) then
 
28
        xs:long($val)
 
29
      else
 
30
        xs:string($val)
 
31
  )
 
32
  as xs:anyAtomicType;
 
33
 
 
34
declare %ann:automatic %ann:general-range index keys-lib:FooIdx2-general
 
35
  on nodes dml:collection(xs:QName("keys-lib:foo"))
 
36
  by xs:integer(./@id) as xs:integer;
 
37
 
 
38
declare %ann:automatic %ann:general-range index keys-lib:FooIdx3-general
 
39
  on nodes dml:collection(xs:QName("keys-lib:foo"))
 
40
  by (if (./@name) then xs:string(./@name) else ()) as xs:string?;