# These are all the test-querys from the algebra. # The automaic run of this file will last for a few minutes! # 3.3.1 Test isempty for mbool, mint, mstring, mreal, mpoint and mregion query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Emp: isempty(.Trip_t2)] project [Id_t1, Id_t2, Emp] count; query Trains feed {t1} head[5] Trains feed {t2} head[5] product project [Id_t1, Id_t2] count; # 3.4.1 Test = and # for mbool/mbool, mint/mint and mstring/mstring query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] extend[Eq: .Empty1 = .Empty2] project [Id_t1, Id_t2, Empty1, Eq] count; query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] project [Id_t1, Id_t2, Empty1, Empty2] count; # 3.4.2 Test = and # for mbool/bool, mint/int and mstring/string query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] extend[Eq: .Empty1 = TRUE] project [Id_t1, Id_t2, Empty1, Eq] count; # 3.4.3 Test = and # for mreal/mreal query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] extend[Eq: .Dist1 = .Dist2] project [Id_t1, Id_t2, Dist1, Dist2, Eq] count; query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] project [Id_t1, Id_t2, Dist1, Dist2] count; # 3.4.4 Test = and # for mreal/real query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] extend[Eq: .Dist1 = 1000.0] project [Id_t1, Id_t2, Dist1, Dist2, Eq] count; # 3.4.5 Test = and # for mpoint/mpoint query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Meet: .Trip_t1 = .Trip_t2] project [Id_t1, Id_t2, Meet] count; query Trains feed {t1} head[5] Trains feed {t2} head[5] product project [Id_t1, Id_t2] count; # 3.4.6 Test = and # for mpoint/point query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Meet: mehringdamm = .Trip_t2] project [Id_t1, Id_t2, Meet] count; # 3.4.7 Test = and # for mregion/mregion query Trains feed head[5] extend[Eq: msnow = mrain] project [Id, Eq] count; query Trains feed head[5] extend[Eq: TRUE] project [Id, Eq] count; # 3.4.8 Test = and # for mregion/region query Trains feed head[5] extend[Eq: msnow = zoogarten] project [Id, Eq] count; let snow8 = val(msnow atinstant eight); query Trains feed head[5] extend[Eq: msnow = snow8] project [Id, Eq] count; # 3.5.1 Test inside for mregion/points and mregion/line query Trains feed {t1} head[5] UBahn feed {u2} head[5] product extend[Ins: mrain inside .geoData_u2] project [Id_t1, Name_u2, Ins] count; query Trains feed {t1} head[5] UBahn feed {u2} head[5] product project [Id_t1, Name_u2] count; # 3.5.2 Test inside for mpoint/points let pts = [const points value((9396 9871)(16821 1252)(-3560 14235))]; query Trains feed {t1} head[5] UBahn feed {u2} head[5] product extend[Ins: .Trip_t1 inside pts] project[Id_t1, Name_u2, Ins] count; query Trains feed {t1} head[5] UBahn feed {u2} head[5] product project[Id_t1, Name_u2] count; # 3.5.3 Test inside for mpoint/line query Trains feed {t1} head[5] UBahn feed {u2} head[5] product extend[Ins: .Trip_t1 inside .geoData_u2] project[Id_t1, Name_u2, Ins] count; # 3.7.1 Test intersection for mbool/mbool, mint/mint and mstring/mstring query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] extend[Inter: intersection(.Empty1, .Empty2)] project [Id_t1, Id_t2, Empty1, Inter] count; query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] project [Id_t1, Id_t2, Empty1, Empty2] count; # 3.7.2 Test intersection for mbool/bool, mint/int and mstring/string query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] extend[Inter: intersection(.Empty1, TRUE)] project [Id_t1, Id_t2, Empty1, Inter] count; # 3.7.3 Test intersection for mreal/mreal query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] extend[Inter: intersection(.Dist1, .Dist2)] project [Id_t1, Id_t2, Dist1, Dist2, Inter] count; query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] project [Id_t1, Id_t2, Dist1, Dist2] count; # 3.7.4 Test intersection for mreal/real query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] extend[Inter: intersection(.Dist1, 1000.0)] project [Id_t1, Id_t2, Dist1, Dist2, Inter] count; # 3.7.5 Test intersection mpoint/points query Trains feed {t1} head[5] UBahn feed {u2} head[5] product extend[Inter: intersection(.Trip_t1, pts)] project[Id_t1, Name_u2, Inter] count; query Trains feed {t1} head[5] UBahn feed {u2} head[5] product project[Id_t1, Name_u2] count; # 3.7.6 Test inersection for mpoint/line query Trains feed {t1} head[5] UBahn feed {u2} head[5] product extend[Inter: intersection(.Trip_t1, .geoData_u2)] project[Id_t1, Name_u2, Inter] count; # 3.9.1 Test minus for mbool/mbool, mint/mint and mstring/mstring query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] extend[Minus: .Empty1 minus .Empty2] project [Id_t1, Id_t2, Empty1, Minus] count; query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] project [Id_t1, Id_t2, Empty1, Empty2] count; # 3.9.2 Test minus for mbool/bool, mint/int and mstring/string query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] extend[Minus: .Empty1 minus TRUE] project [Id_t1, Id_t2, Empty1, Minus] count; # 3.9.3 Test minus for mreal/mreal query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] extend[Minus: .Dist1 minus .Dist2] project [Id_t1, Id_t2, Dist1, Dist2, Minus] count; query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] project [Id_t1, Id_t2, Dist1, Dist2] count; # 3.9.4 Test minus for mreal/real query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] extend[Minus: .Dist1 minus 1000.0] project [Id_t1, Id_t2, Dist1, Dist2, Minus] count; # 3.9.5 Test minus for mpoint/mpoint query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Minus: .Trip_t1 minus .Trip_t2] project [Id_t1, Id_t2, Minus] count; query Trains feed {t1} head[5] Trains feed {t2} head[5] product project [Id_t1, Id_t2] count; # 3.9.6 Test minus for mpoint/point query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Minus: .Trip_t1 minus mehringdamm] project [Id_t1, Id_t2, Minus] count; # 3.9.7 Test minus for point/mpoint query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Minus: mehringdamm minus .Trip_t1 ] project [Id_t1, Id_t2, Minus] count; # 3.10.1 Test rough_center query Trains feed {t1} head[5] UBahn feed {u2} head[5] product extend[rc: rough_center(msnow)] project[Id_t1, Name_u2, rc] count; query Trains feed {t1} head[5] UBahn feed {u2} head[5] product project[Id_t1, Name_u2] count; let mrg1 = [const movingregion value (((0.0 2.0 TRUE TRUE)((((0.0 0.0 0.0 0.0)(0.0 120.0 0.0 120.0)(10.0 120.0 30.0 120.0)(10.0 110.0 30.0 90.0)(120.0 110.0 120.0 90.0)(120.0 0.0 120.0 0.0)))))((2.0 4.0 FALSE TRUE)((((0.0 0.0 0.0 0.0)(0.0 120.0 0.0 120.0)(30.0 120.0 50.0 120.0)(30.0 90.0 50.0 70.0)(120.0 90.0 120.0 70.0)(120.0 0.0 120.0 0.0)))))((4.0 6.0 FALSE TRUE)((((0.0 0.0 0.0 0.0)(0.0 120.0 0.0 120.0)(50.0 120.0 70.0 120.0)(50.0 70.0 70.0 50.0)(120.0 70.0 120.0 50.0)(120.0 0.0 120.0 0.0)))))((6.0 8.0 FALSE TRUE)((((0.0 0.0 0.0 0.0)(0.0 120.0 0.0 120.0)(70.0 120.0 90.0 120.0)(70.0 50.0 90.0 30.0)(120.0 50.0 120.0 30.0)(120.0 0.0 120.0 0.0)))))((8.0 10.0 FALSE TRUE)((((0.0 0.0 0.0 0.0)(0.0 120.0 0.0 120.0)(90.0 120.0 110.0 120.0)(90.0 30.0 110.0 10.0)(120.0 30.0 120.0 10.0)(120.0 0.0 120.0 0.0))))))]; let mrg2 = [const movingregion value (((0.0 10.0 TRUE TRUE)((((150.0 0.0 150.0 0.0)(150.0 120.0 150.0 120.0)(160.0 120.0 260.0 120.0)(160.0 110.0 260.0 10.0)(270.0 110.0 270.0 10.0)(270.0 0.0 270.0 0.0))))))]; query mrg1; query mrg2; query trajectory(rough_center(mrg1)); query trajectory(rough_center(mrg2)); query rough_center(mrg1); query rough_center(mrg2); # 3.11.1 Test no_components for mregion query Trains feed {t1} head[5] UBahn feed {u2} head[5] product extend[nc: no_components(msnow)] project[Id_t1, Name_u2, nc] count; # 3.12.1 Test perimeter for mregion query Trains feed {t1} head[5] UBahn feed {u2} head[5] product extend[peri: perimeter(msnow)] project[Id_t1, Name_u2, peri] count; # 3.13.1 Test area for mregion query Trains feed {t1} head[5] UBahn feed {u2} head[5] product extend[Area: area(msnow)] project[Id_t1, Name_u2, Area] count; # 3.14.1 Test distance for mreal/mreal query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] extend[Dist: distance (.Dist1, .Dist2)] project [Id_t1, Id_t2, Dist1, Dist2, Dist] count; query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] project [Id_t1, Id_t2, Dist1, Dist2] count; # 3.14.2 Test distance for mreal/real query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist1: distance (.Trip_t1, mehringdamm)] extend[Dist2: distance(.Trip_t2, mehringdamm)] extend[Dist: distance(.Dist1, 1000.0)] project [Id_t1, Id_t2, Dist1, Dist2, Dist] count; # 3.14.3 Test distance for mpoint/mpoint query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Dist: distance (.Trip_t1, .Trip_t2)] project [Id_t1, Id_t2, Dist] count; # 3.15.1 Test and and or for mbool/mbool query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] extend[Or: .Empty1 or .Empty2] project [Id_t1, Id_t2, Empty1, Or] count; query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] project [Id_t1, Id_t2, Empty1, Empty2] count; # 3.15.2 Test and and or for mbool/bool query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: isempty(.Trip_t2)] extend[Or: .Empty1 or TRUE] project [Id_t1, Id_t2, Empty1, Or] count; # 3.15.1 Test not for mbool query Trains feed {t1} head[5] Trains feed {t2} head[5] product extend[Empty1: isempty (.Trip_t1)] extend[Empty2: not(isempty(.Trip_t2))] project [Id_t1, Id_t2, Empty1, Empty2] count; # 3.17.3 Test other operators let center2 = [const region value((((7500.0 9200.0)(7500.0 11500.0)(10700.0 11500.0)(10700.0 9200.0))))]; query Trains feed head[5] extend[AtCenter: .Trip at center2] filter[not(isempty(deftime(.AtCenter)))] extend[Time: periods2mint(deftime(.AtCenter))] aggregate[Time; fun(m1: mint, m2: mint) m1 + m2; zero()]; # 3.18.1 concat for mpoint/mpoint query Trains feed {t1} head[5] Trains feed {t2} head[5] product filter[ val(final(.Trip_t1)) = val(initial(.Trip_t2))] extend[Umsteig: .Trip_t1 .Trip_t2 concat] filter[not(isempty(deftime(.Umsteig)))] project [Id_t1, Id_t2, Umsteig] count; # delete new objects delete mrg1; delete mrg2; delete snow8; delete pts; delete center2;