[RuleML-all] Multiple Assertions and Avoiding Recursion with
RuleML& NxBRE
Boley, Harold
Harold.Boley at nrc-cnrc.gc.ca
Sun Nov 18 23:17:33 AST 2007
Hi Don, NxBRE Developers, and All,
The RuleML-2007 paper "Are Your Rules Online? Four Web Rule Essentials":
http://www.ruleml.org/talks/RuleEssentials-talk.ppt
http://www.cs.unb.ca/~boley/papers/RuleEssentials.pdf
explains (much of) these examples, valid w.r.t. the RuleML 0.91 XSDs:
http://www.ruleml.org/usecases/essentials
The above are, however, only examples for Derivation RuleML:
http://www.ruleml.org/modularization/#Model
The logic variables used in Derivation RuleML cannot be updated except
consistently specialized. E.g., in hornlogeq the conjunctive query
corresponding to ?x=0, ?x=1 fails, but ?x=?y, ?x=1 succeeds.
You can derive multiple atoms by using a conjunction in a rule
conclusion,
as allowed in some RuleML sublanguages. FOL RuleML even allows
disjunctions
in the conclusions of rules: http://www.ruleml.org/fol/#Disjunctions.
Because
of this, and to allow stripe skipping, we make the <And> vs. <Or>
distinction
explicit in the <head>.
Your example <head> would thus become:
<head>
<And>
<Atom>
<Rel>RelDerived 1</Rel>
<Var>entity</Var>
<Ind>DerivedValue 1</Ind>
</Atom>
<Atom>
<Rel>RelDerived 2</Rel>
<Var>entity</Var>
<Ind>DerivedValue 2</Ind>
</Atom>
</And>
</head>
With stripe skipping, your first rule would then become:
<Implies>
<Atom>
<Rel>RelBase</Rel>
<Var>entity</Var>
<Ind>BaseValue</Ind>
</Atom>
<And>
<Atom>
<Rel>RelDerived 1</Rel>
<Var>entity</Var>
<Ind>DerivedValue 1</Ind>
</Atom>
<Atom>
<Rel>RelDerived 2</Rel>
<Var>entity</Var>
<Ind>DerivedValue 2</Ind>
</Atom>
</And>
</Implies>
Perhaps a NxBRE developer can clarify the update rule in "another
situation".
Regarding actions such as updates, please stay tuned to Reaction RuleML:
http://ibis.in.tum.de/research/ReactionRuleML
http://mail.ruleml.org/pipermail/reaction-tg (mailing list)
Best,
Harold
-----Original Message-----
From: ruleml-all-bounces at ruleml.org
[mailto:ruleml-all-bounces at ruleml.org] On Behalf Of dhuffkc at hotmail.com
Sent: November 16, 2007 12:01 PM
To: ruleml-all at ruleml.org
Subject: [RuleML-all] Multiple Assertions and Avoiding Recursion with
RuleML& NxBRE
Pardon the basic questions. I am using the NxBRE .NET engine, but my
questions are primarily RuleML-related. If there's a "RuleML by
Example"
resource available or a better forum to post I'd love to know about it.
Can I assert multiple new facts for the same condition (multiple heads
for one body)? Something like:
<Implies>
<head>
<Atom>
<Rel>RelDerived 1</Rel>
<Var>entity</Var>
<Ind>DerivedValue 1</Ind>
</Atom>
<Atom>
<Rel>RelDerived 2</Rel>
<Var>entity</Var>
<Ind>DerivedValue 2</Ind>
</Atom>
</head>
<body>
<Atom>
<Rel>RelBase</Rel>
<Var>entity</Var>
<Ind>BaseValue</Ind>
</Atom>
</body>
</Implies>
In another situation, I am deriving a new fact, then have rules that
modify that fact. I only want to apply the modified rules once, however
the second implication continues to run:
<!-- assert new fact based on value of existing fact --> <Implies>
<Atom>
<Rel>Rel1</Rel>
<Var>entity</Var>
<Var>v1</Var>
</Atom>
<Atom>
<Rel>NewRel</Rel>
<Var>entity</Var>
<Ind uri="nxbre://expression">{var:v1}</Ind>
</Atom>
</Implies>
<!-- if Rel2(entity,i2) AND NewRel(entity,newValue), modify new fact
NewRel(entity,newValue+1) only once -->
<Implies>
<And>
<Atom>
<Rel>Rel2</Rel>
<Var>entity</Var>
<Ind>i2</Ind>
</Atom>
<Atom>
<Rel>NewRel</Rel>
<Var>entity</Var>
<Var>newValue</Var>
</Atom>
</And>
<Atom>
<Rel>NewRel</Rel>
<Var>entity</Var>
<Ind uri="nxbre://expression">{var:newValue} + 1</Ind>
</Atom>
</Implies>
This is probably clear as mud, but any assistance is appreciated.
Regards,
Don Huff
_______________________________________________
RuleML-all mailing list
RuleML-all at ruleml.org
http://mail.ruleml.org/mailman/listinfo/ruleml-all
More information about the RuleML-all
mailing list