Re: [rules-users] Binding a variable with an OR pattern

2013-08-13 Thread Joe Ammann
On 08/13/2013 04:31 PM, Wolfgang Laun wrote:
> Sorry, I missed that.
>
> rule "R7012: UpdateInstrumentsIssuerFrom700[01]"
> agenda-group "TRANSFER_TO_LIVE"
> salience 100
> when
>  sirole : SourcingInstitutionRole(sourcing_Status ==
> SourcingStatus.IMPORTED,
>   $rcd: roleCd == "7000"  || == "7001")
> not SourcingInstitutionRole(sourcing_Status == SourcingStatus.IMPORTED,
>   roleCd == "7001" && > $rcd )
>
Works nicely! Just to make sure that I correctly understood it:

The "roleCd == "7001" && > $rcd" part of the last pattern could also be
written as "roleCd == "7001" && != $rcd". That && > is just to make sure
the last pattern matches for the 7000 fact if there is a corresponding
7001 fact.

Thanks again!

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Binding a variable with an OR pattern

2013-08-13 Thread Joe Ammann
On 08/13/2013 03:18 PM, Wolfgang Laun wrote:
> rule "R7012: UpdateInstrumentsIssuerFrom700[01]"
> agenda-group "TRANSFER_TO_LIVE"
> salience 100
> when
> sirole : SourcingInstitutionRole(sourcing_Status ==
> SourcingStatus.IMPORTED,
>  roleCd == "7000"  || == "7001")
>
> and minor changes in the then part.
Hm, that was my first thought too - but doesn't such a rule fire 2 times
if there are 2 facts (one with 7000 and another one with 7001)?

Because this would be wrong: if both facts exist, the rule should only
trigger once, with the 7001 fact. The 7000 fact would need to be ignored
in that case.

Probably I wasn't clear when I stated my problem :-) Sorry

Thanks!

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Binding a variable with an OR pattern

2013-08-13 Thread Joe Ammann
On 08/13/2013 03:02 PM, Joe Ammann wrote:
> Hi all
>
> Trying to do the following: as one pattern of a rule, I want to bind a
> variable to a fact with code "7001", or (if such a fact does not exist)
> to one with the value "7000".
>
> Until now, I haven't been able to formulate this in one single rule, as
> simple as it sounds - probably I'm just overlooking something basic ...
>
> Currently I have 2 rules:
>
> rule "R7012: UpdateInstrumentsIssuerFrom7001"
> agenda-group "TRANSFER_TO_LIVE"
> salience 100
> when
> sirole : SourcingInstitutionRole(sourcing_Status ==
> SourcingStatus.IMPORTED,
>  roleCd == "7001" )
> insti  : Institution ( ids != null, ids.sspFI ==
> sirole.institutionProviderId )
> instr  : Instrument ( ids != null, ids.sspFI == sirole.providerId,
> issuer.issuerId != insti.id )
> then
> tlog.info("Modify issuer of {} to {} (from role code 7001)", instr,
> insti);
> modify (instr) {
> issuer.issuerId = insti.id
> }
> end
>
> rule "R7012: UpdateInstrumentsIssuerFrom7000"
> agenda-group "TRANSFER_TO_LIVE"
> salience 100
> when
> sirole : SourcingInstitutionRole(sourcing_Status ==
> SourcingStatus.IMPORTED, roleCd == "7000" )
> insti  : Institution ( ids != null, ids.sspFI ==
> sirole.institutionProviderId )
> instr  : Instrument ( ids != null, ids.sspFI == sirole.providerId, 
> issuer.issuerId != insti.id )
> not SourcingInstitutionRole(sourcing_Status == SourcingStatus.IMPORTED,
> providerId == instr.ids.sspFI,
> institutionProviderId == instr.ids.sspFI,
> roleCd == "7001" )
> then
> tlog.info("Modify issuer of {} to {} (from role code 7000)", instr,
> insti);
> modify (instr) {
> issuer.issuerId = insti.id
> }
> end
>
> This seems to work, but I would have expected that it should be easy to
> do this in one single rule !? But I just can't come up with a rule that
> does what I want...
>
> How would I formulate such as rule?
>
BTW: Just realized that those 2 rules would - in some cases - result in
and endless loop. Fixed that with a guard fact, but still my original
question remains.

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Binding a variable with an OR pattern

2013-08-13 Thread Joe Ammann
Hi all

Trying to do the following: as one pattern of a rule, I want to bind a
variable to a fact with code "7001", or (if such a fact does not exist)
to one with the value "7000".

Until now, I haven't been able to formulate this in one single rule, as
simple as it sounds - probably I'm just overlooking something basic ...

Currently I have 2 rules:

rule "R7012: UpdateInstrumentsIssuerFrom7001"
agenda-group "TRANSFER_TO_LIVE"
salience 100
when
sirole : SourcingInstitutionRole(sourcing_Status ==
SourcingStatus.IMPORTED,
 roleCd == "7001" )
insti  : Institution ( ids != null, ids.sspFI ==
sirole.institutionProviderId )
instr  : Instrument ( ids != null, ids.sspFI == sirole.providerId,
issuer.issuerId != insti.id )
then
tlog.info("Modify issuer of {} to {} (from role code 7001)", instr,
insti);
modify (instr) {
issuer.issuerId = insti.id
}
end

rule "R7012: UpdateInstrumentsIssuerFrom7000"
agenda-group "TRANSFER_TO_LIVE"
salience 100
when
sirole : SourcingInstitutionRole(sourcing_Status ==
SourcingStatus.IMPORTED, roleCd == "7000" )
insti  : Institution ( ids != null, ids.sspFI ==
sirole.institutionProviderId )
instr  : Instrument ( ids != null, ids.sspFI == sirole.providerId, 
issuer.issuerId != insti.id )
not SourcingInstitutionRole(sourcing_Status == SourcingStatus.IMPORTED,
providerId == instr.ids.sspFI,
institutionProviderId == instr.ids.sspFI,
roleCd == "7001" )
then
tlog.info("Modify issuer of {} to {} (from role code 7000)", instr,
insti);
modify (instr) {
issuer.issuerId = insti.id
}
end

This seems to work, but I would have expected that it should be easy to
do this in one single rule !? But I just can't come up with a rule that
does what I want...

How would I formulate such as rule?

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rule set execution performance and memory consumption issues

2013-08-05 Thread Joe Ammann
On 08/05/2013 09:04 AM, Wolfgang Laun wrote:
> Fine. Although occasionally useful, "from " is often used
> as a cover-up for inadequate design of fact types. (from
> collect/accumulate is a different matter.) 
That was exactly the case before we found out how to make fact types
"more rule friendly". Luckily we are generating the fact classes from a
model, so we could implement some "rule helper functionality" quite
easily. For example, we generate all fact classes in 2 incarnations:
once as fully featured implementation classes with Hibernate, JAXB and
god-knows-what dependencies for the runtime system, and once as "almost
pure Java beans" for using them as models in Guvnor.
> Hmm, there isn't much. Perhaps I should consider writing another white
> paper on monitoring.
That would be an excellent idea, me thinks ! I think with the
Annotations coming in Drools 6 one could put together a really useful
set of monitoring annotations (I have some experience doing this for
Java/Spring, but not for Drools, obviously. But I could be a good tester :-)
>
> Activations are created whenever WM changes (or rule base changes)
> make LHSs true for some fact set. At first, an activation is added to
> the agenda. Firing removes an activation, but so does any change to
> the set of facts in the WM. For instance:
>rule AB when
>   A( $aid: id )
>   not B( id == $aid )
>then ... end
> Inserting 100k As and *then* 100k matching Bs before calling
> fireAllRules creates and deletes 100k activations; with Bs before As
> nothing is wasted.
Aha! That could be my problem, I'm doing exactly that in one case.
Wasn't really aware the the sequence of fact insertion can have such a
great impact...
> Activations can be destroyed by calling clear() on the Agenda, and
> they can "evaporate" by being filtered away by an AgendaFilter that's
> passed to the fireXY method.
>
I can see use cases for using an AgendaFilter (like "eliminating"
certain rules without changing the rule set and without clobbering the
LHS with guard facts.

But what would be a good example where I would use clear() on the Agenda
? Can't really think of one, but maybe I still did not understand the
concept fully...

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rule set execution performance and memory consumption issues

2013-08-04 Thread Joe Ammann
On 08/05/2013 06:29 AM, Wolfgang Laun wrote:
> Guete Morge Joe,
:-) Guete Morge Wolfgang
>
> from that other thread I can recall that you are using "from
> ", which (not knowing the rest) would be high up on my
> suspect list.
That's one thing I already learnt :-) I'm not using any "from" clauses
in my rule sets which are used against the "big" fact sets.

That other rule set from the other thread was used in a different
context, where the number of facts is much smaller (in the hundreds).
>
> And, in order to learn more, some monitoring should be considered. The
> number of activation creations and deletions (not by firing) can
> indicate wasted work that might be avoided.
I tried to implement something like that, but must admit that I don't
yet understand how I would do such a monitoring?! All I currently have
are custom AgendaEventListener and WorkingMemoryEventListener. I would
suspect that to implement such a monitoring, I would use

void activationCreated(ActivationCreatedEvent event);
void activationCancelled(ActivationCancelledEvent event);

of the AgendaEventListener. Could you point me to some documentation
that explains when exactly those events are triggered? Until now, I
haven't found too much doc on these aspects of Drools :-/

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rule set execution performance and memory consumption issues

2013-08-04 Thread Joe Ammann
Hi Wolfgang

On 08/04/2013 03:10 PM, Wolfgang Laun wrote:
> A simple test shows that, with the rules as shown, you can insert 100k
> Assignments and an equal number of SourceAssignments (with ~300
> InstrumentList facts) in a matter of seconds, irrespective of the
> number of hits and  misses, either way. I suspect that there is some
> other fly in the ointment.
I suspect this too, but am unable to lay my fingers on it,
unfortunately. That's why I started to question my basic pattern. But
all my test trying to get to the core of the problem showed the same as
your quick tests - there is absolutely no fundamental problem handling a
couple of 100'000 objects.
>
> There is no "Instrument" pattern in any of the rules, which makes your
> post slightly inconsistent in itself.
Right - I was trying to explain the pattern which I suspected to be the
culprit, without posting a dozen Java classes and a couple of dozens of
rules. Always a difficult thing to do. The real rules have many more
patterns, after matching the basic objects, e.g.

rule "R1110: MatchExistingAssignment"
when
sa : SourcingAssignment( )
a : Assignment( instrumentId == sa.instrumentId, instrumentListId ==
sa.instrumentListId )
i  : Instrument( id == instrumentId, foType == FOTYPE.Stock,
statusCd == INSTRUMENT_STATUS.Draft )
not DQAttribute ( rootId == i.id, attributePath ==
Instrument._ATTR_statusCd )

 then

I think I have in the meantime found the main issue - it was one single
rule that caused the majority of the problem. It was written really
stupidly ... The time is now down to ~ 2 minutes. Still I see in the log

2013-08-05 00:36:56.224 [ain] DEBUG: Check:
start inserting objects into working memory {|| - |}
2013-08-05 00:36:56.225 [ain] DEBUG: Check: next
object type: SourcingInstrument, (12668 instances) {|| - |}
2013-08-05 00:36:56.701 [ain] DEBUG: Check: next
object type: SourcingInstrumentList, (38 instances) {|| - |}
2013-08-05 00:36:56.707 [ain] DEBUG: Check: next
object type: SourcingAssignment, (194693 instances) {|| - |}
2013-08-05 00:36:57.573 [ain] DEBUG: Check: next
object type: Instrument, (17876 instances) {|| - |}
2013-08-05 00:37:41.009 [ain] DEBUG: Check: next
object type: InstrumentList, (49 instances) {|| - |}
2013-08-05 00:37:41.359 [ain] DEBUG: Check:
finished inserting objects into working memory {|| - |}
2013-08-05 00:37:41.360 [ain] DEBUG: Check: fire
validate staging rules {|| - |}
2013-08-05 00:37:43.502 [ain] DEBUG: Check:
validate staging rules finished, 147674 executed {|| - |}
2013-08-05 00:37:43.502 [ain] DEBUG: Check:
start inserting objects into working memory {|| - |}
2013-08-05 00:37:43.502 [ain] DEBUG: Check: next
object type: Assignment, (120006 instances) {|| - |}
2013-08-05 00:37:50.114 [ain] DEBUG: Check:
finished inserting objects into working memory {|| - |}

And I'm wondering a bit why inserting 17876 Instruments takes 45
seconds, while inserting 194693 SourcingAssignments takes less than a
second.

I must admit that I have absolutely no clue how I would systematically
debug such a situation and try to find out which rules are causing the
"problem". I stumbled over this one stupid rule just by going through
them one by one. I'm trying to get some experience to cope with such
problems - since I'm not the only one writing the rules, I continue to
see such "unexplicable" slowdowns.

Sigh - I guess I still have A LOT to learn about Drools :-)

Thanks for your help Wolfgang - and BTW: your whitepaper about rule
patterns is a major reference for my learning.

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Rule set execution performance and memory consumption issues

2013-08-04 Thread Joe Ammann
Hi all (sorry for the lenghty post, I'm trying to describe a basic pattern)

I have a set of similar rules which work ok, but due to increasing
number of facts are starting to create performance headaches. They all
share a basic pattern, and I wanted to ask if you think that my approach
is feasible - or if I should choose a totally different approach.

The basic pattern is that I have a set of facts of one type, where every
fact "owns" a collection of facts of another type. The association is
not a simple one, rather it has some attributes on its own. The ruleset
is triggered when a new file delivery from a financial data provider
arrives, and we want to check the quality of the new data.

Examples:

FinancialInstrument  -> Recommendation/Rating (where the recommendation
has a date, a rating code, etc.)
InstrumentList -> FinancialInstrumentAssignment (where the assignment
has a priority, a validFrom date, etc.)

So we have existing assignments in our database (say 100
InstrumentLists, 20'000 Instruments, 200'000 individual list
assignments), and a new file arrives. The data in this file is converted
and loaded into staging tables, and ends up in special Java objects we
call "SourcingXXX". So a "Instrument" always has a corresponding
"SourcingInstrument" class.

The rules must validate the incoming data and modify (insert, update,
delete) the existing objects. My current basic rule pattern is that for
every such "association", I have 3 or more rules like:

# the mappings that already exist
rule "R1110: MatchExistingAssignment"
when
sa : SourcingAssignment( )
a : Assignment( instrumentId == sa.instrumentId,
instrumentListId == sa.instrumentListId )
then
# apply the logic
retract(a);
retract(sa);
end

# new mappings must be created
rule "R: MatchNewAssignment"
when
sa : SourcingAssignment( )
not a : Assignment( instrumentId == sa.instrumentId,
instrumentListId == sa.instrumentListId )
il : InstrumentList( id == sa.instrumentListId )
then
# create new assignment
Assignment a = ...
retract(sa);
end

# missing mappings must be removed
# execute late when the above have had a chance
rule "R1112: RemoveAssignment"
salience -100
when
a : Assignment( )
then
# remove the assignment
retract(a);
end

I shortened these rules to emphasize the basic pattern (hopefully no
typos made..). Normally the rules have more conditions than just the
mapping conditions shown here, and typically there is more than one rule
for the "new case" and the "already exists case".

Typical fact numbers are
- a few 100-1000 of the "owning" object (InstrumentList above)
- a few 10'000 of the "owned" object (Instrument above)
- a few 100'000 of the "assignment" object (Assignment above)

I'm starting to see problematic runtimes (~20 minutes) and memory
consumption (1-2 GB), of course mainly with the "assignment object"
rules, where 100'000 Sourcing objects are matched against 100'000 or so
existing objects. Most of that is of course used during the insertion of
the facts, the fireAllRules() is fast (1-2 minutes).

Is my approach totally flawed? Is there a fundamentally different
approach? I see that some simple cases could be done without Drools in
SQL or Java, but IMHO the more complex cases result in unmanageable
Java/SQL code (we already have one example of a 200 line SQL statement
that nobody dares to touch...)

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Testing for non-existance of an object in list

2013-08-04 Thread Joe Ammann
On 08/04/2013 10:05 AM, Wolfgang Laun wrote:
> The rule is correct, and it works with similar scenarios.There may be
> a bug, due to circumstances. Can you post a simple but complete set of
> files to reproduce this?
>
You're perfectly right :-) The rule was correct, but as I wrote in an
earlier post, I forgot to modify() the DQAttribute fact after changing
the checkViolations collection. So the engine could not know the correct
contents of the collection.

Thanks for looking into this!

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Testing for non-existance of an object in list

2013-08-04 Thread Joe Ammann
Sorry, the actual error in my logic was totally unrelated to the
fragment below.

The problem was that the DQAttribute that should have matched below was
inserted by another rule, but the insertion was done at a time when the
checkViolations collection was still emtpy. And I had forgotten the
modify() after filling the checkViolations collection.

So the rule "saw" an empty collection and that last condition did not
trigger. Once I corrected that, things started working :-)

On 08/03/2013 10:59 PM, Joe Ammann wrote:
> Here's what I currently have (Drools 5.5.0 btw):
>
> rule "R2030: UpdateDQAttribute"
> dialect "mvel"
> agenda-group "PROCESS_CHECKRESULTS"
> when
> pv : PriceViolation ( p : changedPrice.price, dqc : check )
> ps : PriceSeries ( id == p.seriesId )
> i : Instrument ( id == ps.instrument.id )
> dqa : DQAttribute ( rootId == i.id, objectId == p.id )
> not dqcv : DQCheckViolation ( check.id == dqc.id ) from
> dqa.checkViolations
> then
> # debug
> for (DQCheckViolation dqcv : dqa.checkViolations) {
> logger.debug("dqc: {}, dqcv: {}", dqc.id, dqcv.check.id);
>
> }
> end
>
> The rule fires and the log statement produces
>
> PriceCheck: dqc: 6fc6636b-9b7c-4302-bce7-1680eec57830, dqcv:
> 6fc6636b-9b7c-4302-bce7-1680eec57830
>
> The ids are the same, so I would have expected that last LHS condition
> to avoid that the rule fires.

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

[rules-users] Testing for non-existance of an object in list

2013-08-03 Thread Joe Ammann
Hi all

I'm still struggling with the handling of lists and membership in the
LHS of rule. I'm trying to formulate a rule that only fires if a certain
object is not yet a member of a list.

Here's what I currently have (Drools 5.5.0 btw):

rule "R2030: UpdateDQAttribute"
dialect "mvel"
agenda-group "PROCESS_CHECKRESULTS"
when
pv : PriceViolation ( p : changedPrice.price, dqc : check )
ps : PriceSeries ( id == p.seriesId )
i : Instrument ( id == ps.instrument.id )
dqa : DQAttribute ( rootId == i.id, objectId == p.id )
not dqcv : DQCheckViolation ( check.id == dqc.id ) from
dqa.checkViolations
then
# debug
for (DQCheckViolation dqcv : dqa.checkViolations) {
logger.debug("dqc: {}, dqcv: {}", dqc.id, dqcv.check.id);
   
}
end

The rule fires and the log statement produces

PriceCheck: dqc: 6fc6636b-9b7c-4302-bce7-1680eec57830, dqcv:
6fc6636b-9b7c-4302-bce7-1680eec57830

The ids are the same, so I would have expected that last LHS condition
to avoid that the rule fires.

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Drools with Gemfire

2012-08-06 Thread Joe Ammann
Hi Rich

On 08/06/2012 03:26 PM, rtella wrote:
>   I'm looking into integrating Drools with a system that has large (40GB+) 
> Gemfire Maps.  The rules would need to access the Gemfire Maps, which can be
> updated at any time.I understand I can't access the Gemfire Maps as
> global data since they aren't immutable.  Inserting the maps also doesn't
> seem like a good idea either since I'd  have to call modify() frequently on
> Maps with as many as 1M elements.Is there any alternative for accessing
> large amounts of changing data?
We had quite a similiar use case (financial instruments, millions of
associated prices in a Gemfire map, need to reason over many (~100'000)
instruments, in some cases taking price data (~300mio) into account).

We ended up asserting the instruments as facts into WM, do the majority
of the reasoning on them, and when really required, accessing the prices
from the Gemfire map with a "from" conditional expression

For example:

WHEN
i : Instrument ( assetClass == "Bond" )
ps : PriceSeries ( instrumentId = i.id, priceType = "EndOfDay" )
price : Price ( ) from ps.getPrices()// her we access the
Gemfire map
.

So instruments and price series (in our case) are facts in WM, while the
prices stay in the Gemfire maps. Of course, that has the drawback that
we can not react directly to new or modified prices. Which in our case
was ok. Only a minority of the rules needed to take prices into account
at all, so we first fired all rules that did not access the maps,
retracting all instruments we could. Then the rules with lower salience
that accessed the maps fired.

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Plugging custom verification rules into Guvnor

2012-05-18 Thread Joe Ammann
Hi Wolfgang

On 05/17/2012 06:31 PM, Wolfgang Laun wrote:
> you might also consider adding your own rule to one of the existing
> verifyer DRL files. I think they are part of some .jar file, so all
> you'd need to do is de-jar, edit, re-jar, or just fiddle with class
> path if that's the way the verifiy locates the DRL resources.

I think I will do this stepwise, to get a feeling of the needed changes
in Guvnor

1) as you suggest, fiddle the drools-verifier.jar and provide new rules
2) import the rules into a Guvnor package package, and try to change the
invocation of VerifierBuilderConfiguration inside Guvnor to pick up the
rules from this package (instead of the changeset.xml in the
drools-verifier)
3) make the name of the package configurable somehow in the Guvnor GUI
and automate the import of the default rules from drools-verifier

But don't hold your breath :-)

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Plugging custom verification rules into Guvnor

2012-05-16 Thread Joe Ammann
Hi all

coming from another thread [1], Wolfgang pointed me to the Guvnor/Drools
verifier. I am looking now for ways to implement my own verification
rules into Guvnor.

Ideally, I would like to be able to hook into 2 places in Guvnor with
custom rules (maybe these are going actually through the same code path
in Guvnor)
1) When editing BRLs (or other business oriented asset types) and
selecting "Source -> Verify"
2) When doing "Run Analysis" on a package in QA Menu

I searched the documentation and had a quick look at the source of
Guvnor, but wasn't able to quickly find the way to achieve this. Any
pointers?

-- 
CU, Joe

[1] http://lists.jboss.org/pipermail/rules-users/2012-May/026518.html

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Somewhat strange question: Rules without a RHS

2012-05-16 Thread Joe Ammann
On 05/16/2012 09:06 AM, Wolfgang Laun wrote:
> On 16/05/2012, Joe Ammann  wrote:
>> On 05/15/2012 07:24 PM, Wolfgang Laun wrote:
>>> Assuming you can get hold of the resulting DRL text, a simple script
>>> might detect rules where there is nothing between "then" and "end".
>> I have currently implemented something similar. A REST client that
>> periodically scans the BRLs in certain Guvnor packages and fills out
>> missing RHS. Problem is that the users try to test their broken rules
>> faster than this script can fix them :-/
> You can easily design your DSL/DSLR in such a way that the expanded text is
> jinxed, to be rectified by your scanning script. That way, they won't be
> able to exec without some Joe's blessing ;-)
:-) I like this!
>
>> I was looking for exactly that: an option to replace or inject custom
>> extensions to what you refer to as "Guvnor's validator". But I must
>> admit that I was not able to find any pointer to this in the doc or
>> the Guvnor source. Can you point me to the place in the Guvnor source
>> where that validation actually happens? I might then be able to
>> develop some ideas. 
> There's drools-verifier-5.4.0.Beta2-sources.jar in Expert's sources. Look at
>org/drools/verifier/Consequence.drl
>
> The first rule is called "No action - possibly commented out".
Had a look at this and I think this will be the way for me: Implement my
own set of verifier rules. It still don't quite understand how I would
"plug" these rules into Guvnor, but I guess I'll just have to do some
source reading :-)

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Somewhat strange question: Rules without a RHS

2012-05-15 Thread Joe Ammann
On 05/15/2012 07:24 PM, Wolfgang Laun wrote:
> Assuming you can get hold of the resulting DRL text, a simple script
> might detect rules where there is nothing between "then" and "end".
I have currently implemented something similar. A REST client that
periodically scans the BRLs in certain Guvnor packages and fills out
missing RHS. Problem is that the users try to test their broken rules
faster than this script can fix them :-/
>
> Otherwise, following the techniques used in the Guvnor's validator,
> you can investigate the consequence text and use heuristics to
> detect the bad ones.
I was looking for exactly that: an option to replace or inject custom
extensions to what you refer to as "Guvnor's validator". But I must
admit that I was not able to find any pointer to this in the doc or the
Guvnor source. Can you point me to the place in the Guvnor source where
that validation actually happens? I might then be able to develop some
ideas.

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Somewhat strange question: Rules without a RHS

2012-05-15 Thread Joe Ammann
Hi all

I have an ongoing discussion with my users: They have been using several
home-grown rule oriented applications for years. Almost all of these
"rule engines" were built for one very specific reason, and the users
have come accustomed to just specify a LHS of a rule. They never needed
to specify a RHS, because the action of the rule was pre-determined by
the application. So when the rule fired, it was clear what needed to be
done in the application.

Now want to merge all these "rule engines" onto Drools (5.4.0), and use
the Guvnor BRL editor and DSLs to actually formulate them. Of course now
Drools can not "know" what the RHS is supposed to be, since we have
"merged" several applications. The users now need to select one of
several predefined DSL statements as the RHS, but unfortunately they
consistenly keep forgetting to put an RHS at all. Guvnor validates this
successfully but of course the rules then fail to work.

I have been thinking if there is any way in Guvnor or via some kind of
Drools expert mechanism to say something like "if a rule is in packaga
a.b.c, it's RHS should always be 'foo' unless specified otherwise". To
be honest, I could not come up with a way to achieve this and think just
need to educate my users better. But before doing that, I thought I'd
use the wisdom of this group :-)

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] PermGen space error

2012-02-09 Thread Joe Ammann
On 02/09/2012 09:34 AM, Geoffrey De Smet wrote:
> The perm gen space is a subset of the heap space.
> So it doesn't make sense to put them on the same value.
>
> Try this instead:
> -Xmx1024m -XX:MaxPermSize=512m
> Or, if that fails:
> -Xmx2048m -XX:MaxPermSize=1024m
>
Sorry to disagree Geoffrey, but PermGen is NOT a part of heap in all
(Sun) JVM's that I'm aware of. See

http://stackoverflow.com/questions/2129044/java-heap-terminology-young-old-and-permanent-generations
http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html (the
picture a few pages down)

So the sizes are specified separately. But having a MaxPerm of 1G and
STILL see PermGen OOM is strange.

The problem could be, that when using the CMS (concurrent mark sweep)
GC, PermGen is not collected. I have seen cases where sooner or later
OOM PermGen errors happened consistently, until we added

|-XX:+CMSPermGenSweepingEnabled|

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] New Change-Set editor in Guvnor 5.4

2011-12-27 Thread Joe Ammann
On 12/27/2011 03:11 PM, Esteban Aliverti wrote:
> Guvnor 5.4 comes with a new change-set editor that allows users to
> define their custom change-sets instead of using the default layout: 1
> package -> 1 change-set. 
Me likes that! A lot!

Exactly what I needed to allow re-use of rules/packages.

Thanks, I'll give it a try later today.

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Data structures in Guvnor REST API

2011-12-02 Thread Joe Ammann
On 12/02/2011 06:02 AM, Jervis Liu wrote:
> On 2011/12/1 19:03, Joe Ammann wrote:
>> Hi
>>
>> On 12/01/2011 06:40 AM, Jervis Liu wrote:
>>> the Asset.type is a standard property from Dublin core
>>> (http://en.wikipedia.org/wiki/Dublin_Core), though this property is
>>> never used by Guvnor Asset or Package, its always empty. I will remove
>>> this property from the REST API.  Thanks for pointing this out.
>>>
>> I would not go too fast in removing it. If it is still available in
>> Guvnor, IMHO it should also be available in the API. I was just
>> wondering if there are any current uses for this.
>>
>> I might want to use this in my application :-)
>>
> I would not suggest you to use Asset.type to store custom information as 
> this field is a reserved property in Guvnor thus there is no guarantee 
> the information you stored will be preserved in the future.

I'm perfectly aware of that, and prepared to change it in the future.
Thing is that I need to store additional information. For packages, it's
quite easy, I just place a specific file in that package. For Assets, I
only see 2 choices currently: type or note. Pretty much everything else
that the REST API offers is used for different things.

Of course, the ideal solution for me would be if the API offered a
generic key/value list for "other metadata".

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor "inheritance"

2011-12-01 Thread Joe Ammann
Hi Michael

On 12/01/2011 05:48 PM, Michael Anstis wrote:
> Firstly, "no" you are not missing anything :)
Hm, I kind of had hoped 
> What you describe does not sound like inheritance: more of a fall
> through of assets from a top level package to lower sub-packages.
Yes, that's what I mean, and I could make up a good name, hence
"inheritance" in quotes. But this fall through is exactly what I want.
>
> The Global Area would provide what you might be looking for - a place
> where assets can be shared with other packages.
I know about the Global, but this is a bit too  global :-)
>
> We do provide for "true" rule inheritance already.
Yes, and the users absolutely love this! But just to be sure: rule
inheritance is only avaible in DRL rules, not in BRL rules, correct?

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Guvnor "inheritance"

2011-12-01 Thread Joe Ammann
Hi

my users asked me to provide something like "package inheritance" in
Guvnor. They would like to be able to define some artefact types (most
notably DLSs, Working Sets, function definitions and extensible rules)
in a "parent package", and then create "sub packages" where only the
pure rule definitions live, but can use the artefacts from the "parent
package".

Now I realise that Guvnor/Drools packages are not really hierarchical.
They may happen to have dots in their name and be displayed in a tree,
but that's all.

I can implement this by doing "inheritance by copying", since I provide
the access to the Guvnor tree with my own Eclipse RCP application and
only use the asset editors from Guvnor. But I was wondering if I'm
missing some fundamental concept in Guvnor that would make this easy?

I could also imagine this to be realized by extending the concept of
working sets from fact types and fields to also include DSL, functions
and rules. That would even be more flexible :-)

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Data structures in Guvnor REST API

2011-12-01 Thread Joe Ammann
Hi

On 12/01/2011 06:40 AM, Jervis Liu wrote:
> the Asset.type is a standard property from Dublin core 
> (http://en.wikipedia.org/wiki/Dublin_Core), though this property is 
> never used by Guvnor Asset or Package, its always empty. I will remove 
> this property from the REST API.  Thanks for pointing this out.
>
I would not go too fast in removing it. If it is still available in
Guvnor, IMHO it should also be available in the API. I was just
wondering if there are any current uses for this.

I might want to use this in my application :-)

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Data structures in Guvnor REST API

2011-11-30 Thread Joe Ammann
Hi all

I'm trying to integrate Guvnor into my application via the REST API.
Little question to the Asset data structures.

The doc
(http://docs.jboss.org/drools/release/5.3.0.Final/drools-guvnor-docs/html/ch09.html#d0e2282)
says, that every Asset has a "type", and via AssetMetadata also a
"format". When querying my Guvnor repository, I get values like "brl" or
"dsl" as expected from the Asset->AssetMetadata->format.

But what is Asset->type about? In all my tests it comes back always empty.

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] drools-JBPM integration

2011-07-14 Thread Joe Ammann
On 14.07.2011 19:43, Michael Anstis wrote:
> IIRC, WAS's classloaders work in a different order to other containers.
>
> I might be talking a load of baloneybut I have a feeling this is the case.
>
> I have another feeling you can configure this to be top-down or
> bottom-up or something along those lines. Might be worth a try.
>
> If this is all found to be complete rubbish I'll visit my doctor about
> these feelings I keep getting ;)
Definitely true, WAS classloaders can be ... interesting  at times :-)

Copying JARs into the WAS library folder often does more harm than it
helps. I'd try the following:
- remove all JARs you copied into WAS lib folder
- deploy the WARs again and make sure you select the "PARENT LAST"
classloader option during deployment
- if you're still getting class not founds, post the classname (and
specify the WAS version you're using) and I'll see if I can help

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Avoid evaluation of expensive LHS terms

2011-06-23 Thread Joe Ammann
On 23.06.2011 21:27, Michael Anstis wrote:
> Have you tried salience?
>
Yeah, sorry forgot to mention. THis was the first thing I tried.

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Avoid evaluation of expensive LHS terms

2011-06-23 Thread Joe Ammann
Stumbled over this today in a specific case, but my question is about a
general practice (I'm quite new to Drools, 5.2.0.M2 btw). I have a
knowledge session with a fair amount of facts (0.5 Mio) and mostly
simple rules. One rule has a LHS expression that I know will be
expensive to execute, in the example that I encountered this it looks like:

rule "Count facts"
when
all : Number() from accumulate (s : X(), count(s))
blacklisted : Number() from accumulate (s : X(status ==
X.BLACKLISTED), count(s))

then

end

I want to execute this rule only after other rules have already executed
(and changed the status of most of the X facts). There's quite a number
of X facts (~200'000). Most of them have their status modified during
execution of other rules. If I run the rule base without the above
rules, performance is perfect, some tens of seconds. If I activate the
rule, execution never finishes (I stop it after a few minutes, never saw
it finished).

I *THINK* (correct me if I'm wrong) what happens is that especially the
second expression of the LHS gets executes over and over again whenever
one of the facts is modified by one of the other rules. Makes sense, but
I nevertheless want to try to avoid it.

Until now I tried unsuccessfully:
- "protect" the rule with a guard fact as the first expression, which is
inserted only late in the processing
- move the rule to another ruleflow-group (or agenda-group) and activate
it only at the end of the processing
- use the rule in a second independent knowledge base and session, and
insert the facts once the first has finished

I'm perfectly aware that I could solve this specific problem of counting
facts with different techniques, but my question is more general (as the
subject says). Because I have other cases where (as a last resort) I
need to go to a database or online service to get the required
information. It seems that others have similar problems
(http://drools.46999.n3.nabble.com/Short-circuiting-evaluations-on-LHS-td56379.html).
But in my experience, that technique ("protecting" the expensive pattern
in the LHS with a cheap one that evaluates to false until you really
need the expensive one) does not work. I get the impression that
(contrary to popular experience that a "false" value in an AND sequence
terminates the whole sequence) the drools LHS are processed differently.

Am I missing something really stupid?!

-- 
CU, Joe

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users