W3C home > Mailing lists > Public > www-rdf-interest@w3.org > March 2002

Eep RDF API, Inference Engine, and NTriples/N3 Parser

From: Sean B. Palmer <sean@mysterylights.com>
Date: Sun, 3 Mar 2002 23:57:17 -0000
Message-ID: <034e01c1c30f$27aa9120$23550150@localhost>
To: <www-rdf-interest@w3.org>
Hi,

This is a beta-release of a little RDF API that I've been hacking on
for a couple of weeks: Eep. It's written in Python [1], and as long as
you have a fairly recent version of Python installed (I have 2.2 [2]),
it should run right out of the box. The latest distribution is
available from:-

   http://infomesh.net/2002/eep/eep.tar.gz

and the current version is:-

   http://infomesh.net/2002/eep/20020302-013802.tar.gz

you can also browse the source on the Web at:-

   http://infomesh.net/2002/eep/20020302-013802/

So, what can it do? Well, it's a sub-CWM clone, although it wasn't
originally intended that way. Here's a general list of things that it
can do:-

   * Parse the NTriples format
   * Parse Notation3, excluding DAML lists and formulae
   * Perform (small) queries
   * Do forwards chaining inferences
   * Perform builtins (tests and variables)
   * Template results as HTML etc.

Documentation is very sparse... I apologize for that, but it is very
easy to run. There are serveral test files in the distribution:
querytest.py, infertest.py, bitest.py, n3test.py, and templatetest.py,
that can be run simply by doing "python filename".

It's meant as a very small, fast, and extensible toolkit for
performing small RDF operations. It is stunningly fast on small
queries, but at the moment can break on larger queries. I envisage
that it will be used for running RDF bots, weblogs, etc.; things that
handle small inputs at a time, or need to perform searches with a
handful of variables on large databases.

The API should be very easy to get into, and was designed to be
*used* - even through IDLE - and not just to look pretty. The main
modules to import when performing some operation are: eep, query,
infer, n3, and bi. Here's an example of what Eep can do...

[[[
>>> import eep, query, infer, n3, bi
>>> import re, urllib2
>>> EARLSchema = 'http://www.w3.org/2001/03/earl/0.95.n3'
>>> EARL095 = n3.parse(urllib2.urlopen(EARLSchema).read())
>>> len(EARL095)
146
>>> RDFSLabel = 'http://www.w3.org/2000/01/rdf-schema#label'
>>> for result in query.rquery(eep.parse('?x <%s> ?y .' % \
   RDFSLabel)[0], EARL095): print result[0][2]

"Evaluation"
"Assertor"
[...]
"passes"
"fails"
"TestCase"
"EARL (Evaluation And Report Language)"
>>> rule = infer.rule(
"""?x <http://www.w3.org/2000/01/rdf-schema#label> ?z .
    ?z <http://www.w3.org/2000/10/swap/string#startsWith> "A".""",
    '?z <#type> <#ALabel> .'
)
>>> for result in bi.bfilter(rule, EARL095):
   print eep.serialize(result)

"Assertor" <#type> <#ALabel> .
"Assertion" <#type> <#ALabel> .
>>>
]]]

Many thanks to deltab, redmonk (Steve Ivy), and Bijan Parsia for their
praise, comments, feedback, and tests.

[1] http://www.python.org/
[2] http://www.python.org/2.2/

--
Kindest Regards,
Sean B. Palmer
@prefix : <http://purl.org/net/swn#> .
:Sean :homepage <http://purl.org/net/sbp/> .
Received on Sunday, 3 March 2002 18:57:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:51:53 GMT