A while back, I'd begun work on a Python module that I haven't worked on since. It had some features I thought might be useful but no one seemed to be using Python (outside of Metaweb), so I pretty much stopped work on it. However, it did support most of the things discussed here, like named queries, and some things not discussed, like cursor reads. The nice part was that named queries could be made like so:
<br><br>{<br>&nbsp; &quot;query&quot;:[{<br>&nbsp;&nbsp;&nbsp; &quot;first:starring&quot;:{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;actor&quot;:&quot;#actor1&quot;<br>&nbsp;&nbsp;&nbsp; },<br>&nbsp;&nbsp;&nbsp; &quot;name&quot;:null,<br>&nbsp;&nbsp;&nbsp; &quot;produced_by&quot;:[],<br>&nbsp;&nbsp;&nbsp; &quot;second:starring&quot;:{
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;actor&quot;:&quot;#actor2&quot;<br>&nbsp;&nbsp;&nbsp; },<br>&nbsp;&nbsp;&nbsp; &quot;type&quot;:&quot;/film/film&quot;<br>&nbsp; }]<br>}<br><br>I don&#39;t actually remember if &#39;#&#39; was the indicator I used but regardless, when this query was fed into the client in a similar fashion to what you do in your Perl module:
<br>$handle = Metaweb-&gt;new( server / login details here );<br>$handle-&gt;add_read_query( query here );<br>What would happen is that #actor1 and #actor2 would be noticed and on a subsequent run of the query, you could do:
<br>$handle-&gt;send_read_envelope(actor1=&quot;Jeff Goldblum&quot;, actor2=&quot;Kevin Bacon&quot;);<br>$handle-&gt;send_read_envelope(actor1=&quot;Bob Saget&quot;, actor2=&quot;Kevin Bacon&quot;);<br><br>(I have no idea how Perl works but this is how it would be in Python, anyway).
<br><br>There also was a function that could read all cursor results into an array for you without you needing to do any bookkeeping of cursor ids.<br><br>I&#39;m not sure if the former would be practical in every language but I would think the latter is necessary for anyone who wants a reasonably large set of results without any timeouts.
<br><br>Hope this helps,<br>Vishal<br><br><div><span class="gmail_quote">On 8/12/07, <b class="gmail_sendername">Hayden Stainsby</b> &lt;<a href="mailto:hds@caffeineconcepts.com">hds@caffeineconcepts.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Firstly Perl module stuff (skip if you&#39;re not interested in Perl):<br>I&#39;m hoping to release my Perl module to CPAN at some point this week,
<br>however at this point it&#39;s likely to be just Metaweb, not<br>Net::Metaweb, as the guys on the modules mailing list pointed out<br>that Net::* isn&#39;t the right place for it and I can&#39;t find another<br>namespace that matches what it does. Sorry to Kirsten and anyone else
<br>who has started using it - any existing code will have to change to<br>reflect the new namespace, I&#39;ll update everyone when it&#39;s ready.<br><br>Next general Metaweb module stuff:<br><br>I agree it would be worthwhile agreeing to some sort of standard set
<br>of functionality that would work across languages. The difficulty of<br>course is in creating a set of guidelines that make sense for both<br>procedural and object orientated languages.<br><br>I started off looking at a concept similar to Shawn&#39;s, but found that
<br>it meant giving up MQL&#39;s ability to send multiple queries in one<br>envelope. So I&#39;m working on a structure for sending a query that is a<br>little more complex (one method call or so), but I think that even a
<br>programmer fairly new to Perl should be able to get it up and running<br>fairly quickly.<br><br>In brief Perl-ish syntax:<br><br>$handle = Metaweb-&gt;new( server / login details here );<br>$handle-&gt;add_read_query( query here );
<br>$handle-&gt;send_read_envelope;<br><br>You then access your queries by name. The important point being that<br>you can send multiple named queries (or a single query using the<br>default name if you don&#39;t specify a name) using the same calls.
<br><br>You then also need a separate method/function to access the trans<br>service to fetch pictures and body text. But that&#39;s pretty straight<br>forward, all you need to use there is the translation type and the<br>
guid of the object you&#39;re fetching.<br><br>The last thing that I think is worth mentioning is that we need to<br>incorporate the fact that read queries will be able to be performed<br>without authentication (as far as I can tell) once Freebase reaches
<br>beta, and I suppose it&#39;s possible that some other Metaweb instance<br>may come along that doesn&#39;t require any authentication at all.<br><br>I&#39;ve suggested creating a type for Metaweb libraries / modules /<br>
frameworks under the Types -&gt; Freebase section along with a suggested<br>setup in my own namespace, if anyone has any suggestions please let<br>me know.<br><br>As far as my module goes I&#39;m planning on adding an further
<br>abstraction (possibly even as a separate module) that allows<br>developers to work without using MQL, but view Metaweb as a pure tree-<br>like structure - in a way it will be programatically like the<br>Cinespin application featured in the developers section.
<br><br>Sorry for my long winded post - I hope it didn&#39;t send too many people<br>to sleep.<br><br>--<br>Hayden<br><br><br>On 12 Aug 2007, at 03:36, Shawn Simister wrote:<br><br>&gt; Hi Kirsten,<br>&gt;<br>&gt; I agree that a common base would be a good idea even if it just starts
<br>&gt; off as a very small set of features.<br>&gt; So far, in developing a Ruby module for Metaweb, I have been<br>&gt; building on<br>&gt; the following core concepts:<br>&gt;<br>&gt; ReadService.read(queries)<br>&gt; 
WriteService.authenticate(host, user, password)<br>&gt; WriteService.write(queries)<br>&gt;<br>&gt; As each layer of abstraction is added, the API becomes more language<br>&gt; specific so at some point there will be certain features that Ruby can
<br>&gt; do but more rigid languages like Java couldn&#39;t. Still, I think<br>&gt; there is<br>&gt; enough overlap to warrant a common knowledge base of source code and<br>&gt; best practices for API developers. Each API would be allowed to grow
<br>&gt; organically while maintain compatibility with Metaweb Core 1.0 (for<br>&gt; example).<br>&gt;<br>&gt; Can anyone from Metaweb comment on if Metaweb would want to get<br>&gt; involved<br>&gt; in a standard like this?
<br>&gt;<br>&gt; Shawn Simister<br>&gt;<br>&gt; Kirsten Jones wrote:<br>&gt;&gt; All,<br>&gt;&gt;<br>&gt;&gt; I&#39;m just about ready to start working with Hayden&#39;s perl module, and<br>&gt;&gt; had some thoughts I wanted to bounce off of the rest of you.
<br>&gt;&gt;<br>&gt;&gt; On the more general topic of modules, I&#39;d really love for the<br>&gt;&gt; developer community to come up with a set of guidelines for client<br>&gt;&gt; libraries for Metaweb.&nbsp;&nbsp;Each language&#39;s library might well have
<br>&gt;&gt; additional functionality, but I&#39;d love to define what the &#39;base<br>&gt;&gt; functionality&#39; for each library should be.&nbsp;&nbsp;Doing this will make it<br>&gt;&gt; easier for people to move among the various dynamic languages and
<br>&gt;&gt; leverage off of other people&#39;s work in different languages to seed<br>&gt;&gt; their own applications.&nbsp;&nbsp;It seems like it would also make it easier<br>&gt;&gt; to create the client libraries if some essential set of behaviors is
<br>&gt;&gt; already specified.<br>&gt;&gt;<br>&gt;&gt; Metaweb is so flexible that I&#39;m afraid if we *don&#39;t* come up with<br>&gt;&gt; something like this, the modeling in each language may end up being<br>&gt;&gt; radically different.
<br>&gt;&gt;<br>&gt;&gt; Since I currently work at a wiki company, I was thinking of creating<br>&gt;&gt; a workspace for people who are interested in collaborating on what<br>&gt;&gt; these guidelines might be.&nbsp;&nbsp;But I thought I&#39;d start here and see what
<br>&gt;&gt; people think - good, bad, indifferent?&nbsp;&nbsp;There are certainly arguments<br>&gt;&gt; to be made for allowing these things to grow organically.<br>&gt;&gt;<br>&gt;&gt; Thanks,<br>&gt;&gt; Kirsten<br>&gt;&gt; _______________________________________________
<br>&gt;&gt; Developers mailing list<br>&gt;&gt; <a href="mailto:Developers@freebase.com">Developers@freebase.com</a><br>&gt;&gt; <a href="http://lists.freebase.com/mailman/listinfo/developers">http://lists.freebase.com/mailman/listinfo/developers
</a><br>&gt;&gt;<br>&gt;&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; Developers mailing list<br>&gt; <a href="mailto:Developers@freebase.com">Developers@freebase.com</a><br>&gt; <a href="http://lists.freebase.com/mailman/listinfo/developers">
http://lists.freebase.com/mailman/listinfo/developers</a><br><br>#!/usr/bin/perl<br>chop($_=&lt;&gt;);@s=split/ /;foreach$m(@s){if($m==&#39;*&#39;){$z=pop@t;$x=<br>pop@t;$a=eval&quot;$x$m$z&quot;;push@t,$a;}else{push@t,$m;}}print&quot;$a\n&quot;;
<br># <a href="http://occasionallyhuman.net/">http://occasionallyhuman.net/</a><br>#9202a8c04000641f80000000054c75be<br><br><br>_______________________________________________<br>Developers mailing list<br><a href="mailto:Developers@freebase.com">
Developers@freebase.com</a><br><a href="http://lists.freebase.com/mailman/listinfo/developers">http://lists.freebase.com/mailman/listinfo/developers</a><br></blockquote></div><br><br clear="all"><br>-- <br>:v