Diadosi & QLisp for website data.

After some time working on the initial Diadosi platform and develping my own LispVM for allowing quering of data out of Diadosi, I decided to start over (sort of).

By start over, what I really mean, is to take the opportunity of not having any websites in a production environment using the QLisp language yet; as a chance to rewrite the VirtualMachine. It also helps that I was moving the prototype code from JS to Python for the actual implementation of Diadosi.

Usefulness of QLisp

QLisp has proven a great language so far, for simplifying the task of making dynamic websites, that request data from a service. (Maybe I will make another post about the architecture of Diadosi sometime in the near future.) For example to get the 5 most recent articles from your diadosi site you can use the following:

(select Article
    (match
        ("status" "published"))
    (sort
        ("metadata.createdate" "desc"))
    (limit 5))

Having this simple language to access data in Diadosi (Which is sort of a specialized CMS database system.) make building dynamic websites much simpler. Using an MVC framework such as CodeIgniter you are able to have a simple controller which takes arguments if needed. Build a query for data from Diadosi. Finally receiving the data it may continue to the View rendering. It really is as simple as:



/* controller */
class Main extends CI_Controller {

    public function __construct() {
        // Load Diadosi's wrapper library "Saltmine"
        $this->load->library('saltmine');
    }

    public function index() {
        // Send and execute the query
        $page_res = $this->saltmine->query('(select Page (match ("slug" "index")))');
        
        // Load the View for home passing the page returned from Diadosi
        $this->load->view('home', array('page' => $page_res[0]));
    }
}