#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 # a test for the spatial algebra # run with : TestRunner -c SecondoConfig.ini < hierarchicalgeo.test # A fresh restored berlin database needs to be present for # this test #setup hierarchicalgeotest open database berlintest # The conventions for commands are the same as in SecondoTTYBDB # make sure that commands are always terminated # (either by a semicolon or by a newline) # a TESTCASE consists of a TESTCASE declarative followed # by a YIELDS declarative followed by a command. # multiple or no commands after a YIELD directive # will confuse the TestRunner # the expected output specified by the YIELD declarative # is converted to a ListExpr and the TestRunner compares # it to Secondo's actual output by calling # NestedList->Equal # 1 - Tests for Object-creation within relations #testcase touncertain1 #yields success let CTrains = Trains feed krdup[Line] projectextend[Id, Line; CTrip: touncertain(.Trip, 22.5)] consume #testcase touncertain2 #yields success let CTrains20 = Trains feed projectextend[Id, Line; CTrip: touncertain(.Trip, 22.5)] head[20] consume #testcase generalize1 #yields success let HTrains = Trains feed krdup[Line] projectextend[Id, Line; HTrip: generalize(.Trip, 30.0, 3.0)] consume #testcase generalize2 #yields success let HTrains20 = Trains feed projectextend[Id, Line; HTrip: generalize(.Trip, 30.0, 3.0)] head[20] consume #testcase reduce_hierarchy1 #yields success let HCTrains = HTrains feed projectextend[Id, Line; HCTrip: reduce_hierarchy(.HTrip, 90.0)] consume #testcase reduce_hierarchy2 #yields success let HCTrains20 = HTrains20 feed projectextend[Id, Line; HCTrip: reduce_hierarchy(.HTrip, 90.0)] consume # 2 - Creation of result-objects let resultDEFTIME10 = Trains feed projectextend[Id, Line; DEFTIME: deftime(.Trip)] head[10] consume let resultDEFTIME = Trains feed krdup[Line] projectextend[Id, Line; DEFTIME: deftime(.Trip)] consume let resultPRESENTinstant10 = Trains feed projectextend[Id, Line; PRESENT: .Trip present six30] head[10] consume let resultPRESENTinstant = Trains feed krdup[Line] projectextend[Id, Line; PRESENT: .Trip present six30] consume let resultPRESENTperiods10 = Trains feed projectextend[Id, Line; PRESENT: .Trip present six10_six30] head[10] consume let resultATPERIODSone43one56 = Trains feed projectextend[Id, Line; ATPERIODS: .Trip atperiods one43one56] head[10] consume let resultATPERIODSsix10_six30 = Trains feed projectextend[Id, Line; ATPERIODS: .Trip atperiods six10_six30] head[10] consume # 3 - Tests for Operator 'deftime': #testcase DEFTIME_cmpoint1 #yields *resultDEFTIME10 query Trains feed projectextend[Id, Line; DEFTIME: deftime(touncertain(.Trip, 22.5))] head[10] consume #testcase DEFTIME_cmpoint2 #yields *resultDEFTIME10 query CTrains20 feed projectextend[Id, Line; DEFTIME: deftime(.CTrip)] head[10] consume #testcase DEFTIME_hmpoint1 #yields *resultDEFTIME query Trains feed krdup[Line] projectextend[Id, Line; DEFTIME: deftime(generalize(.Trip, 30.0, 3.0))] consume #testcase DEFTIME_hmpoint2 #yields *resultDEFTIME query HTrains feed projectextend[Id, Line; DEFTIME: deftime(.HTrip)] consume #testcase DEFTIME_hcmpoint1 #yields *resultDEFTIME query Trains feed krdup[Line] projectextend[Id, Line; DEFTIME: deftime(reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0))] consume #testcase DEFTIME_hcmpoint2 #yields *resultDEFTIME query HCTrains feed projectextend[Id, Line; DEFTIME: deftime(.HCTrip)] consume # 4 - Tests for Operator 'trajectory' # 5 - Tests for Operator 'present' #testcase PRESENTinstant_cmpoint1 #yields *resultPRESENTinstant10 query Trains feed projectextend[Id, Line; PRESENT: (touncertain(.Trip, 22.5) present six30)] head[10] consume #testcase PRESENTinstant_cmpoint2 #yields *resultPRESENTinstant10 query CTrains20 feed projectextend[Id, Line; PRESENT: .CTrip present six30] head[10] consume #testcase PRESENTinstant_hmpoint1 #yields *resultPRESENTinstant10 query Trains feed projectextend[Id, Line; PRESENT: (generalize(.Trip, 30.0, 2.5) present six30)] head[10] consume #testcase PRESENTinstant_hmpoint2 #yields *resultPRESENTinstant query HTrains feed projectextend[Id, Line; PRESENT: .HTrip present six30] consume #testcase PRESENTinstant_hcmpoint1 #yields *resultPRESENTinstant10 query Trains feed projectextend[Id, Line; PRESENT: (reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0) present six30)] head[10] consume #testcase PRESENTinstant_hcmpoint2 #yields *resultPRESENTinstant10 query HCTrains20 feed projectextend[Id, Line; PRESENT: .HCTrip present six30] head[10] consume #testcase PRESENTperiods_cmpoint1 #yields *resultPRESENTperiods10 query Trains feed projectextend[Id, Line; PRESENT: touncertain(.Trip, 22.5) present six10_six30] head[10] consume #testcase PRESENTperiods_cmpoint2 #yields *resultPRESENTperiods10 query CTrains20 feed projectextend[Id, Line; PRESENT: .CTrip present six10_six30] head[10] consume #testcase PRESENTperiods_hcmpoint1 #yields *resultPRESENTperiods10 query Trains feed projectextend[Id, Line; PRESENT: generalize(.Trip, 30.0, 3.0) present six10_six30] head[10] consume #testcase PRESENTperiods_hcmpoint2 #yields *resultPRESENTperiods10 query HTrains20 feed projectextend[Id, Line; PRESENT: .HTrip present six10_six30] head[10] consume #testcase PRESENTperiods_hcmpoint1 #yields *resultPRESENTperiods10 query Trains feed projectextend[Id, Line; PRESENT: (reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0) present six10_six30)] head[10] consume #testcase PRESENTperiods_hcmpoint2 #yields *resultPRESENTperiods10 query HCTrains20 feed projectextend[Id, Line; PRESENT: .HCTrip present six10_six30] head[10] consume # 6 - Tests for Operator 'd_passes' #testcase D_PASSESpoint_cmpoint1 #yields ( (rel (tuple ( (Id int) (Line int) (D_PASSES bool)))) (\ (1 1 FALSE)\ (30 2 FALSE)\ (70 4 FALSE)\ (110 5 FALSE)\ (131 6 FALSE)\ (152 7 FALSE)\ (192 8 FALSE)\ (213 9 FALSE)\ (253 15 FALSE)\ (282 1 FALSE)\ (311 2 FALSE)\ (351 4 FALSE)\ (391 5 FALSE)\ (412 6 FALSE)\ (433 7 FALSE)\ (473 8 FALSE)\ (494 9 FALSE)\ (534 15 FALSE))) query Trains feed krdup[Line] projectextend[Id, Line; D_PASSES: (touncertain(.Trip, 22.5) d_passes mehringdamm)] consume let resultD_PASSESpoint = Trains feed krdup[Line] projectextend[Id, Line; D_PASSES: (touncertain(.Trip, 22.5) d_passes mehringdamm)] consume #testcase D_PASSESpoint_cmpoint2 #yields *resultD_PASSESpoint query CTrains feed projectextend[Id, Line; D_PASSES: .CTrip d_passes mehringdamm] consume #testcase D_PASSESpoint_hmpoint1 #yields ( (rel (tuple ( (Id int) (Line int) (PASSES bool)))) (\ (1 1 FALSE)\ (30 2 FALSE)\ (70 4 FALSE)\ (110 5 FALSE)\ (131 6 TRUE)\ (152 7 TRUE)\ (192 8 FALSE)\ (213 9 FALSE)\ (253 15 FALSE)\ (282 1 FALSE)\ (311 2 FALSE)\ (351 4 FALSE)\ (391 5 FALSE)\ (412 6 TRUE)\ (433 7 TRUE)\ (473 8 FALSE)\ (494 9 FALSE)\ (534 15 FALSE))) query Trains feed krdup[Line] projectextend[Id, Line; PASSES: (generalize(.Trip, 30.0, 2.5) d_passes mehringdamm)] consume let resultPASSESpoint = Trains feed krdup[Line] projectextend[Id, Line; PASSES: (generalize(.Trip, 30.0, 2.5) d_passes mehringdamm)] consume #testcase D_PASSESpoint_hmpoint2 #yields *resultPASSESpoint query HTrains feed projectextend[Id, Line; PASSES: .HTrip d_passes mehringdamm] consume #testcase D_PASSESpoint_hcmpoint1 #yields *resultD_PASSESpoint query Trains feed krdup[Line] projectextend[Id, Line; D_PASSES: (reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0) d_passes mehringdamm)] consume #testcase D_PASSESpoint_hcmpoint2 #yields *resultD_PASSESpoint query HCTrains feed projectextend[Id, Line; D_PASSES: .HCTrip d_passes mehringdamm] consume #testcase D_PASSESregion_cmpoint1 #yields ( (rel (tuple ( (Id int) (Line int) (D_PASSES bool)))) (\ (1 1 FALSE)\ (30 2 FALSE)\ (70 4 FALSE)\ (110 5 FALSE)\ (131 6 FALSE)\ (152 7 FALSE)\ (192 8 FALSE)\ (213 9 TRUE)\ (253 15 FALSE)\ (282 1 FALSE)\ (311 2 FALSE)\ (351 4 FALSE)\ (391 5 FALSE)\ (412 6 FALSE)\ (433 7 FALSE)\ (473 8 FALSE)\ (494 9 TRUE)\ (534 15 FALSE))) query Trains feed krdup[Line] projectextend[Id, Line; D_PASSES: (touncertain(.Trip, 22.5) d_passes tiergarten)] consume let resultPASSESregion = Trains feed krdup[Line] projectextend[Id, Line; PASSES: (touncertain(.Trip, 22.5) d_passes tiergarten)] consume #testcase D_PASSESregion_cmpoint2 #yields *resultPASSESregion query CTrains feed projectextend[Id, Line; PASSES: .CTrip d_passes tiergarten] consume #testcase D_PASSESregion_hmpoint1 #yields *resultPASSESregion query Trains feed krdup[Line] projectextend[Id, Line; PASSES: (generalize(.Trip, 30.0, 2.5) d_passes tiergarten)] consume #testcase D_PASSESregion_hmpoint2 #yields *resultPASSESregion query HTrains feed projectextend[Id, Line; PASSES: .HTrip d_passes tiergarten] consume #testcase PASSESregion_hmpoint1 #yields *resultPASSESregion query Trains feed krdup[Line] projectextend[Id, Line; PASSES: (generalize(.Trip, 30.0, 2.5) passes tiergarten)] consume #testcase PASSESregion_hmpoint2 #yields *resultPASSESregion query HTrains feed projectextend[Id, Line; PASSES: .HTrip passes tiergarten] consume #testcase D_PASSESregion_hcmpoint1 #yields *resultPASSESregion query Trains feed krdup[Line] projectextend[Id, Line; PASSES: reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0) d_passes tiergarten] consume #testcase D_PASSESregion_hcmpoint2 #yields *resultPASSESregion query HCTrains feed projectextend[Id, Line; PASSES: .HCTrip d_passes tiergarten] consume # 7 - Tests for Operator 'p_passes' #testcase P_PASSESpoint_cmpoint1 #yields *resultPASSESpoint query Trains feed krdup[Line] projectextend[Id, Line; PASSES: (touncertain(.Trip, 22.5) p_passes mehringdamm)] consume #testcase P_PASSESpoint_cmpoint2 #yields *resultPASSESpoint query CTrains feed projectextend[Id, Line; PASSES: .CTrip p_passes mehringdamm] consume #testcase P_PASSESpoint_hmpoint1 #yields error query HTrains feed projectextend[Id, Line; P_PASSES: .HTrip p_passes mehringdamm] consume #testcase P_PASSESpoint_hcmpoint1 #yields *resultPASSESpoint query Trains feed krdup[Line] projectextend[Id, Line; PASSES: reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0) p_passes mehringdamm] consume #testcase P_PASSESpoint_hcmpoint2 #yields *resultPASSESpoint query HCTrains feed projectextend[Id, Line; PASSES: .HCTrip p_passes mehringdamm] consume #testcase P_PASSESregion_cmpoint1 #yields *resultPASSESregion query Trains feed krdup[Line] projectextend[Id, Line; PASSES: (touncertain(.Trip, 22.5) p_passes tiergarten)] consume #testcase P_PASSESregion_cmpoint2 #yields *resultPASSESregion query CTrains feed projectextend[Id, Line; PASSES: .CTrip p_passes tiergarten] consume #testcase P_PASSESregion_hmpoint1 #yields error query Trains feed krdup[Line] projectextend[Id, Line; P_PASSES: (generalize(.Trip, 30.0, 2.5) p_passes tiergarten)] consume #testcase P_PASSESpoint_hcmpoint1 #yields *resultPASSESregion query Trains feed krdup[Line] projectextend[Id, Line; PASSES: reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0) p_passes tiergarten] consume #testcase P_PASSESpoint_hcmpoint2 #yields *resultPASSESregion query HCTrains feed projectextend[Id, Line; PASSES: .HCTrip p_passes tiergarten] consume # 8 - Tests for Operator 'atinstant' # 9 - Tests for Operator 'atperiods' #testcase ATPERIODS_cmpoint1 #yields success let resultATPERIODSone43 = Trains feed krdup[Line] projectextend[Id, Line; ATPERIODS: (touncertain(.Trip, 22.5)) atperiods one43one56] consume #testcase ATPERIODS_cmpoint2 #yields *resultATPERIODSone43 query CTrains feed projectextend[Id, Line; ATPERIODS: .CTrip atperiods one43one56] consume #testcase ATPERIODS_cmpoint3 #yields success let resultATPERIODSsix10 = Trains feed krdup[Line] projectextend[Id, Line; ATPERIODS: (touncertain(.Trip, 22.5)) atperiods six10_six30] consume #testcase ATPERIODS_cmpoint4 #yields *resultATPERIODSsix10 query CTrains feed projectextend[Id, Line; ATPERIODS: .CTrip atperiods six10_six30] consume #testcase ATPERIODS_hmpoint1 #yields *resultATPERIODSone43one56 query Trains feed projectextend[Id, Line; ATPERIODS: (generalize(.Trip, 30.0, 2.5)) atperiods one43one56] head[10] consume #testcase ATPERIODS_hmpoint2 #yields *resultATPERIODSone43one56 query HTrains20 feed projectextend[Id, Line; ATPERIODS: .HTrip atperiods one43one56] head[10] consume #testcase ATPERIODS_hmpoint3 #yields *resultATPERIODSsix10_six30 query Trains feed projectextend[Id, Line; ATPERIODS: (generalize(.Trip, 30.0, 2.5)) atperiods six10_six30] head[10] consume #testcase ATPERIODS_hmpoint4 #yields *resultATPERIODSsix10_six30 query HTrains20 feed projectextend[Id, Line; ATPERIODS: .HTrip atperiods six10_six30] head[10] consume #testcase ATPERIODS_hcmpoint1 #yields success let resultATPERIODSone43HC = Trains feed projectextend[Id, Line; ATPERIODS: (reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0)) atperiods one43one56] head[10] consume #testcase ATPERIODS_hcmpoint2 #yields *resultATPERIODSone43HC query HCTrains20 feed projectextend[Id, Line; ATPERIODS: .HCTrip atperiods one43one56] head[10] consume #testcase ATPERIODS_hcmpoint3 #yields success let resultATPERIODSsix10HC = Trains feed projectextend[Id, Line; ATPERIODS: (reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0)) atperiods six10_six30] head[10] consume #testcase ATPERIODS_hcmpoint4 #yields *resultATPERIODSsix10HC query HCTrains20 feed projectextend[Id, Line; ATPERIODS: .HCTrip atperiods six10_six30] head[10] consume # 10 - Tests for Operator 'd_at' #testcase D_ATpoint_cmpoint1 #yields ( (rel (tuple ( (Id int) (Line int) (D_AT cmpoint))))\ ( (1 1 ()) (30 2 ()) (70 4 ()) (110 5\ ()) (131 6 ()) (152 7 ()) (192 8 ()) (213 9 ()) (253 15 ()) (282 1 ()) (311 2\ ()) (351 4 ()) (391 5 ()) (412 6 ()) (433 7 ()) (473 8 ()) (494 9 ()) (534 15 ()))) query Trains feed krdup[Line] projectextend[Id, Line; D_AT: (touncertain(.Trip, 22.5) d_at mehringdamm)] consume #testcase D_ATpoint_cmpoint2 #yields ( (rel (tuple ( (Id int) (Line int) (D_AT cmpoint))))\ ( (1 1 ()) (30 2 ()) (70 4 ()) (110 5\ ()) (131 6 ()) (152 7 ()) (192 8 ()) (213 9 ()) (253 15 ()) (282 1 ()) (311 2\ ()) (351 4 ()) (391 5 ()) (412 6 ()) (433 7 ()) (473 8 ()) (494 9 ()) (534 15 ()))) query CTrains feed projectextend[Id, Line; D_AT: .CTrip d_at mehringdamm] consume #testcase D_ATregion_cmpoint1 #yields success let resultD_ATregionC = Trains feed krdup[Line] projectextend[Id, Line; D_AT: (touncertain(.Trip, 22.5) d_at tiergarten)] consume #testcase D_ATregion_cmpoint2 #yields *resultD_ATregionC query CTrains feed projectextend[Id, Line; D_AT: .CTrip d_at tiergarten] consume #testcase D_ATpoint_hmpoint1 #yields success let resultD_ATpointH = Trains feed krdup[Line] projectextend[Id, Line; D_AT: (generalize(.Trip, 30.0, 2.5) d_at mehringdamm)] consume #testcase D_ATpoint_hmpoint2 #yields *resultD_ATpointH query HTrains feed projectextend[Id, Line; D_AT: .HTrip d_at mehringdamm] consume #testcase D_ATregion_hmpoint1 #yields success let resultD_ATregionH = Trains feed krdup[Line] projectextend[Id, Line; D_AT: (generalize(.Trip, 30.0, 2.5) d_at tiergarten)] consume #testcase D_ATregion_hmpoint2 #yields *resultD_ATregionH query HTrains feed projectextend[Id, Line; D_AT: .HTrip d_at tiergarten] consume #testcase D_ATpoint_hcmpoint1 #yields ( (rel (tuple ( (Id int) (Line int) (D_AT cmpoint))))\ ( (1 1 ()) (30 2 ()) (70 4 ()) (110 5\ ()) (131 6 ()) (152 7 ()) (192 8 ()) (213 9 ()) (253 15 ()) (282 1 ()) (311 2\ ()) (351 4 ()) (391 5 ()) (412 6 ()) (433 7 ()) (473 8 ()) (494 9 ()) (534 15 ()))) query Trains feed krdup[Line] projectextend[Id, Line; D_AT: (reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0) d_at mehringdamm)] consume #testcase D_ATpoint_hcmpoint2 #yields ( (rel (tuple ( (Id int) (Line int) (D_AT cmpoint))))\ ( (1 1 ()) (30 2 ()) (70 4 ()) (110 5\ ()) (131 6 ()) (152 7 ()) (192 8 ()) (213 9 ()) (253 15 ()) (282 1 ()) (311 2\ ()) (351 4 ()) (391 5 ()) (412 6 ()) (433 7 ()) (473 8 ()) (494 9 ()) (534 15 ()))) query HCTrains feed projectextend[Id, Line; D_AT: .HCTrip d_at mehringdamm] consume #testcase D_ATregion_hcmpoint1 #yields success let resultD_ATregionHC = Trains feed krdup[Line] projectextend[Id, Line; D_AT: (reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0) d_at tiergarten)] consume #testcase D_ATregion_hcmpoint2 #yields *resultD_ATregionHC query HCTrains feed projectextend[Id, Line; D_AT: .HCTrip d_at tiergarten] consume # 11 - Tests for Operator 'p_at' #testcase P_ATpoint_cmpoint1 #yields success let resultP_ATpointC = Trains feed krdup[Line] projectextend[Id, Line; P_AT: (touncertain(.Trip, 22.5) p_at mehringdamm)] consume #testcase P_ATpoint_cmpoint2 #yields *resultP_ATpointC query CTrains feed projectextend[Id, Line; P_AT: .CTrip p_at mehringdamm] consume #testcase P_ATregion_cmpoint1 #yields success let resultP_ATregionC = Trains feed krdup[Line] projectextend[Id, Line; P_AT: (touncertain(.Trip, 22.5) p_at tiergarten)] consume #testcase P_ATregion_cmpoint2 #yields *resultP_ATregionC query CTrains feed projectextend[Id, Line; P_AT: .CTrip p_at tiergarten] consume #testcase P_ATpoint_hmpoint1 #yields error query HTrains feed projectextend[Id, Line; P_AT: .HTrip p_at mehringdamm] consume #testcase P_ATpoint_hmpoint2 #yields error query HTrains feed projectextend[Id, Line; P_AT: .HTrip p_at tiergarten] consume #testcase P_ATpoint_hcmpoint1 #yields success let resultP_ATpointHC = Trains feed krdup[Line] projectextend[Id, Line; P_AT: (reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0) p_at mehringdamm)] consume #testcase P_ATpoint_hcmpoint2 #yields *resultP_ATpointHC query HCTrains feed projectextend[Id, Line; P_AT: .HCTrip p_at mehringdamm] consume #testcase P_ATregion_hcmpoint1 #yields success let resultP_ATregionHC = Trains feed krdup[Line] projectextend[Id, Line; P_AT: (reduce_hierarchy(generalize(.Trip, 30.0, 3.0), 90.0) p_at tiergarten)] consume #testcase P_ATregion_hcmpoint2 #yields *resultP_ATregionHC query HCTrains feed projectextend[Id, Line; P_AT: .HCTrip p_at tiergarten] consume #teardown delete CTrains; delete CTrains20; delete HTrains; delete HTrains20; delete HCTrains; delete HCTrains20; delete resultDEFTIME10; delete resultDEFTIME; delete resultPRESENTinstant10; delete resultPRESENTinstant; delete resultPRESENTperiods10; delete resultPASSESregion; delete resultD_PASSESpoint; delete resultPASSESpoint; delete resultATPERIODSone43one56; delete resultATPERIODSone43 delete resultATPERIODSsix10_six30; delete resultATPERIODSsix10; delete resultATPERIODSone43HC; delete resultATPERIODSsix10HC; delete resultD_ATregionC; delete resultD_ATpointH; delete resultD_ATregionH; delete resultD_ATregionHC; delete resultP_ATpointC; delete resultP_ATregionC; delete resultP_ATpointHC; delete resultP_ATregionHC;