Welcome to RMQL - Ruby on Rails Model Query Language
When applications grow after a while sometimes the developers want to open up the application to external developers, to benefit from a total new phenomena - mash-ups. Not that interfaces to applications are something new, but the dynamic of these Web 2.0 mash-ups is incredible.
If the developers start to define the interface they are faced with different questions and problems.
- Which methods to expose?
- Which granularity of exposed methods is the best?
- What about data load?
- What if an interfaces changes?
The answer to those question is not easy to find. If the API to the application is exposed using web services both, the generation for servers and generation for consumers is easy to handle, but on the other hand the system breaks, if the API is changed and you will never know if the data that you submit to the consumer is too much or to less.
A solution to the problems described above can be a dynamic interface to the client in a way, that the query send to the server is build and dynamically evaluated.
Now the mash-up developer is able to create statements that fulfill her need and transfers only the amount of data needed to the consumer.
The approach taken in this project is a query language that is based on a very simple subset of XQuery and only allows reading data from a specific Ruby on Rails mdoel.
Give me an example!
You can't wait to see some code?
Lets define the query first. We want to select all Users from a database that have an id smaller then 1000 and return their first and last name.
Looks cool hmm? Ok, but now what does the answer to this query looks like? Since this will return all users matching the criteria, it returns a list of user statements.
That looks really easy!
You can get the most recent version directly from our subversion. Since the whole software is in a beta stage by now this can harm your Rails application if you use it in a productive environment.
To install the plugin in your Rails application execute the following command.
If you want to use RMQL please have a look at the language guide.