Epilog
What
versus
How
 

Introductory Tour of Sierrabase


1. Introduction

Sierra is a collection of related browser-based applications of use in developing rulesets and datasets encoded in Epilog. Each application allows users to view and edit datasets and/or rulesets and provides tools of various sorts for processing that information.

Sierrabase provides elementary tools for viewing and editing Epilog datasets. It includes tools for evaluating relational and functional queries on data and applying transformations to that data.

Sierralite provides elementary tools for viewing and editing rulesets as well as datasets. It includes tools for computing defined relations, evaluating defined functions, and applying defined operations. It is the most commonly used Sierra application. Click here for a brief tour of Sierralite.

Sierraplus provides elementary tools for satisfying relational constraints.

Sierraplan provides elementary tools for creating action plans in dynamic, single-agent environments.

Sierraplay provides elementary tools for selecting actions in dynamic, multi-agent environments.

Sierrameta provides tools for analyzing and transforming rules as well as data.

This document provides a brief introductory tour of Sierrabase. We show how to create and edit datasets; we show how to how to query and transform datasets programmatically; and we show how to save work for later use. We suggest performing the steps shown here in your own browser as we proceed through the tour.

2. Getting Started

Since Sierrabase is browser-based, we start by loading a suitable browser. (Sierrabase runs in Safari, Chrome, Firefox, and other popular browsers. In our examples here, we use Safari, though the appearance and interaction are virtually the same in all major browsers.) Once our browser is started, we load Sierrabase by going to the following URL.

http://epilog.stanford.edu/homepage/sierrabase.php

This brings up a page that looks like the following.

  Sierrabase
What
versus
How
 
        
Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh
Data
    

The Sierrabose window is divided into panes. The header pane (at the top) simply identifies the page as Sierrabase. The command bar (immediately below the header) allows the user to show and hide other panes. The tool panes appear below the command bar. When Sierrabase is loaded, only the Query pane and the Data pane are visible. The Transform pane can be made visible by clicking Transform in the command bar. The About pane can be made visible by clicking About. The small pane at the end of the page allows the user to save the current "configuration" for future reference; and it allows the user to load previously saved "configurations". In what follows, we describe these panes in greater detail, starting with the Data pane.

3. Data

The Data pane shows the contents of Sierrabase's current dataset. In the example below, we have populated the window with facts describing the initial state of a game of Tic Tac Toe. There are nine cells arranged in three rows and three columns, and all nine cells are blank in this state. There is also a fact stating that it is x's turn to play.

Data
    

At this point, we can modify the data if we wish. For example, we can change the b to x in the first fact to indicate that there is an x in the corresponding cell, and we can replace x with o in the last fact to change control from x to o. The window changes color to indicate that we have made changes but we have not yet committed those changes to the database.

Data
    

Clicking the Update button records the data in the system's database and removes the highlighting, indicating that the window is showing the current contents of the database.

Data
    

Suppose we edit the data and the result is syntactically illegal, as shown below.

Data
    

If we click Update, we will get an error message like the following, and the database will not be modified.

Data
    

    Syntax error.

Close    

At this point, we can either repair the problem and try again, or we can click the Revert button to return to the current state of the database, as we have done here.

Data
    

4. Query

The Query pane in Sierrabase provides a means for getting answers to relational queries. The Query pane typically looks like the one shown below.

Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh

To form a query, we enter an expression for our desired answer in the Pattern field and we enter our query in the Query field. Here, we are asking for all expressions of the form empty(M,N) where cell(M,N,b) is true, i.e. all cells that contain a blank.

Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh

Clicking the Show button causes Sierrabase to evaluate the query and show the results in the results area of the query pane. In this case, there are eight answers.

Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh

In general, queries can have many answers. By default, the Query tool shows only 100 answers, as shown in the Results field. We can change this default by changing the value in this field. In the example, below, we have changed the Results field from 100 to 4, and the system has changed its response to just four answers. In the case of expensive queries, it is often desirable to ask for just one result.

Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh

Changing the Unifications field changes the maximum number of unifications the system will attempt before evaluating queries. By default, the system performs a maximum of 100000 unifications. It is often useful to increase this number, though this will increase the amount of time needed to evaluate queries.

If the autorefresh box is checked, changing the system's data or rules automatically results in different values being shown for the specified query. Otherwise, the user must click the Show button to see the result in the new context. Suppose, for example, we check the autorefresh box on the preceding query, as shown below.

Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh

Now, suppose we change the dataset as shown below. Here, we have placed an o in the second cell of the first row and changed the control from o to x.

Data
    

In this situation, the value of the query in the Query pane is automatically recomputed and displayed, as shown below.

Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh

The autorefresh functionality is useful when debugging data or rules, as it allows us to see the effects of our changes instantaneously, in spreadsheet-like fashion.

5. Evaluate

If we select the evaluate tool, we see a pane like the one shown below.

Evaluate
Query  
   Unification Limit    Autorefresh

The evaluate tool allows us to compute the values of functional terms. To specify a term for evaluation, we enter the term to be evaluated in the Query field. Here, we are asking for the count of all cells that are blank in the current dataset.

Evaluate
Query  
   Unification Limit    Autorefresh

Clicking the Show button produces the value of this term in the results area. In this case, the answer is 7, which is the correct value given our current state.

Evaluate
Query  
   Unification Limit    Autorefresh

As with the Query tool, changing the Unifications field changes the maximum number of unifications the system will attempt before evaluating terms. By default, the system performs a maximum of 100000 unifications. It is often useful to increase this, though this will increase the amount of time needed to evaluate queries.

Also, in keeping with the Query tool, if the Autorefresh check box is checked, the system automatically refreshes the results whenever changes are made to the database (either by manually editing lambda or by executing actions that change lambda).

6. Transform Tool

While we can edit our data directly in the Data window, this is not always the most convenient method for changing data, especially when we have large datasets and/or multiple, similar changes to make. Sierrabase provides the Transform tool to help in such situations.

Clicking the Transform tab in the command bar produces a pane like the one shown below.

Transform
Condition  
Consequence  
  Autorefresh  

To specify a transformation, we enter a pattern into the Condition field and a pattern in the Conclusion field. In executing a transformation, Sierrabase finds all variable bindings that satisfy the specified condition and, for each, modifies the database in accordance with the instances of the conclusion corresponding to that variable binding. In this case, we want to find all facts of the form cell(M,N,R); and, for each of these, we want it to delete that fact and replace it with a fact of the form cell(N,M,R), i.e. the same fact with the row and column reversed.

Transform
Condition  
Consequence  
  Autorefresh  

The Expand button asks Sierrabase to display the additions and deletions that would be performed if the transformation were to be executed in the current state. It is extremely useful in debugging to see changes before they are made. (Note that, in the image below, some of the changes have scrolled off the page.)

Transform
Condition  
Consequence  
  Autorefresh  

The Execute button differs from the Expand button in that it actually makes the specified transformation on the database, leading to the situation shown below.

Data
    

As a result of the transformation, the facts in the dataset have been changed as directed. Where there was an o in row 1 and column 2, the o is now in row 2 and column 1. Note that the order of facts has been changed slightly. This is because the old cell facts have been removed from the database, and the new cell facts have been added to the end. Note also that the Query pane has also been updated. In this case, the list of empty cells has changed.

Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh

Clicking Execute a second time will cause the transformation to be repeated, in this case resulting in a reversion to the state before the first transformation.

7. Configurations

The buttons at the bottom of the page allow the user to save and load "configurations". Clicking the Save Configuration button tells the system to save the complete state of Sierrabase to the local file system, including parameters, data, and results. Clicking the Load Configuration button asks the system to load a previously saved configuration file. These operations are extremely useful in developing datasets. We can stop work and resume right where we left off on another day; and we can exchange configurations with others.



Comments and complaints to genesereth@stanford.edu.