khfaraaz82@gmail.com | c26a698 | 2012-06-01 02:35:40 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Testcase Name : open-closed-29.aql |
| 3 | * Description : Query for undeclared data from an open type internal dataset |
| 4 | * : use the some keyword in the where clause |
| 5 | * Status : Yes |
| 6 | * Date : 31st May 2012 |
| 7 | */ |
| 8 | |
| 9 | drop dataverse testdv2 if exists; |
| 10 | create dataverse testdv2; |
| 11 | use dataverse testdv2; |
| 12 | |
| 13 | create type testtype01 as open { |
| 14 | id: string, |
| 15 | name: string |
| 16 | } |
| 17 | |
| 18 | create type testtype02 as open { |
| 19 | id : string, |
| 20 | name : string |
| 21 | } |
| 22 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame] | 23 | create dataset testds01(testtype01) primary key id; |
khfaraaz82@gmail.com | c26a698 | 2012-06-01 02:35:40 +0000 | [diff] [blame] | 24 | |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame] | 25 | create dataset testds02(testtype02) primary key id; |
khfaraaz82@gmail.com | c26a698 | 2012-06-01 02:35:40 +0000 | [diff] [blame] | 26 | |
| 27 | insert into dataset testds02 ( |
| 28 | { "id": "001", "name": "Person One", "hobbies": {{"scuba", "music"}}} |
| 29 | ); |
| 30 | |
| 31 | insert into dataset testds02 ( |
| 32 | { "id": "002", "name": "Person Two", "hobbies": {{"fishing", "dance"}}} |
| 33 | ); |
| 34 | |
| 35 | |
| 36 | insert into dataset testds02 ( |
| 37 | { "id": "003", "name": "Person Three", "hobbies": {{"hiking", "surfing"}}} |
| 38 | ); |
| 39 | |
| 40 | insert into dataset testds01( |
| 41 | for $d in dataset("testds02") |
| 42 | return $d |
| 43 | ); |
| 44 | |
| 45 | // select all hobbies where hiking is one of the hobbies |
buyingyi | bc282ae | 2012-06-05 21:41:14 +0000 | [diff] [blame] | 46 | write output to nc1:"rttest/open-closed_open-closed-29.adm"; |
khfaraaz82@gmail.com | c26a698 | 2012-06-01 02:35:40 +0000 | [diff] [blame] | 47 | for $d in dataset('testds01') |
| 48 | where some $h in $d.hobbies satisfies $h='hiking' |
buyingyi | bc282ae | 2012-06-05 21:41:14 +0000 | [diff] [blame] | 49 | order by $d.id |
khfaraaz82@gmail.com | c26a698 | 2012-06-01 02:35:40 +0000 | [diff] [blame] | 50 | return $d |