[Developers] Metaweb Perl module
Hayden Stainsby
hds at caffeineconcepts.com
Sun Aug 12 11:32:41 UTC 2007
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
On 12 Aug 2007, at 03:36, Shawn Simister wrote:
> Hi Kirsten,
>
> I agree that a common base would be a good idea even if it just starts
> off as a very small set of features.
> So far, in developing a Ruby module for Metaweb, I have been
> building on
> the following core concepts:
>
> ReadService.read(queries)
> WriteService.authenticate(host, user, password)
> WriteService.write(queries)
>
> As each layer of abstraction is added, the API becomes more language
> specific so at some point there will be certain features that Ruby can
> do but more rigid languages like Java couldn't. Still, I think
> there is
> enough overlap to warrant a common knowledge base of source code and
> best practices for API developers. Each API would be allowed to grow
> organically while maintain compatibility with Metaweb Core 1.0 (for
> example).
>
> Can anyone from Metaweb comment on if Metaweb would want to get
> involved
> in a standard like this?
>
> Shawn Simister
>
> Kirsten Jones wrote:
>> All,
>>
>> I'm just about ready to start working with Hayden's perl module, and
>> had some thoughts I wanted to bounce off of the rest of you.
>>
>> On the more general topic of modules, I'd really love for the
>> developer community to come up with a set of guidelines for client
>> libraries for Metaweb. Each language's library might well have
>> additional functionality, but I'd love to define what the 'base
>> functionality' for each library should be. Doing this will make it
>> easier for people to move among the various dynamic languages and
>> leverage off of other people's work in different languages to seed
>> their own applications. It seems like it would also make it easier
>> to create the client libraries if some essential set of behaviors is
>> already specified.
>>
>> Metaweb is so flexible that I'm afraid if we *don't* come up with
>> something like this, the modeling in each language may end up being
>> radically different.
>>
>> Since I currently work at a wiki company, I was thinking of creating
>> a workspace for people who are interested in collaborating on what
>> these guidelines might be. But I thought I'd start here and see what
>> people think - good, bad, indifferent? There are certainly arguments
>> to be made for allowing these things to grow organically.
>>
>> Thanks,
>> Kirsten
>> _______________________________________________
>> Developers mailing list
>> Developers at freebase.com
>> http://lists.freebase.com/mailman/listinfo/developers
>>
>>
>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
#!/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
More information about the Developers
mailing list