Ming Fang | 10 Feb 06:04
Picon
Gravatar

problem binding variable to map value

Below is a very simple rule that binds a variable to a map value...

rule "how many times is map.get() called?"

   when
       p:Parameter(
           $value:tags[1]==1,
           $value == 1,
           $value != 2,
           $value != null,
           $value in ("1","2")
       )
   then
       System.out.println("value=" + $value);
end

The problem is map.get() is called 6 times when executing this rule using a Stateless session.
To test this I implement a mock Map that the get(key) simply returns the key. 
So in this example tags[1] return 1.
And in the get() I simply print a test message to see how many times it's been called.
Here is the sequence...

1x = tags[1]
2x = tags[1] == 1
3x = $value == 1
4x = $value != 2
5x = $value != null
and most surprisingly none for $value in ("1","2")
but
6x == System.out.println("value="+$value)
(Continue reading)

Jason Parekh | 10 Feb 05:24
Picon
Gravatar

Your suggestions for rules for pretty simple problem

I'm new to constraint programming and Drools Planner.  I've read through the
docs and built some rules that would probably get me to the right answer,
eventually :)

I was hoping to get your suggestions for better concrete rules.

The problem is I need to order items in a performance with the following
logical rules:
1) All items of the same category must appear together.
2) A performer can be in multiple items, but ideally there'd be at least
three items between any of her two items

The approaches I took are:
- For (1), count the number of transitions from one category to another.
Subtract this to the hard score.
- For (2), three separate rules, each of which assert that an item at
position i does not share performers with an item at position i+1, i+2 and
i+3 (one of these per rule).  The number of shared performers would be
subtracted from the hard score.

The scoring and my choice for construction heuristic (FIRST_FIT) are just
naive selections.  I haven't gotten to optimizing either of these -- just
wanted to check with you guys to make sure my rules are sane.

Thanks in advance,
jason
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Apache | 10 Feb 04:36
Picon
Favicon

Multiple threading

Hey,
I am trying to get multiple threads to insert events and run rules against the union of events inserted ( an as
soon as they are inserted, a timer drools thread kicking of fireallrules() is not an option because that
would introduce a delay ) and wanted some opinion on the following:

1. Stateless session is basically a wrapper around statefulsession and since per doc  statefulsession is
not threadsafe is it  safe to assume 2 threads cannot insert and run fireallrules to compare against a union
of objects inserted by multiple threads without some synchronication on event insertion and ESP
fireallrulesrules ? ( would the answer still hold despite a drools-camel endpoint reading and storing
exchanges from multiple threads ? )

2. If in the above point we simplify the case where the rule uses the "from" keyword and reads from a cache or a
Db ( is reading from
A cache supported out of the box ? ) then will drools bhaviour will be bound by the thread which invokes
fireallrules() ? 
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
olfa | 9 Feb 22:28
Picon
Gravatar

Drools Guvnor

Hi,

how to install Guvnor?

thank you

--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Guvnor-tp3730872p3730872.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Olfa h | 9 Feb 22:27
Picon
Gravatar

GUVNOR

HI ,

how to install DROOLS Guvnor ?
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Picon

Problem with package names and declare section

Hi guys,

            we are currently working with Drools Fusion in order to build a complex event processing solution. We've modelled our events using and object (Event) and this object is shared with everyone that needs to publish and event. 

            Our scenario goes this way

1) Our shared class, located in ar.com.fluxit.Event

2) An example of our cep rules declared in package rules.flux

    package rules.flux

    import ar.com.fluxit.Event;

    declare Event
<at> role (event)
<at> expires(1m)
    end

    rule "hello world"
when
   $event:Event( eventName == "Hello World") from entry-point "rules.flux"
then
    System.out.println("Hello world");
        end


3) When we try to insert a ar.com.fluxit.Event as a fact in entry point "rules.flux" Drools Fusion throws a NullPointerException. If you read Drools Expert documentation (http://docs.jboss.org/drools/release/5.2.0.Final/drools-expert-docs/html/ch05.html#d0e3661 - 

Accessing Declared Types from the Application Code) you find this paragraph:


When we change package declaration to package ar.com.fluxit everything works like a charm. But in our cep scenario we need that our ar.com.fluxit.Event object to be user by all rules declared in any package. 

So, there goes the question. There is a workaround for this? This is a bug? 

Any help would be very appreciated


Cheers


--
Joaquín Díaz Vélez

Flux IT SA
Calle 9 N° 865 - Paseo La Panadería - Planta Alta
La Plata - Buenos Aires - Argentina
Teléfono (+54) 221 553 2980 int 306
Móvil (+54) 9221 5863322
    www.fluxit.com.ar


_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Shur, Bob | 9 Feb 18:34
Picon
Favicon
Gravatar

Protection from malicious rules

We're considering a system in which partners could write and deploy their own rules, but we are worried
about security. Is there any support for preventing harmful rules? For example:

rule "bad"
when
then
  File f = new File("important.doc");
  f.delete();
end

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Nancy Henggeler | 9 Feb 17:19
Favicon
Gravatar

Low Date question in drools

I have a simple rule where I want to bypass elements that have a low date but
drools seems to be interpreting the date different then I am expecting. 
Drools statement and error follows:

ClientSupplement ( dateOfBirth : dateOfBirth != null && != 0001-01-01)

throws error -- Error: [Error: badly formatted number: For input string:
"001-01-01"] [Near : {... 0001-01-01 ....}] ^ [Line: 1, Column: 1]

How do I get drools to  understand this low date?  I have tried single,
double, and no quotes around the low date and all result in a similiar error
message.  Please Help!

--
View this message in context: http://drools.46999.n3.nabble.com/Low-Date-question-in-drools-tp3729940p3729940.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

mikeg | 9 Feb 16:41
Gravatar

How do I write a rule to detect a missing value in a group of facts?

I need to write a rule to identify a missing element in a group of facts.  

For example, let us say I want to ensure that my fence has a fence post
every 8 feet.  My fact declaration is as follows:

declare FencePost
  identifier : String
  distanceFromStart: Long
end

If I add the following facts into my session:

FencePost("a", 0)
FencePost("x", 8)
FencePost("e", 24)

I want a rule that will notify the user that there is a missing fence post
between "x" and "e".

I've been looking into using "collect" into a TreeSet/TreeMap to get a
collection sorted on the "distanceFromStart", but I cannot figure out how to
compare adjacent elements in the collection.

Any ideas?

--
View this message in context: http://drools.46999.n3.nabble.com/How-do-I-write-a-rule-to-detect-a-missing-value-in-a-group-of-facts-tp3729818p3729818.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

shanmuga | 9 Feb 15:17
Picon
Gravatar

Auto-focus in Decision Table

Hi All....,
     How to use *auto-focus* in decision table?
Is *LOCK-ON-ACTIVE* and *AUTO-FOCUS* both are same in Decision table?
Please explain briefly.....

--
View this message in context: http://drools.46999.n3.nabble.com/Auto-focus-in-Decision-Table-tp3729585p3729585.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Veera | 9 Feb 07:24
Picon
Gravatar

Drools Debugging

Hi All,

I have one doubt that is : When i compiling a sample HelloWorld Drools
program it is printing output like :
Hello World
Goodbye cruel world

and i added a simple rule like :  
 rule "test"
    when
        eval(true)
    then
        System.out.println( "Hello!!!" );
end 

When i compile the output is :
Hello!!!
Hello World
Goodbye cruel world

But when i debug it is showing output like:
Hello World
Goodbye cruel world
Hello!!!

Can anybody help me how to get the same output when i debug also...

Regards,
Veera

--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Debugging-tp3728574p3728574.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Gmane