Simple Rule Markup Language (SRML)
Date: 2001-05-17
From: Margaret Thorpe (ILOG, S.A.) mthorpe@ilog.fr
Extract from:
Simple Rule Markup Language (SRML): A General XML Rule Representation for Forward-chaining Rules
-------------------------------------------------------------------------------------
Here is an example of a rule expressed using this syntax [see XML DTD]:
Rule: Discount
Description: If
the total purchase amount of a shopping cart is > 100$
Then
Set the discount for the shopping cart to 0.1%
Traditional
Syntax: rule Discount {
when {
?s:ShoppingCart(purchaseAmount > 100);
} then {
update ?s { discount = 0.1; }
}
}
Rule Markup:
Here is an example of a slightly more complex rule marked up using this
syntax:
Rule: CrossSelling
Description: If
Purchase includes a Videotape in the Shopping Cart
AND
The Videotape has a Soundtrack CD
AND
The Soundtrack CD is not already in the Shopping Cart
Then
Suggest the addition of the Soundtrack CD to the Shopping Cart
Traditional
Syntax: rule CrossSelling {
when {
?s: ShoppingCart();
?cd: CD();
?vt: VideoTape(soundtrackCD == ?cd);
Purchase(shoppingCart == ?s; item == ?vt);
not Purchase(shoppingCart == ?s; item == ?cd);
} then {
assert Suggestion {
shoppingCart = ?s;
item = ?cd;
}
}
}
Rule Markup: