W3C CVS Root

2000/scribe-bot/

swBot README

swBot: an RDF KB with IRC, HTTP interfaces

setting up swBot is discussed below. For now, let's assume it's running with nick swBot in channel #rdfig on irc.openprojects.net (which it has been known to do from time to time; see scratchpad and logs).

Using swBot

It groks statements, questions, and commands. All three must be addressed to the bot ala:

swBot, ...

support for private messages ala

/msg swBot ...

is partly implemented and under consideration.

Statements: telling swBot Stuff

statements end with period (.). e.g.:

swBot, <#Dogs> <#get> <#Fleas>.

They're written in RDF/N3 syntax; see the RDF/n3/semantic web primer.

You can use prefixes, as well as relative URIs* to abbreviate, ala:

swBot, @prefix dc: <http://purl.org/dc/elements/1.1/> .
swBot, <http://www.w3.org/> dc:title "World Wide Web Consortium (W3C)".

it remembers prefixes across lines. Here are some common/handy prefixes/vocabularies:

@prefix : <#>. # the channel vocabulary
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix u: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix wn: <http://xmlns.com/wordnet/1.6/> .
@prefix rss: <http://purl.org/rss/1.0/>.

If you just ask "swBot?" it will list the prefixes it has.

relative URIs are interpreted w.r.t. the address of the bot's persistent store. I'm not done thinking about this aspect of the design, though.

Commands: ordering swBot around

This bot will join any channel to which it is invited. You can get it to go away ala:

swBot, part #rdfig!

Commands have one or more words (separated by blanks) followed by an exclamation point (!). Load and save work like this:

swBot, load http://www.w3.org/2000/08/w3c-synd/home.rss !
swBot, save!

Saving overwrites the file swBot loaded from when it started. Saving is limited to a hard-coded or generated address in the source, due to security issues.

swBot, restore!
This reloads its knowledge from when it was last saved.
swBot, sanpshot!
This saves its knowledge at this point in a separate web resource. swBot generates its own new name for each new snapshot.

The bot can do some inference; to apply rules once:

swBot, rules!

To apply (forward-chain) rules exhaustively:

swBot, think!

It has a limited ability to forget; if you tell it that something is a log:Chaff, and then you purge, it'll forget all triples involving that thing. @@docs need motivating example

swBot, purge!

@@TODO: document expected, exceptional responses

@@timbl added set closure, clear, snapshot.

Queries: asking swBot about stuff

Questions using a suimple query syntax:

swBot, ?x  dc:description ?y ?

swBot returns anything it knows which matches the pattern. Thisis actualy a shorthand for

swBot, filter {?x  dc:description ?y} => {?x  dc:description ?y} !

In other words, find all matches and regenerate the same graoph for each one

questions use N3 rule syntax:

query {...if-part...} log:implies {...then part...}?

Examples:

Point me to all the RSS items you know about.
swBot, { ?i a rss:item } => { ?i a :Interesting}?
Point me to pictures that show both Dan and Gerald.

or more precisely:

Tell me about things that are depictions of both soemthing whose name starts with "Dan C" and something whose name starts with "Gerald".
swBot, { ?d foaf:name
     [log:startsWith "Dan C"]; foaf:depiction ?pic. ?g foaf:name
     [log:startsWith "Gerald"]; foaf:depiction ?pic. } => { ?pic a
     :PhotoOfDanAndGerald } ?

Setting up swBot

rdfn3chat.py is the main program; it uses ircAsync.py and httpAsync.py and some modules from SWAP a Semantic Web Application Platform.

Note that scribe-bot.py is an independent program; it uses a completely different set of irc modules: irc.py, BoundIRC.py, irc_interface.py, etc.

Invoke the bot ala:

python rdfn3chat.py irc.openprojects.net 6667 swBot "connolly" "RDF/n3 bot test" "#rdfig"

i.e.

python2 rdfn3chat.py irc-server port nick user fullname channel

References

Dan Connolly
$Revision: 1.7 $ of $Date: 2003/10/17 21:45:40 $ by $Author: connolly $

Click on a directory to enter that directory. Click on a file to display its revision history and to get a chance to display diffs between revisions.

Current directory: [Public] / 2000 / scribe-bot


File Rev. Age Author Last log entry
[BACK] Parent Directory        
[TXT] README.cvs.html 1.7 20 years connolly added html, head tags to match nxml-mode expectations
[TXT] rdfn3chat.py 1.17 20 years connolly code-review tweaks: diag comes from SWAP, not python lib some docs
[TXT] ircAsync.py 1.9 20 years timbl Chenged query format, brought it up to date with teh API a little
[TXT] beepOnMyName.py 1.1 22 years connolly sharing with EricM
[TXT] httpAsync.py 1.1 22 years connolly test passes: can save to HTTP
[TXT] irc_interface.py 1.2 23 years connolly previously managed locally: $Revision: 1.3 $ of $Date: 2000/03/20 05:43:22 $ by...
[TXT] scribe-bot.py 1.1 23 years connolly previously managed locally: $Revision: 1.3 $ of $Date: 2000/03/20 05:43:22 $ by...
[TXT] BoundIRC.py 1.1 23 years connolly Checking in stuff by Neale Picket From news:comp.lang.python , I think I got a ...
[TXT] BufferedSocket.py 1.1 23 years connolly Checking in stuff by Neale Picket From news:comp.lang.python , I think I got a ...
[TXT] irc.py 1.1 23 years connolly Checking in stuff by Neale Picket From news:comp.lang.python , I think I got a ...
[TXT] registry.py 1.1 23 years connolly Checking in stuff by Neale Picket From news:comp.lang.python , I think I got a ...

General options
,

Webmaster