Enriching Rich Internet Applications with Rule-Based Reasoning

I came across a Firefox Add-On today by Matthias Tylkowski, that lets user to modify the browser view of his/her preferred web pages. For example, user can modify the appearance of cnn.com to suit his/her needs.

The add-on or the web rules is a JSON-based rule language, where each rule is a JSON object. In addition, Javascript is used for method calls. The web rules use Drools-like condition language:

{
    "id":"rule101",  "appliesTo": [
              "http://www.cnn.com"],
               "condition":  "$X:Element( class == 'note', $Y:firstChild ) &&
                              ($Y.nodeName == 'ul')",
               "actions":[  "changeBackground($Y, 'blue')"   ]
}

For all elements of class note having as first child an ul, change the first child background color to blue.

I think its a quite cool add-on.

Resources:
JSON RuleS

More from Alexander Zagniotov:

  1. Redefining Web Applications with AJAX, Servlets and JSON
    In this article I would like to show how JSON (JavaScript Object Notation) and Java servlet can be used together...
  2. Drools – Stop Executing Current Agenda Group and All Rules
    Sometimes, depends on your business rules in your application, there is a need to stop current agenda group or all...
  3. Rule Engine Stress Testing
    I came across a blog by a company called Illation. What those guys do is compare performance of several rule...
  4. Brainteaser Drools: Testing Objects
    This can be a hard one, since it requires from you to be familiar with Drools. Consider the condition side...
  5. Drools 5 Case Study 1- Writing DSL for DRL rule
    One of the blog readers, who posted a comment in my previous post Drools – tutorial on writing DSL template...

 

Comments