Overview

A web-based ontology editor uses HTML pages to support browsing and editing a knowledge base. Several are mentioned here, here, and here.

In these exercises, we start with a Lisp image containing a knowledge base, i.e., a set of defined frames. The exercises begin the simplest possible way to display a single given frame, then improve on that interface to be more readable, then to allow easy one-click browsing, and finally to allow frames to be defined or redefined by changing fields on a web page.

These exercises require:

MOP stands for "memory organization package", a term used by Schank for his frame-based representation system.


The Exercises


HTML frame Browser

Create a web page that gets frames in JSON form and displays them in a user-friendly browser. The URL http://localhost:8000/frame-browser/ (or whatever port you choose) should open a page that lets a user

Design a simple readable format that makes it easy to get to any frame with just point and click. Look at some ontology browsers for ideas, such as VectorBase for bioinformatics, the Getty Program Vocabulary ontology, or Brenda Enzyme Information System

Don't go crazy with animation. In fact, some of the most usable browsers are the simplest.

Use SimpleServer to implement the browser.

Test with the frames in mop-examples.lsp.

Submit: The HTML and JavaScrip for browsing frames, and the SimpleServer Lisp code. Don't send CSS, images, etc.


Frame Editor Interface

Now define a frame editing interface. You can design your own, if handy with forms and Javascript, or you can try starting with this sample page. This page uses some simple Javascript along with the jQuery Javascript library. It just lets you update the form on-screen but nothing is sent anywhere. The interface is simple but non-standard.

There's no "undo" facility, but the Cancel button resets the form to its original state.

Don't worry about implementing Save Changes. Just write the code so that the right frame data is displayed in the frame editor interface, including choosing a new frame to edit. If a new frame name is entered, the fields should be empty.

Submit: The primary CLP page for editing frames and any new Lisp functions you wrote that that page calls. Don't send auxiliary pages, if you have them, for error messages or login or whatever.

Frame Editor Updating

Now fix it so that clicking Save Changes does the following defines a frame with the name, abstractions, and slots specified by the current values of the fields in the form. A slot with an empty role or filler should be ignored.

NOTE: Store frames with add-frame. Don't make an DEFFrame and call eval. That would require calling the compiler to create a frame or instance. It would also require any deployed application would have to include the Lisp compiler..

There's one other tricky bit of logic. There's three ways this form might get called:

You'll need to change the opening <FORM> tag to read:

<form name="mainForm" method="POST" 
    action="/cs325/frameedit">
    

Frame Editor Persistence

The last big thing you need to add to your editor is the ability to make your changes persistent. Currently, all your changed frames only exist in the current Lisp server image. You need to save those frames to a file that will be reloaded when your server restarts.

Add code to write all frames that have been changed to a file. Every time the user clicks Save Changes, the file of changed frames should be re-written. This is to save changes in case the server or browser crashes. Because there might be mistakes, and because you don't want to write every single frame to a file when only a few have changed, this file should be separate from your master file of frames, i.e., it should not be mop-examples.lsp.

Commonly in situations like this, an administrator will go through the changed frames, check for errors, and, if there are no problems, move the changed frames to the master file.

Whatever file of code builds your server should load the master files then the file of changes. You'll need to keep a list or table of what frames have changed, and it should always include everything in the file of changed frames.

Faculty: Chris Riesbeck
Time: Monday, Wednesday, Friday: 11am - 11:50am
Location: Tech LR5

Contents

Important Links