Files
secondo/Algebras/Array/arraytest2
2026-01-23 17:03:45 +08:00

72 lines
1.9 KiB
Plaintext

#This file is part of SECONDO.
#Copyright (C) 2004, University in Hagen, Department of Computer Science,
#Database Systems for New Applications.
#SECONDO is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#SECONDO is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with SECONDO; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Array von Objekten vom Kind DATA
delete ad;
create ad : array(date);
update ad := [const array(date) value ("2003-01-30" "2003-01-31" "2003-02-01")];
query size(ad);
# Array von Relationen
delete ar;
create ar : array(rel(tuple((no:int))));
update ar := [const array(rel(tuple((no:int)))) value (((1)) ((2)(3)) ((4)(5)(6)) ((7)(8)(9)(10)))];
query get(ar,3) feed consume;
query get(put(ar,[const rel(tuple((no:int))) value ((1)(2)(3)(4))],3),3) feed consume;
query get(put(ar,get(ar,3),0),0) feed consume;
# Zweidimensionales Array von Integer-Werten
delete ta;
create ta : array(array(int));
update ta := [const array(array(int)) value ((1 2 3) (4 5 6))];
query get(get(ta,1),2);
query put(ta,put(get(ta,1),9,2),1)
# Distribute und Summarize
delete tenTest;
create tenTest : rel(tuple((no:int,na:string)));
update tenTest := [const rel(tuple((no:int,na:string)))
value ((1 "One")(2 "Two")(3 "Three")(4 "Four")(5 "Five")
(6 "Six")(7 "Seven")(8 "Eight")(9 "Nine")(10 "Ten"))];
delete prel;
let prel = tenTest feed extend[mod2 : .no mod 2] distribute[mod2];
query prel summarize consume;