Re: Getting Llyn To Return Lists From Builtins

[Noting bugs and implementations...]

> it works well enough for now [... and] paves the
> way for some great future builtins.

Modulo some bugs. Firstly, I had to add "if x == None: return []" to
the top of _toPython, because otherwise it'd raise an error. However,
there are a few more bugs that I *haven't* been able to sort out:-

* Lists sometimes seem to just "appear" in the root context of their
own accord - I guess that the exivars must be leaking out somewhere
* When you have a builtin that involves returning a list, and use it
alongside builtins that don't, sometimes the builtins that don't go
wrong; if you have (?p ?q ?r) :builtin ?s, the evaluateSubject
function for that builtin only gets passes "?p and ?q". I have the
test cases for these, if required.

Apart from that, it's been fun implemeting builtins that return lists.
I've managed to cook up an experimental NTriples parser in Notation3
[1], and some interesting list builtins [2] for a start.

> [...] could you allow loading of builtins modules from a
> separate configuration file?

One possible approach (further briding the gap between N3 and
Python...) is for modules to be imported from definitions in Notation3
files. For example, if someone has created a module for the builtin
predicate http://example.org/pred, you might be able to say:-

   <http://example.org/pred> a cwm:Builtin;
     cwm:module <http://example.org/cwm_pred.py> .

One could also apply client side caching etc., per Aaron's Webizing
Python notes, and [Tim's] Python 10 keynote. I'm not sure if
dynamically loading modules from a basically declarative RDF format is
necessarily good for the Semantic Web, but it's an approach to
consider, all the same.

Cheers,

[1] http://lists.w3.org/Archives/Public/www-archive/2002Mar/0001
[2] http://lists.w3.org/Archives/Public/www-archive/2002Mar/0002

--
Kindest Regards,
Sean B. Palmer
@prefix : <http://purl.org/net/swn#> .
:Sean :homepage <http://purl.org/net/sbp/> .

Received on Saturday, 2 March 2002 18:04:32 UTC