[RuleML-all] Re: Need help to define to understand RuleML

Baher Omar baher.omar at gmail.com
Wed Aug 8 18:44:33 ADT 2007


Thanks very much for your attention, your comments clear things much better
for me..

I think you thought that I'm against Prova.. That's not correct, I just
think my current application requires an easy to read/understand rule
language, so virtually anyone, with minimum knowledge of the application,
can read/understand what's required from it..
I need something that is as close to english language as possible, that
would give a lot of power to the application and make it easy/cheaper to
maintain..

Examples of my rules:
1) The value of X cannot be (a, b, or c).
2) Cannot have a repeated name in a list of user names.
3) Cannot have repeated telephone numbers for the same user.
4) The value of Y must be below 100.
5) The value of Z must be between X and Y.
6) The value of W has to be 0 or 1, if Y is set to 10.


Thanks,
-b

On 8/8/07, Adrian Paschke <paschke at in.tum.de> wrote:
>
> Hi Baher,
>
> Here are some additional explanations on the difference between
> declarative programming and procedural programming:
>
> The main difference between Java procedural programming with if-then
> rules and declarative rule-based programming (as e.g. in Prova or
> Prolog) is that in Java you need to specify the complete control flow
> and object-oriented infrastructure, e.g. several methods need to be
> implemented according to the input arguments and return types. The
> if-then (else) rules always need to be processed from the beginning rule
> to the end, i.e. the rules form a kind of tree which can be entered at
> the root, only. Further more large parts of the if-then decision logic
> often need to be replicated in several methods according to the input
> arguments and expected outputs of the methods.
>
> In logic programming rules are written declaratively separated from the
> application (simplifies e.g. management and maintenance) and might form
> a large network of rules which can be entered from anywhere by a query.
> The rule inference engine automatically performs rule chaining and tries
> to infer the answer. Different queries with free variables, bound
> variables or constants can be asked to the same rule.
>
> In a nutshell, the basic idea of declarative rule-programming is that
> users employ rules to express what they want; the responsibility to
> interpret this and to decide on how to do it is delegated to an
> interpreter (e.g., an inference engine or a just in time rule compiler).
>
> In recent years rule based technologies have experienced a remarkable
> come back namely in two areas: business rule processing, and reasoning
> in the context of the semantic web.
>
> Best,
>
> Adrian
>
> -----Ursprüngliche Nachricht-----
> Von: ruleml-all-bounces at ruleml.org
> [mailto:ruleml-all-bounces at ruleml.org] Im Auftrag von Boley, Harold
> Gesendet: Dienstag, 7. August 2007 22:14
> An: Baher Omar; ruleml-all at ruleml.org
> Betreff: RE: [RuleML-all] Re: Need help to define to understand RuleML
>
> Hi Baher,
>
> Some reasons for embedding a (business) rule engine in Java
> can be extracted from "The Principles of Rule Independence"
> <http://www.businessrulesgroup.org/brmanifesto.htm>.
>
> Prova and OO jDREW allow you to run subsets of RuleML 0.91
> <http://www.ruleml.org/0.91> as part of an enclosing Java
> environment, with the advantage that RuleML rules are kept
> in separate, easier-to-maintain XML rulebases.
>
> Can you show us some of your (simpler :-) rules in Java, so
> we have a challenge to do them more declaratively in RuleML?
>
> Prova also supports the evolving Reaction RuleML, for which
> OO jDREW may come up with extensions, too. While findall is
> not yet in RuleML, this and other aggregation operators are
> certainly quite important for future releases. In bottom-up
> mode, OO jDREW does a kind of findall, but this is not yet
> integrated into the top-down mode.
>
> Your original example could of course also be implemented in
> other ways. If your data table is represented as a list of
> pair lists <http://www.ruleml.org/0.91/glossary/#gloss-Plex>
> (which could also be the result of a findall call), then an
> integrity rule could alert users of duplicate pairs in the
> outer list.
>
> Best,
> Harold
>
>
> ________________________________
>
> From: ruleml-all-bounces at ruleml.org
> [mailto:ruleml-all-bounces at ruleml.org] On Behalf Of Baher Omar
> Sent: Friday, August 03, 2007 1:01 AM
> To: ruleml-all at ruleml.org
> Subject: [RuleML-all] Re: Need help to define to understand RuleML
>
>
> Thanks Adrian for your help..
>
> I read more about Prova and it's a very powerful engine.
> However, I don't know why I should choose Prova over Java language as my
> language to write my rules!! Java could provide most of the capabilities
> that Prova supports (with a little more development for sure).
>
> In the matter of fact, all my rules today are implemented in Java.. and
> I want to move away from that by selecting a simple xml based rule
> definitions and a supported engine..
>
> jDREW seems to be simple enough for my needs, but does jDREW support
> Reaction RuleML and maybe generic functions like (findall)?!
>
> Thanks,
> -b
>
>
>
> On 8/1/07, Adrian Paschke <paschke at in.tum.de> wrote:
>
>    Hi Baher,
>
>    A quick answer, since I m currently travelling.
>
>    You may take a look at the Prova documentation:
>
>    http://www.prova.ws/etc/provauserguide_2_0.pdf
>
>    Chapter 4 describes several built-ins. Prova is an open-source
> engine
>    capable of executing Reaction RuleML and in particular supports
>    interchange of event messages.
>
>    We will soon release the next version of Reaction RuleML:
>
>    http://ibis.in.tum.de/research/ReactionRuleML/0.2/
>
>    Reaction RuleML supports messages and messaging reaction rules
> (rules
>    which send and receive messages), e.g.:
>
>
> http://ibis.in.tum.de/research/ReactionRuleML/0.2/examples/message.rrml
> <http://ibis.in.tum.de/research/ReactionRuleML/0.2/examples/message.rrml
> >
>
> http://ibis.in.tum.de/research/ReactionRuleML/0.2/examples/MessagingRule
> .rrml
>
>    I will send you are more detailed answer when I m back.
>
>    BTW the deadline for demo submissions to RuleML-2007 has been
> extended:
>
>    http://2007.ruleml.org/
>
>    This could be interesting for you to submit a demo to the
> Challenge and
>    meet the business rules and rules standardization community
>
>    Best,
>
>    Adrian
>    ________________________________________
>    Von: ruleml-all-bounces at ruleml.org
>    [mailto:ruleml-all-bounces at ruleml.org] Im Auftrag von Baher Omar
>    Gesendet: Mittwoch, 1. August 2007 13:44
>    An: ruleml-all at ruleml.org
>    Betreff: [RuleML-all] Re: Need help to define to understand
> RuleML
>
>    Thanks Adrian,
>
>    Your answers will certainly help to put me on on the right
> track!
>
>    I don't think my table has a single key, it might be an
> aggregate key..
>    Nevertheless, I like the idea of findall function.. I basically
> need a
>    search mechanism in my data set..
>    Is there a place where I can find more information about
> well-known
>    functions?
>
>    I was reading on the Reaction RuleML, and I thought that was the
> right
>    RuleML variation for my application.. (Hence I need message
> based actions).
>    However, I had difficulty finding the correct reading materials
> to learn
>    more about Reaction RuleML, so I decided to go back to the basic
> RuleML
>    and exercise more of it..
>    Is there any open-source rule engine for Reaction RuleML?!
>
>    To answer your last question, I think my system is more of a
>    verification system. It should have business rules and a
> database. I
>    want to use RuleML to verify the business rules aganist a data
> data
>    before committing data to the database.. Therefore, I need to
> use
>    message based actions to report errors to the end-user.
>    Ultimately, I want to share my business rule with other
> applications and
>    maybe other parties..
>
>    Thanks again,
>    -b
>
>
>
>    On 8/1/07, Adrian Paschke <paschke at in.tum.de> wrote:
>    Hi Baher,
>
>    The solution depends on how the table data is represented.
>
>    Assume each row (data set) in the table has a unique id (like a
> primary
>    key) then the fact representation could be tableName(ID,X,Y),
> e.g.
>
>    pair(1,x1,y1).
>    pair(2,x2,y2).
>    &
>
>    A backward-reasoning derivation rule to detect the error could
> then be
>    as follows:
>
>    error(X1,Y2) :- pair(ID1, X1,Y1), pair(ID2, X2,Y2), ID1!= ID2,
> X1=X2,
>    Y1=Y2.
>
>    The RuleML serialization is:
>
>    <Implies>
>    <head>
>    <Atom><Rel>error</Rel></Atom>
>    <Var>X1</Var>
>    <Var>X2</Var>
>    </head>
>    <body>
>    <And>
>    <Atom>
>    <Rel>pair</Rel>
>    <Var>ID1</Var>
>    <Var>X1</Var>
>    <Var>Y1</Var>
>    </Atom>
>    <Atom>
>    <Rel>pair</Rel>
>    <Var>ID2</Var>
>    <Var>X2</Var>
>    <Var>Y2</Var>
>    </Atom>
>    <Not>
>    <Equals>
>    <Var>ID1</Var><Var>ID2</Var>
>    </Equals>
>    </Not>
>    <Equals>
>    <Var>X1</Var>
>    <Var>X2</Var>
>    </Equals>
>    <Equals>
>    <Var>Y1</Var>
>    <Var>Y2</Var>
>    </Equals>
>    </body>
>    <Implies>
>
>    If you don t have an ID, then you might use a function like
>    findall(pair(X,Y),pair(X,Y),List) which aggregates all pairs in
> a list
>    which you might traverse and look for repeated members. However,
> your
>    execution environment needs to support findall (many derivation
> rule
>    engines support it, e.g. Prova).
>
>    You might also use assert and retract update primitives (if
> supported)
>    to implement a global solution. Reaction RuleML
>    ( http://ibis.in.tum.de/research/ReactionRuleML) is supporting
> derivation
>    rules with update primitives.
>
>    Or is your execution environment a production rule system? XML
>    serialization of production rules are also addressed by Reaction
> RuleML.
>
>    Best,
>
>    Adrian
>
>    ________________________________________
>    Von: ruleml-all-bounces at ruleml.org
> <mailto:ruleml-all-bounces at ruleml.org>
>    [mailto: ruleml-all-bounces at ruleml.org] Im Auftrag von Baher
> Omar
>    Gesendet: Mittwoch, 1. August 2007 06:30
>    An: ruleml-all at ruleml.org
>    Betreff: [RuleML-all] Need help to define to understand RuleML
>
>    I'm new to RuleML and I have difficultly coming up with an
> equivalent
>    RuleML for the following rule:
>
>    "if X is repeated in a sequence of variables then that's an
> error"
>
>    Suppose I have the following table data:
>
>    X Y
>    ----------
>    x1 y1
>    x2 y2
>    x3 y2
>    x1 y1
>    x2 y3
>
>
>    x1 occurs twice under y1, that's the violation I'm looking for..
>
>    How can I describe this rule in RuleML?!
>
>    Thanks,
>    -b
>
>
>
>
>
>
>
> _______________________________________________
> RuleML-all mailing list
> RuleML-all at ruleml.org
> http://mail.ruleml.org/mailman/listinfo/ruleml-all
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ruleml.org/pipermail/ruleml-all/attachments/20070808/fa8c3ece/attachment-0001.htm


More information about the RuleML-all mailing list