| /* |
| * Description : Test various syntax for dataset access |
| * : Using parentheses for dataset access is now optional |
| * : New syntax can use fully qualified names to access datasets. |
| * Expected Res : Success |
| * Date : 6th March 2013 |
| */ |
| |
| drop dataverse student if exists; |
| drop dataverse teacher if exists; |
| |
| create dataverse student; |
| create dataverse teacher; |
| |
| write output to nc1:"rttest/cross-dataverse_cross-dv20.adm"; |
| |
| create type student.stdType as open { |
| id : int32, |
| name : string, |
| age : int32, |
| sex : string, |
| dept : string |
| } |
| |
| create type teacher.tchrType as open { |
| id : int32, |
| name : string, |
| age : int32, |
| sex : string, |
| dept : string |
| } |
| |
| create dataset student.ugdstd(stdType) primary key id; |
| create dataset student.gdstd(stdType) primary key id; |
| create dataset teacher.prof(tchrType) primary key id; |
| create dataset teacher.pstdoc(tchrType) primary key id; |
| |
| insert into dataset student.ugdstd({"id":457,"name":"John Doe","age":22,"sex":"M","dept":"Dance"}); |
| |
| insert into dataset student.gdstd({"id":418,"name":"John Smith","age":26,"sex":"M","dept":"Economics"}); |
| |
| insert into dataset teacher.prof({"id":152,"name":"John Meyer","age":42,"sex":"M","dept":"History"}); |
| |
| insert into dataset teacher.pstdoc({"id":259,"name":"Sophia Reece","age":36,"sex":"F","dept":"Anthropology"}); |
| |
| for $s in dataset student.ugdstd |
| for $p in dataset('teacher.prof') |
| for $a in dataset("student.gdstd") |
| for $b in dataset teacher.pstdoc |
| return {"ug-student":$s,"prof":$p,"grd-student":$a,"postdoc":$b} |