M E T   O F F I C E   U . K .   W E A T H E R
As an example for a source dependent IO driver we include a driver that parses the Met Office Web site containing the latest U.K. weather observations. The driver is called METOFFICE. The following example shows how to set-up an archive for these weather observations.
Files
For this example you need the following files:
UKWEATHER.keys The key specification describing the output generated by the Web page parser.
Commands
In order to create a new archive for the U.K. Weather obervations use the following command:
CREATE ARCHIVE UKWEATHER OF XML HAVING PROPERTIES DEFAULT_SCHEMA=UKWEATHER.keys
You have to modify the path of the DEFAULT_SCHEMA depending on where you stored UKWEATHER.keys on your local machine.
To merge the current version of the MetOffice U.K. Weather observations into the new archive UKWEATHER use the following command:
INSERT INTO UKWEATHER FROM TYPE METOFFICE
The weather observations are generally updated every hour. In order to create an archive of multiple database versions re-execute the above command regularly. Modify the INSERT statement as shown below to avoid merging the same version of the data twice into the archive:
INSERT INTO UKWEATHER IF HAS CHANGES FROM TYPE METOFFICE
You can view the archive contents using the following simple query:
SELECT * FROM UKWEATHER
If you are interested in changes to the temperature reported by weather stations in Edinburgh you can use the following query:
SELECT L/NAME, L/TEMPERATURE
FROM UKWEATHER
WITH /UKWEATHER/REGION/LOCATION AS L
WHERE L/NAME MATCHES 'Edinburgh'