Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm working on doing something similar, but with RSS feeds. I've found that I really like the <a href="http://redis.io/" rel="nofollow" title="the homepage">redis</a> syntax, which allows you to use as complex and rigidly structured a vocabulary as you like, but with all the advantages of access to any of the the major modern datatypes, laid out flatly on a hash map. There are very easy-to-use clients in a ton of different languages, but it boils down to thinking about how you can reliably structure string patterns to find what you want, like below, in the pattern 'action' 'key' 'value', where $ denotes a variabe component of the given string:</p> <pre><code>get locality:$id = name list locality:dwellings = [dwelling:id, dwelling:id ...] map-get dwelling:id 'typical_value' = 'rank: $rank\tvalue: $value' </code></pre> <p>I use PHP to interact directly with redis, and make client-side calls via jQuery $.post async interactions to a server-side interface which routes commands to the redis accessor class. The interface is pretty simple. Here is the jQuery side.</p> <pre><code>/*QUERY *functional programming puts a big emphasis on "wrapping" repetitive tasks inside *another function. This one amounts to the same thing as a protocol in *Clojure, with the query map acting as the dispatch value that triggers *the right method on the server side, recieves and parses the response, *and then passes it on to the "body" of the client logic expressed in callback, *which causes side effects on the screen. */ redgets.query = function(query_map, callback) { $.post(redgets.router, query_map, function(data) { return callback($.parseJSON(data)); }); }; </code></pre> <p>and an example query_map looks like the following:</p> <pre><code>{method: 'locality_by_id', localityID: 'locality:1'} </code></pre> <p>which for example the the PHP router could interpret with:</p> <pre><code>$response = array(); switch ($_POST['method']) { case 'locality_by_id': if ($_POST['localityID']) { $response = $this-&gt;locality_by_id($_POST['localityID']); break; //etc, until return json_encode($response); } </code></pre> <p>where $this->locality_by_id() is a query you wrote to touch redis via the <a href="https://github.com/nrk/predis" rel="nofollow" title="github">predis</a> client interface.</p> <p>Redis makes random access of XML files much faster and easier to wrap your head around, once you wrap your head around laying tree data structures out on a flat map. Meaning, you have to write a parser that converts the DOM items to redis-friendly key-value pairs. I'm sure you'll have some ideas about how best to do this. And once you've written a converter, it will be easy to do the reverse.</p> <p>(I would add more links, but spam control sez no)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload