Semantic Web Drools Module, Request for Feedbak
by Xavier Breton
Hi,
I'm looking for feedback, I'll develop a Semantic Web Drools Module that
will be the subject of my Master Degree Tesis.
The idea is to use Eclipse Modelling Framework (EMF) for prototyping and
follow a Model Driven Architecture (MDA) where the source language is
Semantic of Business Vocabularies and Business Rules (SBVR) and the target
language is Drools DRL.
The mapping could be (PIM level):
- Semantic Web Rule Language (SWRL)
- Ontology Web Language (OWL)
- RuleML
- Rule Interchange Format (RIF)
- REWERSE Rule Markup Language (R2ML)
It could be added to the module at the source UML or Entity Relationship
like models to transform the models into SBVR.
Regards
Xavier Breton
10 years, 10 months
Guided Editor in BRMS / Guvnor Version 5 (Snapshot of 26 June)
by Paul Browne
Folks,
For various reasons I'm trying out the Guided Editor for Business Rules in
the Guvnor Version 5 (Snapshot of 26 June from Hudson, deployed on JBoss App
Server 4.2.2GA).
I've created the Package / Category and uploaded a simple fact model (as
works in BRMS version 4). I create a new business rule using the guided
editor and the screen shows successfully with both 'When' and 'Then'
parts.Assume the next question is due to me missing something, but wanted to
double check:
When I press the green '+' to the right of the screen I am shown the message
/ dialog layer saying '
*Add a condition to the rule... *or* Add an action to the rule.
*Problem is that there doesn't appear to be a way of adding a condition or
action. The only thing I'm seeing in the logs is
* (Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
*Am I missing something or should I come back to Guvnor later in the
development Cycle?
Thanks
Paul
12 years, 9 months
Drools on android
by Justin King
Hi All,
I'm wondering if anyone has tried to use drools in a google android
application, and if so what problems did you have? I'd also be interested to
know if its even possible!
Thanks!
--
Regards,
Justin King
PhD Candidate
Faculty of Information and Communication Technologies
Swinburne University of Technology
http://www.ict.swin.edu.au/ictstaff/justinking
--
Regards,
Justin King
PhD Candidate
Faculty of Information and Communication Technologies
Swinburne University of Technology
http://www.ict.swin.edu.au/ictstaff/justinking
12 years, 11 months
Left and Right Unlinking - Community Project Proposal
by Mark Proctor
In an effort to help encourage those thinking of learning more about
the internals of rule engines. I have made a document on implementating
left and right unlinking. I describe the initial paper in terms relevant
to Drools users, and then how that can be implemented in Drools and a
series of enhancements over the original paper. The task is actually
surprisingly simple and you only need to learn a very small part of the
Drools implementation to do it, as such it's a great getting started
task. For really large stateful systems of hundreds or even thousands of
rules and hundreds of thousands of facts it should save significant
amounts of memory.
http://blog.athico.com/2010/08/left-and-right-unlinking-community.html
Any takers?
Mark
Introduction
The following paper describes Left and Right unlinking enhancements for
Rete based networks:
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.45.6246
<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.45.6246>
A rete based rule engine consists of two parts of the network, the alpha
nodes and the beta nodes. When an object is first inserted into the
engine it is discriminated against by the object type Node, this is a
one input and one output node. From there it may be further
discriminated against by alpha nodes that constrain on literal values
before reaching the right input of a join node in the beta part of the
network. Join nodes have two inputs, left and right. The right input
receives propagations consisting of a single object from the alpha part
of the network. The left input receives propagations consisting of 1 or
more objects, from the parent beta node. We refer to these propagating
objects as LeftTuple and RightTuple, other engines also use the terms
tokens or partial matches. When a tuple propagation reaches a left or
right input it's stored in that inputs memory and it attempts to join
with all possible tuples on the opposite side. If there are no tuples on
the opposite side then no join can happen and the tuple just waits in
the node's memory until a propagation from the opposite side attempts to
join with it. If a given. It would be better if the engine could avoid
populating that node's memory until both sides have tuples. Left and
right unlinking are solutions to this problem.
The paper proposes that a node can either be left unlinked or right
unlinked, but not both, as then the rule would be completely
disconnected from the network. Unlinking an input means that it will not
receive any propagations and that the node's memory for that input is
not populated, saving memory space. When the opposite side, which is
still linked, receives a propagation the unlinked side is linked back in
and receives all the none propagated tuples. As both sides cannot be
unlinked, the paper describes a simple heuristic for choosing which side
to unlink. Which ever side becomes empty first, then unlink the other.
It says that on start up just arbitrarily chose to unlink one side as
default. The initial hit from choosing the wrong side will be
negligible, as the heuristic corrects this after the first set of
propagations.
If the left input becomes empty the right input is unlink, thus clearing
the right input's memory too. The moment the left input receives a
propagation it re-attaches the right input fully populating it's memory.
The node can then attempt joins as normal. Vice-versa if the right input
becomes empty it unlinks the left input. The moment the right input
receives a propagation it re-attaches the left input fully populating
it's memory so that the node can attempt to join as normal.
Implementing Left and Right Unlinking for shared Knowledge Bases
The description of unlinking in the paper won't work for Drools or for
other rule engines that share the knowledge base between multiple
sessions. In Drools the session data is decoupled from the main
knowledge base and multiple sessions can share the same knowledge base.
The paper above describes systems where the session data is tightly
coupled to the knowledge base and the knowledge base has only a single
session. In shared systems a node input that is empty for one session
might not be empty for another. Instead of physically unlinking the
nodes, as described in the paper, an integer value can be used on the
session's node memory that indicates if the node is unlinked for left,
right or both inputs. When the propagating node attempts to propagate
instead of just creating a left or right tuple and pushing it into the
node. It'll first retrieve the node's memory and only create the tuple
and propagate if it's linked.
This is great as it also avoids creating tuple objects that would just
be discarded afterwards as there would be nothing to join with, making
things lighter on the GC. However it means the engine looks up the node
memory twice, once before propagating to the node and also inside of the
node as it attempt to do joins. Instead the node memory should be looked
up once, prior to propagating and then passed as an argument, avoiding
the double lookup.
Traditional Rete has memory per alpha node, for each literal constraint,
in the network. Drools does not have alpha memory, instead facts are
pulled from the object type node. This means that facts may needlessly
evaluate in the alpha part of the network, only to be refused addition
to the node memory afterwards. Rete supports something called "node
sharing", where multiple rules with similar constructs use the same
nodes in the network. For this reason shared nodes cannot easily be
unlinked. As a compromise when the alpha node is no longer shared, the
network can do a node memory lookup, prior to doing the evaluation and
check if that section of the network is unlinked and avoid attempting
the evaluation if it is. This allows for left and right unlinking to be
used in a engine such as Drools.
Using Left and Right Unlinking at the Same Time
The original paper describes an implantation in which a node cannot have
both the left and right inputs unlinked for the same node. Building on
the extension above to allow unlinking to work with a shared knowledge
base the initial linking status value can be set to both left and right
being unlinked. However in this initial state, where both sides are
unlinked, the leaf node's right input isn't just waiting for a left
propagation so the right can re-link itself (which it can't as the left
is unlinked too). It's also waiting to receive it's first propagation,
when it does it will link the left input back in. This will then tell
it's parent node's right input to also do the same, i.e. wait for it's
first right input propagation and link in the left when it happens. If
it already has a right propagation it'll just link in the left anyway.
This will trickle up until the root is finally linked in and
propagations can happen as normally, and the rule's nodes return to the
above heuristics for when to link and unlink the nodes.
Avoid Unnecessary Eager Propagations
A rule always eagerly propagates all joins, regardless of whether the
child node can undertake joins too, for instance of there is no
propagates for the leaf node then no rules can fire, and the eager
propagations are wasted work. Unlinking can be extended to try to
prevent some level of eager propagations. Should the leaf node become
right unlinked and that right input also become empty it will unlink the
left too (so both sides are unlinked) and go back to waiting for the
first right propagation, at which point it'll re-link the left. If the
parent node also has it's right input unlinked at the point that it's
child node unlinks the left it will do this too. It will repeat this up
the chain until it reaches a node that has both left and right linked
in. This stops any further eager matching from occurring that we know
can't result in an activation until the leaf node has at least one right
input.
Heuristics to Avoid Churn from Excessive and Unnecessary Unlinking
The only case where left and right linking would be a bad idea is in
situations that would cause a "churn". Churn is when a node with have a
large amount of right input memory is continually caused to be linked in
and linked out, forcing those nodes to be repeatedly populated which
causes a slow down. However heuristics can be used here too, to avoid
unnecessary unlinking. The first time an input becomes empty unlink the
opposite and store a time stamp (integer counter for fact handles from
the WM). Then have a minimum delta number, say 100. The next time it
attempts to unlink, calculate the delta of the current time stamp
(integer counter on fact handle) and the time stamp of the node which
last unlinked (which was recorded at the point of unlinking) if it's
less than 100 then do nothing and don't unlink until it's 100 or more.
If it's 100 or more then unlink and as well as storing the unlink time
stamp, then take the delta of 100 or more and apply a multiple (2, 3, 4
etc depending on how steep you want it to rise, 3 is a good starting
number) and store it. Such as if the delta is 100 then store 300. The
next time the node links and attempts to unlink it must be a delta of
300 or more, the time after that 900 the time after that 2700.
14 years, 1 month
unknown error while parsing
by Boschung Daniel
hi folks
drools prompt me to contact the development team. the following error apears, whithout stacktrace, while developing
a rule. maybe the error is known to you?!
thanks for a little statement
daniel
14 years, 1 month
Lazily Enabled Truth Maintenace (Project Propsoal)
by Mark Proctor
Here is another project proposal, this time simpler. I think this one
has Wolfgang's name on it ;)
http://blog.athico.com/2010/09/lazily-enabled-truth-maintenace.html
Three weeks ago I posted the project idea for "Left and Right Unlinking"
<http://blog.athico.com/2010/08/left-and-right-unlinking-community.html>. So
far there are no takers, so if you are interested let me know :)
In the meantime I tried to think of a simpler enhancement that we would
like to see done.
At the moment Drools has a user setting "MaintainTMSOption" which can be
true or false. It's a small optimisation that when turned off avoids
using the equality hashmap that is maintained for all inserted objects.
It would be a much better idea to remove this configuration setting,
thus simplifying things for end users and have TMS lazily enabled on demand.
For each object type there is an "ObjectTypeConf" configuration object
that is retrieved every time a working memory action, such as insert, is
executed. The enabledTMS boolean should be moved there, so there is one
per object type, by default it is false.
When a working memory action occurs, like insert, it retrieved the
ObjectTypeConf and checks the maintainTms boolean there, instead of the
current engine scoped configuration. When a logical insertion occurs and
the ObjectTypeConf is retrieved if maintainTms is false it sets the
value to true and then iterates the associated ObjectTypeNode memory
lazily adding all the objects to the TMS equality map. From then on for
that ObjectType all inserted objects are added to that equality map.
With this you now have the advantage of TMS being laziy enabled, so the
minor hashmap operation is no longer used and likewise a small memory
saving from not populating the map. There is a further advantage that
this is now fine grained and when enabled only impacts for that specific
object type.
A further enhancement could use a int counter, instead of a boolean.
Each logical insertion for that object type increases the counter, each
retraction decreases the counter; even if automatically retracted if the
truth is broken for that logical assertion. When the counter reaches
zero, TMS for that OTN can be disabled. We do not however remove the
objects from the equality map, as this would cause "churn" if TMS is
continuously enabled and disabled. Instead when TMS is disabled record
the current fact counter id. Then if TMS is disabled on a retraction but
there is a counter id, we can check that counter id to see if the fact
is prior to TMS being disabled and thus would need to be retracted from
the equality map.
14 years, 2 months
drools-guvnor and drools-factcontstraints: commit before Friday
by Geoffrey De Smet
Next Friday (starting from 8:00 CET) I 'll:
- move the drools-factcontstraints module into the drools-guvnor module
- move the drools-guvnor-gwtclient part out of the drools-guvnor module
into a separate module
So please commit anything in those directories before Friday 8:00 CET. I
'll give a sign on IRC and this dev list once it's done.
More info about what will be done and feed-back welcome in the jira issue:
https://jira.jboss.org/browse/JBRULES-2707
This change will allow us to use the maven-gwt-plugin (so remove the ANT
script in guvnor) and remove the generated javascripts files from
subversion (no more tree conflicts on drools-guvnor/src/main/webapp/org...)
--
With kind regards,
Geoffrey De Smet
14 years, 2 months
Simple process not working for me...
by bobbreitling
I have one node process with a workflow group with two rules as follows:
rule "Test"
ruleflow-group "StudioSampleListenerValidate"
when
then
System.out.println("GOT HERE FIRST");
end
rule "StudioSampleListener"
ruleflow-group "StudioSampleListenerValidate"
when
processInstance : WorkflowProcessInstance()
then
System.out.println("GOT HERE");
end
Without the first rule (Test) the seconds rules println with not run.
Does this make any sense?
On another front, I am trying to write rules that have constraints that use
a process variable (i.e. passed through the startProcess parameter map). I
have them registered in my RuleFlow process but my rule never fire. I am
following the banking example in the Drools book but I am having no luck.
Any suggestions?
TIA,
Bob
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Simple-process-not-wo...
Sent from the Drools - Dev mailing list archive at Nabble.com.
14 years, 3 months
Re: [rules-dev] Drools syntax diagrams - redrawn
by Greg Barton
Yes, and I don't think we want to take readability cues from Perl. :)
GreG
On Sep 23, 2010, at 3:03, Wolfgang Laun <wolfgang.laun(a)gmail.com> wrote:
On 23 September 2010 09:31, Bruno Unna <bruno.unna(a)gmail.com> wrote:
FWIW: in Perl, there are both operators as well (|| and 'or'). However, they are *not* exactly the same. Although they can be used in any context to render a boolean expression, their priority makes the difference. Taken from official documentation (http://bit.ly/dgw4GT):
Low precedence "and", "or", "xor" were introduced to permit "Perl poetry", or, more seriously, to
permit control flow using a logical expression, especially after function calls without parentheses.
see Naples or die; # same as: see(Napes) || die(); but not: see(Naples || die() );
No way this makes any sense in Drools.
-W
Binary "or" returns the logical disjunction of the two surrounding expressions. It's equivalent to || except for the very low precedence. This makes it useful for control flow.
Nonetheless, it must be taken into account that the distinction makes sense for a Perl programmer. For a rules-writing guy (or girl) perhaps the distinction is extremely obscure.
Regards.
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
14 years, 3 months