[Developers] Perl API (hi Hayden!)
Michael Jones
szaijan at gmail.com
Sat Aug 18 23:07:26 UTC 2007
Having just completed transferring a good deal of text data to
Freebase without an API, I can say my biggest issue was in
understanding the error messages due to malformed MQL queries. I
think this would become doubly difficult with effectively 2 layers of
code between myself and the MQL code. Given that, I think I'd prefer
to see something like DBI structured for Metaweb, and then a further
abstraction library that could optionally be added on top.
This would meet your need for less contact with the underlying MQL
code, but allow debugging at that level when needed.
Just my 2 cents. In general, I'm all for more abstraction. Please
say hi to my wife (Kirsten) for me!
MJ
On 8/18/07, Kirrily Robert <skud at infotrope.net> wrote:
> I'm sitting next to Kirsten at BarCampBlock in Palo Alto right now,
> and we were just talking about Perl APIs. I'm reading the thread that
> starts at http://lists.freebase.com/pipermail/developers/2007-August/000502.html
> and thought I'd give some belated feedback. Sorry for breaking the
> threading but I only just joined the list last night.
>
> I'd like to draw an analogy to Perl's DBI and Class::DBI modules.
>
> In DBI you work at the level of database handles, statement handles,
> etc, and you write SQL. This is kinda a pain in the arse because it's
> a bit low-level and also you can't just think in one language. So
> along came the ORMs (eg. Class::DBI and friends) and made things
> easier and more Perlish, less like writing in SQL and more like
> writing in Perl.
>
> So looking at Hayden's proposed API, which goes something like this:
>
> $handle = Metaweb->new( server / login details here );
> $handle->add_read_query( query here );
> $handle->send_read_envelope;
>
> It's dealing with things like envelopes, but when I'm looking up films
> in Metaweb I'm going to be thinking about films. So I'd want the
> syntax to reflect that.
>
> Very very roughly, I'd expect something like:
>
> my $metaweb = Metaweb->new( blah blah );
> my @films = $metaweb->query({
> director => 'Martin Scorcese',
> blah blah etc
> });
> foreach my $f (@film) {
> print $f->title();
> }
>
> Now under the hood that might be dealing in envelopes, but I think
> most of the time -- definitely in accordance with the 80/20 rule if
> not moreso -- we're going to be dealing with "here, gimme the results
> of this query" and not want to deal with the under-the-hood stuff.
>
> Shawn seemed to be talking about some similar things back in the earlier thread:
> http://lists.freebase.com/pipermail/developers/2007-August/000510.html
>
> K.
>
> --
> Kirrily Robert
> skud at infotrope.net
> http://infotrope.net
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
>
--
____________________________________________________________________
Michael Jones, Gamer at Large
szaijan at ternea.com
____________________________________________________________________
More information about the Developers
mailing list