User Tools

Site Tools


netweaver:tutorials:linking_databases_to_knowledge-based_models

Cascades Lake Chemistry Knowledge Base

Now we will show you how to analyze your data with NetWeaver. For this exercise we will use the Cascades Lake Chemistry knowledge base and corresponding lake chemistry data. The Cascades knowledge base is a peer-reviewed knowledge base that analyzes chemistry of lakes in Montana and Idaho, USA to determine their sensitivity and potential to be impacted by acid rain (acid deposition). A brief summary of the Cascades Lake Chemistry knowledge base follows:

Main goal group

  • Surface Water Sensitivity – The top-level dependency networks grouped so we can view the results for each dependency network collectively.

Top-level dependency networks

  • Sensitive/unimpacted Lake – The potential for change in lakes unimpacted by acid sources that may be impacted in the future. (These are the lakes that need to be protected.)
  • Geologic Sulfur Influenced – Lakes impacted by mine drainage, or geological sulfur, etc.
  • Natural Organic Acid Influenced – Lakes already acidic due to natural organic causes.
  • Insensitive to Acidity – Lakes with plenty of buffering potential
  • Disturbance/landuse Impacted – Impacts other than those from geologic sulfur and mining. e.g. forest fires, insect infestations, blowdown, (stuff that leaks nitrogen)
  • Potentially Acid Dep. Impacted – Lakes apparently already suffering from acid deposition.
  • ANC – What is the lake's baseflow ANC in micro eq/liter?
  • Conductivity – lake Conductivity (micro-siemens per centimeter).
  • DOC – What is the dissolved organic content in mg/l?
  • NO3 – What is the nitrate level in micro eq/l?
  • pH – Current pH
  • SO4 – What is the sulfate level in micro eq/l?

Lake Chemistry Data

The sample data set for the Cascades knowledge base is the table “Cascades” in the Access database “LakeChem_US.mdb”. Experts collected the data from lakes in the Cascades region in the mid 1990’s and used them in the peer-reviewing process. A sample of the data appears in figure 1. Other data sets are included in the LakeChem_US database. The “US Lakes” table combines each regional data set into one table.

Figure 1: A snapshot of the first few rows of the Cascades table in LakeChem_US.mdb.

Open the Knowledge Base

Close any windows you may have open in NetWeaver Developer. Open the Cascades Lake Chemistry knowledge base (Cascades.nw2) provided with the samples. You should see a knowledge base window (figure 2) Now open the goal group “Surface Water Sensitivity” by double clicking on it. You should now have the goal group window open (figure 3).

Figure 2: Cascades Lake Chemistry knowledge base.

Figure 3: Surface Water Sensitivity goal group window.

Select Data Sources

Now we will connect the lake chemistry data to the knowledge base. Open the Database Connection Setup window (figure 4) by selecting Configure Links to Databases… from the Data menu, or by pressing the database links button on the application/knowledge base toolbar. This window has two tabs: Data Sources and Links to Data. We will start by identifying our data source, the Cascades table within LakeChem_US.mdb. From the Database Tables toolbar on the Data Sources tab click the Add Database Tables button to open the Add Database Tables window (figure 5).

Our database, being an Access database is file-based, so click on the File DBs menu and select Access (*.mdb) to open a file selection dialog (figure 6). Navigate to and select (open) LakeChem_US.mdb. You will see a credentials dialog (figure 7) for providing a username and password when needed. This database is not secured, so you can just dismiss this dialog. The Add Database Tables window should now display a list of the database tables within LakeChem_US.mdb (figure 8).

From the list of tables within the database select Cascades. You will see a preview of its contents on the right. Click the Add button to add the Cascades table as a data source. Now close the window. Cascades should now be listed in the Data Sources list in the Database Connection window (figure 9).

Figure 4: The empty database connection setup window.

Figure 5: The add database tables window.

Figure 6: File open dialog with LakeChem_US.mdb selected.

Figure 7: The credentials dialog for logging into a secured database.

Figure 8: Add database tables window with LackChem_US.mdb loaded.  It shows a list of the tables within the database and previews the contents of the selected database table.

Figure 9: The database connection window with Cascades in the database table list on the Data Sources tab.

Link to the Data

If you double click on Cascades in the database table list, a database browser will open (figure 10). You might notice that the field names are somewhat “old style” in that they are all uppercase, no spaces, and limited to 10 characters. That is because the data was originally delivered in dBase (*.dbf) format and we opted to leave the field names as they were delivered.

Go back to the Database Connection window (figure 9) and switch to the Links to Data tab (figure 11). We now need to tell each data link from which database table and field to get its data. For the first data link, ANC, click in the Table cell and select Cascades from the drop down menu.

NetWeaver tries to guess which field in the database table matches the data link by calculating how similar the names are. In this case NetWeaver chose ANC_ field from the database table as a match for ANC (figure 12), which is correct. Had this not been correct, you could have used the drop down menu for the field to select the correct one.

Now we will do the rest of the connections the easy way. From the Database Tables menu in the database connection toolbar, select the submenu Apply to all inputs…, and from here select Cascades. (Obviously this only works when you have only one table to connect to all of the data links.) At this point the database connections are complete and the database connection window should look like figure 13 with all tables and fields assigned.

Now that the database connections are complete you might want to save this configuration for later use by clicking the save button in the database connection window's toolbar.

Figure 10: The Cascades table open in a database browser.

Figure 11: The database connection window open to the Links to Data tab.  Note the list of data links and that their color is red.  Red signifies that they are not yet linked to any data.

Figure 12: The database connection window showing the database connections for ANC.  Note the data is from the first row of the Cascades database table.

Figure 13: The database connection window will all data links hooked up to their data sources.

Use the Data

Now we are all set to browse through the Cascades data and see how the lakes fare. Figures 14 & 15 illustrate two lakes with different sensitivities to acid deposition.

Figure 14: Surface Water Sensitivity for Black Lake.  This is a lake that not impacted and is insensitive to acidity.  This lake is okay now and likely will stay that way.

Figure 15: Surface Water Sensitivity for Hidden Lakes (Eastern).  This lake is sensitive lake and it is not yet impacted by acidity.  In other words, this lake is a candidate for further monitoring and protection.