From 6c73323e71ef58490176a6fa5ac1e797c15bbcae Mon Sep 17 00:00:00 2001 From: Farrukh14 Date: Thu, 27 Jun 2024 03:40:39 -0700 Subject: [PATCH] Exercise 5 --- exercises/exercise5.jv | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 exercises/exercise5.jv diff --git a/exercises/exercise5.jv b/exercises/exercise5.jv new file mode 100644 index 0000000000..29f258fda6 --- /dev/null +++ b/exercises/exercise5.jv @@ -0,0 +1,68 @@ +pipeline GTFS{ + + httpExtractor -> file_selection-> text_transformer ->text_interpreter -> column_removal -> headers -> sql_db; + + block httpExtractor oftype GTFSExtractor{ + url:"https://gtfs.rhoenenergie-bus.de/GTFS.zip"; + } + + + + block file_selection oftype FilePicker{ + path:"/stops.txt"; + } + + + block text_transformer oftype TextFileInterpreter{ + encoding: "utf8"; +} + + block text_interpreter oftype CSVInterpreter{ + delimiter:","; + enclosing:'"'; +} + +block column_removal oftype ColumnDeleter { + delete: [column B, column D,column H, column I,column J, column K,column L]; + } + + + + block headers oftype TableInterpreter{ + header: false; + columns:[ + "stop_id" oftype integer, + "stop_name" oftype text, + "stop_lat" oftype GeoPointValue, + "stop_lon" oftype GeoPointValue, + "zone_id" oftype zoneValue + ]; + } + + block sql_db oftype SQLiteLoader{ + table:"stops"; + file:"./gtfs.sqlite"; + } + + valuetype zoneValue oftype integer{ + constraints:[ + zoneSelector + ]; + } + + constraint zoneSelector on integer: + value == 1645; + + + constraint GeoPoints oftype RangeConstraint { + lowerBound: -90; + upperBound: 90; + } + valuetype GeoPointValue oftype decimal { + constraints: [ + GeoPoints + ]; + } + + +} \ No newline at end of file