Revised by Seth Russell 7/9/2002
The user, with
the help of a sailorServer, can browse information written on the semantic
web. But, ususlly, the authors of this information have not described
any buttons to appear which might be clicked to perform tasks; rather it
is the user's perogative how to use information from the web, and what tasks
might be perfomed based upon that information. This paper describes
methods which the user can deploy in sailor agents to make buttons appear
for performing user tasks.
How to cause events
agent outputs information to the html page by firing productions in the current
saying grammar. Within the grammar
production of the python grammar file, you can cause a named event to happen
by invoking the following method:
How to write rules
The variable 'sail' always
refers to the current running sailor agent. You can name the event
whatever you like. For example the standard html grammar at homePath/grammar/html.py
now contains the following production:
production['subjectRow']= lambda: \
'<tr><td valign="top" bgcolor="#ccccff" colspan="2">'
sa('subject') + '</td><td bgcolor="#ffff33" >'
+ sail.cause('nodeEvent') + \
This causes a event
called 'nodeEvent' to occur in the right hand cell of the subject row of
every node that is said to the html page. The current attention is always
bound to the variable ?here when the event occurs.
When named events
occur, all the rules associated with that event are fired. A rule is
written like this:
How to load rules
rules (when EVENT_NAME) "PREMIS COPULA CONSEQUENT".
Note that subject 'rules'
can occur in any context but it is conventional to put all the rules in the
'urgraph' context. Note also that the object of the rule is written
enclosed in quotes. The PREMIS is any method which returns a logical
state. The CONSEQUENT usually fires another production. The copula
is chosen from one of the following:
then - the consequent is performed if the
premis is true
For example here is a rule:
else - the consequent is performed if the
premis if false
ohthen - the consequent is performed if the
premis is surprised
rules (when nodeEvent) "isTriple(?here type class) then
This rule will cause
a classButton to appear in the subject row if the node is of type class.
The class button is defined in the grammar as follows:
production['classButton']= lambda: \
As you can see this will
cause a link to the inputForm to appear on the page. If the link is
clicked, attention will be on the subject class when the application page
sa('buttonStart') + '[make]' + sa('buttonEnd')
production['buttonStart']= lambda: '<a href="inputForm.html?at=' + \
sa('subject') + '">'
production['buttonEnd']= lambda: '</a>'
In version .090
rules are not automatically loaded, but they must be loaded to take effect.
You load rules from any context with the following method:
How to write an application
If the context argument
is left out, the rules are loaded from the current context. The appOne.html application has a button at the top
of the page to load the rules from the current context.
for buttons on the semantic web is now easy. They comprise two components
1) an html page to host the application and 2) a saying grammar to control
what appears on the page. Version .090 includes an demonstration application
that allows the user to fill out a from for any class to make an instance
of that class. You can run this demonstration by waking up the sailors
agent included with the release:
homePath> phthon sailorServer.py , , sailors
Then hit this URL with
your favorite browser
The application is based
on the foaf vocabulary and allows
you to make your own instances of the class Person, just by filling out a
form. The components of this application are: 1) inputForm.html and 2) inputForm.py .
This application inroduces two new properties which allow you
to provide the information necessary for users of your classes to automatically
fill in forms that make instances of your classes:
Please refer to the file
foaf.quads in the current release for an
comment "Indicates the potential properties that
describe an instance of
comment "Indicates the property that corresponds
to the local name of the