[Developers] Metaweb Perl module

Shawn Simister narphorium at gmail.com
Tue Aug 14 06:09:34 UTC 2007


Hayden,

I'm not sure if procedural languages really pose that much of a problem. 
The Freebase data is object-oriented so it would be hard to /not/ to 
interact with it in an object-oriented way. Most popular languages like 
Ruby, Perl, Python, Lisp, JavaScript and C contain the proper semantic 
for dealing with Objects even if they are not strictly object-oriented 
languages.

I agree that the ability to send multiple queries is very important and 
I currently support them in my API by passing and array of Query objects 
to the ReadService.read() method. Each Query object can be named, 
modified and re-sent as many times as necessary.

Vishal's comment about allowing parameterizable queries is very true. I 
had overlooked that feature in my own design but I'm thinking of adding 
it now (I'm benefiting from this discussion already =). I think that the 
common trend in SQL is to represent query parameters with a ? symbol and 
then get and set their values using an integer index. So, the first ? 
might be $1, and the second ? would be $2 etc.

Handling authentication cleanly could be a tricky feature for API 
developers. Part of the reason why I have broken my design down into a 
ReadService and a WriteService is to allow people to make read queries 
without having to authenticate. At some point I will probably add a 
TransService to round out the feature set. I would suspect that once the 
Metaweb software becomes available there will be some databases that 
will allow anonymous authentication a la Wikipedia so thats definitely 
something to keep in mind.

I like the idea of a /modules/framework type on Freebase. Something 
similar to what the Metaweb guys have done with 
/freebase/metaweb_application.

Shawn Simister

Hayden Stainsby wrote:
> Firstly Perl module stuff (skip if you're not interested in Perl):
> I'm hoping to release my Perl module to CPAN at some point this week, 
> however at this point it's likely to be just Metaweb, not 
> Net::Metaweb, as the guys on the modules mailing list pointed out that 
> Net::* isn't the right place for it and I can't find another namespace 
> that matches what it does. Sorry to Kirsten and anyone else who has 
> started using it - any existing code will have to change to reflect 
> the new namespace, I'll update everyone when it's ready.
>
> Next general Metaweb module stuff:
>
> I agree it would be worthwhile agreeing to some sort of standard set 
> of functionality that would work across languages. The difficulty of 
> course is in creating a set of guidelines that make sense for both 
> procedural and object orientated languages.
>
> I started off looking at a concept similar to Shawn's, but found that 
> it meant giving up MQL's ability to send multiple queries in one 
> envelope. So I'm working on a structure for sending a query that is a 
> little more complex (one method call or so), but I think that even a 
> programmer fairly new to Perl should be able to get it up and running 
> fairly quickly.
>
> In brief Perl-ish syntax:
>
> $handle = Metaweb->new( server / login details here );
> $handle->add_read_query( query here );
> $handle->send_read_envelope;
>
> You then access your queries by name. The important point being that 
> you can send multiple named queries (or a single query using the 
> default name if you don't specify a name) using the same calls.
>
> You then also need a separate method/function to access the trans 
> service to fetch pictures and body text. But that's pretty straight 
> forward, all you need to use there is the translation type and the 
> guid of the object you're fetching.
>
> The last thing that I think is worth mentioning is that we need to 
> incorporate the fact that read queries will be able to be performed 
> without authentication (as far as I can tell) once Freebase reaches 
> beta, and I suppose it's possible that some other Metaweb instance may 
> come along that doesn't require any authentication at all.
>
> I've suggested creating a type for Metaweb libraries / modules / 
> frameworks under the Types -> Freebase section along with a suggested 
> setup in my own namespace, if anyone has any suggestions please let me 
> know.
>
> As far as my module goes I'm planning on adding an further abstraction 
> (possibly even as a separate module) that allows developers to work 
> without using MQL, but view Metaweb as a pure tree-like structure - in 
> a way it will be programatically like the Cinespin application 
> featured in the developers section.
>
> Sorry for my long winded post - I hope it didn't send too many people 
> to sleep.
>
> -- 
> Hayden
>
> #!/usr/bin/perl
> chop($_=<>);@s=split/ /;foreach$m(@s){if($m=='*'){$z=pop at t;$x=
> pop at t;$a=eval"$x$m$z";push at t,$a;}else{push at t,$m;}}print"$a\n";
> # http://occasionallyhuman.net/
> #9202a8c04000641f80000000054c75be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freebase.com/pipermail/developers/attachments/20070814/f5f7ea35/attachment.htm 


More information about the Developers mailing list