[redland] Re: model vs. triple

Dan Brickley danbri at w3.org
Fri Jun 1 05:53:30 BST 2001



Hi all

On Fri, 1 Jun 2001, Alberto Reggiori wrote:

> Devon Smith wrote:
> >
> > I agree that writing my own API is a bad idea.
> > but i do think that the existing API's are a little too limiting.
> > i also don't have time right now to wait for an API convergence.
>
> Hello Devon
>
> (I hope you do not mind if I cc this message to redland, wraf and eric)
>
> I think writing your API is not too bad but it worries me because there
> is a
> big risk to duplicate work and make people confusing.
>
> > to further the cause of convergence, i will make my API available
> > for you, and anyone else, to look at and comment on.
> > http://socwww.cwru.edu/~devon/rdf
> > this is just the start, so don't hesitate to be critical.
> > let me know what you think is missing and what you think needs
> > to be added. i can't promise that i'll make all the changes requested
> > or that i'll make changes in a timely manner, but i'll definitely
> > keep track of them.
>
> I quickly looked through it and looks interesting. But without any
> method name/signature
> on the classes I can not see very much difference from the
> Stanford/RDFStore API. The
> only bit added to it seems the Property class to make the api "resource
> centric" (ala Jena)

Having a "resource centric" view of one's RDF data turns out to be really
nice, particularly in more dynamic languages like Perl where there's the
potential to rid application code of all the RDF-specific words. I have an
implementation in Perl that tries to push the node-centric idea as far as
it can go; this API is complementary to (and sits on top of) Mozilla-like
graph/datasource APIs (Redland etc).

> I would be interested instead to start a kind of collaborate effort (at
> least on the perl side) to implement something together and possibly
> using a more general and flexible model. I am definitively open to
> suggestions and concrete proposals like your :-)

Cool! I intend to make a concrete proposal (with running code) to the RDF
lists. I've no interest in building the One True Implementation of it, but
having played around a bit I'm happy its a useful technique that
copmlements existing APIs.


A quick preview:

# (skipping a bunch of use statements)

my $mem = new RDF::RDFWeb::MemDB;

# register some useful namespaces with $mem
my $RSS = ns $mem 'RSS', 'http://purl.org/rss/1.0/';
my $DC  = ns $mem 'DC',  'http://purl.org/dc/elements/1.1/';
my $RDF = ns $mem 'RDF', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';

# ...fill mem with some triples. and then query the data.
# skipping the parser stuff...:


foreach my $c ( $mem->GetSources($RSS.'channel', $RDF.'type')) {
# (aside: these args are in the wrong order)

my $channel = new RDF::API::Node ( $c, $mem ); # need to rename module.
                                               # a node has a context db.

# note lack of "RDF" buzzwords in code from here on...

  print "\n[ An rss channel, $channel ] \nTitle: ", rss_title $channel,
        "\nDescription: ", rss_description $channel, "\n";

  print sprintf ("publisher: %s \nrights: %s ",
        dc_publisher $channel, dc_rights $channel);

}


IMHO things can't get much simpler than this. There are some issues to
work out: currently I return strings instead of further Node objects, for
eg., and I suspect that's wrong. But the general approach I like.

> A suggestion: do not "pollute" the perl RDF:: package namespace

Good plan. I'm using RDF::RDFWeb for new stuff now; if I can have that
corner to "pollute" I'll be happy!

Dan

>
> I will send you more later
>
> Yours
>
> Alberto



More information about the redland-dev mailing list