Re: [rules-users] Nested negation constraints behavior change from Drools 5.x to 6.x

2014-02-27 Thread mikerod
No problem.  Thanks for the quick feedback on this.

-Mike



--
View this message in context: 
http://drools.46999.n3.nabble.com/Nested-negation-constraints-behavior-change-from-Drools-5-x-to-6-x-tp4028390p4028400.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Nested negation constraints behavior change from Drools 5.x to 6.x

2014-02-27 Thread Davide Sottara
We could reproduce the issue, it's now in a unit test:
https://github.com/droolsjbpm/drools/pull/317/files

Thanks for reporting this!!
Davide

On 02/28/2014 12:44 AM, mikerod wrote:
> I made a basic jar that only depends on Drools.
>
> All the rules do is output to standard out to demonstrate.
> This can just be ran with:
> `mvn exec:java -Dexec.mainClass="example.drools.TestingNestedNegation"`
>
> This is with v6.0.1.Final; so switching this in the pom.xml to 5.6.0.Final,
> for example, will cause the different behavior between the versions i.e.
> changing 6.0.1.Final in pom.xml .
>
> @Mark I looked at the link and he had a zip file.  I'm guessing a jar with a
> main class in it is sufficient? drools-example-tests-1.0-SNAPSHOT.jar
> 
>   
>
> Also, I am still using the now, legacy API for the kb and Stateful session. 
> I tried to add the logback.xml config file, but it doesn't seem to work
> quite so simply there.  That is likely due to me not reading up on the new
> API yet...  I'm hoping the initial uplift to v6.x can just be to the legacy
> API and migrate over later on.
>
> I don't think the API choice would make this behavioral change in the rules
> nonetheless.
>
> Let me know what else would be helpful.
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Nested-negation-constraints-behavior-change-from-Drools-5-x-to-6-x-tp4028390p4028398.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>

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


Re: [rules-users] Nested negation constraints behavior change from Drools 5.x to 6.x

2014-02-27 Thread mikerod
I made a basic jar that only depends on Drools.

All the rules do is output to standard out to demonstrate.
This can just be ran with:
`mvn exec:java -Dexec.mainClass="example.drools.TestingNestedNegation"`

This is with v6.0.1.Final; so switching this in the pom.xml to 5.6.0.Final,
for example, will cause the different behavior between the versions i.e.
changing 6.0.1.Final in pom.xml .

@Mark I looked at the link and he had a zip file.  I'm guessing a jar with a
main class in it is sufficient? drools-example-tests-1.0-SNAPSHOT.jar

  

Also, I am still using the now, legacy API for the kb and Stateful session. 
I tried to add the logback.xml config file, but it doesn't seem to work
quite so simply there.  That is likely due to me not reading up on the new
API yet...  I'm hoping the initial uplift to v6.x can just be to the legacy
API and migrate over later on.

I don't think the API choice would make this behavioral change in the rules
nonetheless.

Let me know what else would be helpful.




--
View this message in context: 
http://drools.46999.n3.nabble.com/Nested-negation-constraints-behavior-change-from-Drools-5-x-to-6-x-tp4028390p4028398.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools 6.0.1 with Spring - Custom Operator - Spring configuration for custom operators

2014-02-27 Thread Mark Proctor

On 27 Feb 2014, at 20:33, mattmadhavan  wrote:

> Hello,
> Anyone out there please?
Please don’t post for answers, just hours after asking your question.

I expect it has not been exposed in spring 6.0.1. Did you check the spring xsd?

If it can’t be done from spring, you can probably still do it via the old 
external package builder .conf. You’ll need to google for details on how to use 
that.

For accumulates we removed the need for configuration and made them work via 
imports, I think we’ll do the same there too, rather than fix spring xml - then 
it won’t need any configuration either.

Mark
> 
> Thanks
> Matt'M
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-6-0-1-with-Spring-Custom-Operator-Spring-configuration-for-custom-operators-tp4028377p4028393.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


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


Re: [rules-users] sliding window question

2014-02-27 Thread lin.lin
Hi 

   Thanks again for the pointers!!

   I modified the code but the sliding window rule does not seem to be
working as how I want it to be(copied shown in the following).  I injected 6
events, one event every 10 seconds, the first one is less than 90, the rest
are more than 90.  I am expecting getting 3 alerts at 4th event, 5th event
and 6 event. But instead I only get one alert.

  when 
not Reading( reading <= 90 ) over window:time( 30s ) from entry-point
ReadingStream
  then 
 System.out.print ("alert: Reading high for 30 seconds \n"); 

  
  So I used the other way as you suggested. It works and gives me 3 alerts.
However if I added the accumulate pattern (copied below) , no alert is
generated at all.  If I removed the first 3 patterns, just leave the last
pattern, it does print the average of last 30 seconds event every time when
a new event is injected. What else did I do wrong?

  when
  $r1: Reading( reading >90 ) from entry-point HeartrateStream
  $r2: Reading( reading > 90, this after[30s,30s] $r1 ) from
entry-point HeartrateStream
  not (Reading( reading <= 90, this after $r1, this before $r2 )
from entry-point HeartrateStream)
 $averg: Number() from accumulate( Reading ( $r:reading) over
windiw:time(30s) from entry-point HeartrateStream, average($r) )
  then
 System.out.print ("alert: Reading high for 30 seconds, average
reading"+$averg+"\n"); 


Thanks a lot!!!
Lin







--
View this message in context: 
http://drools.46999.n3.nabble.com/sliding-window-question-tp4028367p4028396.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools 6.0.1 with Spring - Custom Operator - Spring configuration for custom operators

2014-02-27 Thread mattmadhavan
Would you let me know once you figure out? :)



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-6-0-1-with-Spring-Custom-Operator-Spring-configuration-for-custom-operators-tp4028377p4028395.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools 6.0.1 with Spring - Custom Operator - Spring configuration for custom operators

2014-02-27 Thread Michael Anstis
I hear you... but I have no answers.

Sent on the move
On 27 Feb 2014 20:34, "mattmadhavan"  wrote:

> Hello,
> Anyone out there please?
>
> Thanks
> Matt'M
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-6-0-1-with-Spring-Custom-Operator-Spring-configuration-for-custom-operators-tp4028377p4028393.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Drools 6.0.1 with Spring - Custom Operator - Spring configuration for custom operators

2014-02-27 Thread mattmadhavan
Hello,
Anyone out there please?

Thanks
Matt'M



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-6-0-1-with-Spring-Custom-Operator-Spring-configuration-for-custom-operators-tp4028377p4028393.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Unable to find pom.properties

2014-02-27 Thread Mark Proctor
What OS? Is this maybe an OS issue?

Mark
On 25 Feb 2014, at 16:07, kmansoor  wrote:

> I'm experiencing a most unusual issue: file.isDirectory() is returning a
> false on 'maven' as in:
> 
> \work\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dcwebcv\META-INF\maven
> 
> KieBuilderImpl.recurseToPomProperties:
> 
> public static File recurseToPomProperties(File file) {
>if( file.isDirectory() ) {
>for ( java.io.File child : file.listFiles() ) {
>if ( child.isDirectory() ) {
>File returnedFile = recurseToPomProperties( child );
>if ( returnedFile != null ) {
>return returnedFile;
>}
>} else if ( child.getName().endsWith( "pom.properties" ) ) {
>return child;
>}
>}
>}
>return null;
>}
> 
> I stepped through the code and found file.isDirectory() returning false. I
> have verified the directory 'maven' has sub-directories following the
> $groupId/$artifactId convention. The $artifactId directory does contain
> pom.properties and pom.xml.
> 
> My environment:
> Eclipse Kepler SR1
> Drools: 6.0.1
> Relevant pom.xml
> 
> 
>   org.kie
>   kie-api
>   ${kie.version}
> 
> 
>   org.kie
>   kie-internal
>   ${kie.version}
> 
> 
>   org.drools
>   drools-core
>   ${drools.version}
> 
> 
>   org.drools
>   drools-compiler
>   ${drools.version}
> 
> 
>   org.kie
>   kie-spring
>   ${kie.version}
>   
>   
>   el-api
>   javax.el
>   
>   
> 
> 
> This same exact setup on a colleague's machine works fine, when stepping
> through the above code file.isDirectory() returned a true on 'maven' and
> pom.properties was found (recursively).
> 
> Any pointers will be highly appreciated.
> 
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Unable-to-find-pom-properties-tp4028307.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


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


Re: [rules-users] Nested negation constraints behavior change from Drools 5.x to 6.x

2014-02-27 Thread Mark Proctor
If you can work it into some sort of unit test, we’ll fix it ASAP. If you look 
at:
"Re: [rules-users] NullPointerException with LeftTupleIndexHashTable.remove()”

You’ll see there he created a large project, which we then on the dev mailing 
list showed how to convert into a single self contained unit test. If you could 
follow that, it would be appreciated and save us a lot of time.

Mark


On 27 Feb 2014, at 19:50, mikerod  wrote:

> With both Drools v5.5.0.Final and v5.6.0.Final I observe a different behavior
> than in both v6.0.0.Final and v6.0.1.Final.
> in certain rules with negation wrapped around nested constraints.
> 
> I have tried to make the simplest rules to demonstrate the situation.
> 
> With a kb consisting of the following rules, which I have comments on that
> describe what I've
> found with the situation:
> 
> ```
> // Enabling this rule, makes "negation_over_nested" and
> // "negation_distributed_partially_sharing" fire;
> // without it they do not.
> // 
> // I think this is due to some shared structure
> //  in the underlying subnetwork (I believe this is referred to as a
> "segment").
> // Perhaps it makes them "linked" in when otherwise they are being missed.
> 
> /**  *This is commented out, uncommenting causes different firing of other
> rules*
> rule shared_conjunct
> when
>   (not (String() and Integer()))
> then
>   System.out.println("shared_conjunct");
> end
> */
> 
> // Won't fire with no wm facts UNLESS 
> // it shares (I think) a node/subnetwork/segment with constraints 
> // in a rule like "rule shared_conjunct" that DOES fire
> rule negation_over_nested
> when
>  not ( (String() and Integer())
>   or 
>   (String() and Integer()))
> then 
>   System.out.println("negation_over_nested");
> end
> 
> // Won't fire with no wm facts
> rule negation_distributed_partially_no_sharing
> when
>   (not (String() and Long()))
>   and 
>   (not (String() and Long())) 
> then 
>   System.out.println("negation_distributed_partially_no_sharing");
> end
> 
> // Same situation as "negation_over_nested"
> rule negation_distributed_partially_sharing
> when
>   (not (String() and Integer()))
>   and 
>   (not (String() and Integer()))  
> then 
>   System.out.println("negation_distributed_partially_sharing");
> end
> 
> // DOES fire with no wm inserts.
> // DOES NOT need "shared_conjunct" to work
> rule negation_distributed_fully
> when
>   ((not String()) or (not Integer()))
>   and
>   ((not String()) or (not Integer()))
> then 
>   System.out.println("negation_distributed_fully");
> end
> 
> ```
> 
> --- 
> 
> This is the only 2 rules in the kb.  Running a session, with no facts
> inserted and then firing all rules.
> 
> ---
> Drools v5.x output 
> 
> with "shared_conjuct" rule uncommented:
> ```
> negation_distributed_fully
> negation_distributed_fully
> negation_distributed_fully
> negation_distributed_fully
> negation_distributed_partially_no_sharing
> negation_distributed_partially_sharing
> negation_over_nested
> shared_conjunct
> fired: 8
> time elapsed: 0.0
> done
> ```
> 
> with "shared_conjuct" rule commented out:
> ```
> negation_distributed_fully
> negation_distributed_fully
> negation_distributed_fully
> negation_distributed_fully
> negation_distributed_partially_no_sharing
> negation_distributed_partially_sharing
> negation_over_nested
> fired: 7
> time elapsed: 0.0010
> done
> ```
> 
> ---
> Drools v6.x output:
> with "shared_conjuct" rule uncommented:
> ```
> shared_conjunct
> negation_over_nested
> negation_distributed_partially_sharing
> negation_distributed_fully
> negation_distributed_fully
> negation_distributed_fully
> negation_distributed_fully
> fired: 7
> time elapsed: 0.0
> done
> ```
> 
> with "shared_conjuct" rule commented out:
> ```
> negation_distributed_fully
> negation_distributed_fully
> negation_distributed_fully
> negation_distributed_fully
> fired: 4
> time elapsed: 0.0
> done
> ```
> 
> I do note in the v6.x output, "negation_distributed_partially_no_sharing"
> never fires, since it is specifically not sharing any
> negated conjunt with the other rules.  This seems to correlate with whether
> or not these rules fire.
> Also, I realize my terminology is slightly off.  I think this is an issue
> with rules having shared "segments", where 
> one of these segments that is shared is the negation subnetwork introduced
> in "shared_conjunct".
> 
> I also note that "negation_distributed_fully" always fires, independent of
> any potential "segment" sharing.
> 
> As I mentioned in a comment on "shared_conjuct", I'm thinking this relates
> to the newer PHREAK algorithm vs the original ReteOO.
> 
> Is this expected?  Is there something incorrect about the structure of the
> negation rules?
> Perhaps I have stumbled upon a defect?
> 
> I have not had time to do any sort of deeper debugging into the issue, if I
> find out more info, I'll post it up here.
> 
> p.s. I know the type

[rules-users] Nested negation constraints behavior change from Drools 5.x to 6.x

2014-02-27 Thread mikerod
With both Drools v5.5.0.Final and v5.6.0.Final I observe a different behavior
than in both v6.0.0.Final and v6.0.1.Final.
in certain rules with negation wrapped around nested constraints.

I have tried to make the simplest rules to demonstrate the situation.

With a kb consisting of the following rules, which I have comments on that
describe what I've
found with the situation:

```
// Enabling this rule, makes "negation_over_nested" and
// "negation_distributed_partially_sharing" fire;
// without it they do not.
// 
// I think this is due to some shared structure
//  in the underlying subnetwork (I believe this is referred to as a
"segment").
// Perhaps it makes them "linked" in when otherwise they are being missed.

/**  *This is commented out, uncommenting causes different firing of other
rules*
rule shared_conjunct
when
(not (String() and Integer()))
then
System.out.println("shared_conjunct");
end
*/

// Won't fire with no wm facts UNLESS 
// it shares (I think) a node/subnetwork/segment with constraints 
// in a rule like "rule shared_conjunct" that DOES fire
rule negation_over_nested
when
  not ( (String() and Integer())
or 
(String() and Integer()))
then 
System.out.println("negation_over_nested");
end

// Won't fire with no wm facts
rule negation_distributed_partially_no_sharing
when
(not (String() and Long()))
and 
(not (String() and Long())) 
then 
System.out.println("negation_distributed_partially_no_sharing");
end

// Same situation as "negation_over_nested"
rule negation_distributed_partially_sharing
when
(not (String() and Integer()))
and 
(not (String() and Integer()))  
then 
System.out.println("negation_distributed_partially_sharing");
end

// DOES fire with no wm inserts.
// DOES NOT need "shared_conjunct" to work
rule negation_distributed_fully
when
((not String()) or (not Integer()))
and
((not String()) or (not Integer()))
then 
System.out.println("negation_distributed_fully");
end

```

--- 

This is the only 2 rules in the kb.  Running a session, with no facts
inserted and then firing all rules.

---
Drools v5.x output 

with "shared_conjuct" rule uncommented:
```
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_partially_no_sharing
negation_distributed_partially_sharing
negation_over_nested
shared_conjunct
fired: 8
time elapsed: 0.0
done
```

with "shared_conjuct" rule commented out:
```
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_partially_no_sharing
negation_distributed_partially_sharing
negation_over_nested
fired: 7
time elapsed: 0.0010
done
```

---
Drools v6.x output:
with "shared_conjuct" rule uncommented:
```
shared_conjunct
negation_over_nested
negation_distributed_partially_sharing
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
fired: 7
time elapsed: 0.0
done
```

with "shared_conjuct" rule commented out:
```
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
fired: 4
time elapsed: 0.0
done
```

I do note in the v6.x output, "negation_distributed_partially_no_sharing"
never fires, since it is specifically not sharing any
negated conjunt with the other rules.  This seems to correlate with whether
or not these rules fire.
Also, I realize my terminology is slightly off.  I think this is an issue
with rules having shared "segments", where 
one of these segments that is shared is the negation subnetwork introduced
in "shared_conjunct".

I also note that "negation_distributed_fully" always fires, independent of
any potential "segment" sharing.

As I mentioned in a comment on "shared_conjuct", I'm thinking this relates
to the newer PHREAK algorithm vs the original ReteOO.

Is this expected?  Is there something incorrect about the structure of the
negation rules?
Perhaps I have stumbled upon a defect?

I have not had time to do any sort of deeper debugging into the issue, if I
find out more info, I'll post it up here.

p.s. I know the types are not meaningful, this is just an example to show
the difference.  I hope it accomplishes this goal.




--
View this message in context: 
http://drools.46999.n3.nabble.com/Nested-negation-constraints-behavior-change-from-Drools-5-x-to-6-x-tp4028390.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] VCRP - Distance calculation in getMilliDistance

2014-02-27 Thread Wolfgang Laun
On 27/02/2014, Marcus Uerlings  wrote:
>
> I´ve learned from a person that works with georeference that a good
> aproximation in calculating distances from latitude and longitude is to
> multiply the Euclidean result by "111.1".
> This "magic number" will give the approximate distance in kilometers and
> then the final soft score will show the minimum distance in "km" and not in
> "fuel" (although they are related).

This is based on 360° being equal to the length of the equator, and
for longitudes and latitudes down there it works well enough. But it's
already grossly inaccurate for east-to-west distances not farther
north (or south) than N +/-45°.

-W

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


Re: [rules-users] @key declarations for a type - What's under the hood?

2014-02-27 Thread Wolfgang Laun
Forgot the rule that creates the output :-)

rule isConnected
when
$r1: Room()
$r2: Room( this != $r1 )
$d: Door( fromRoom == $r1, toRoom == $r2 )
then
System.out.println( $d + " connects " + $r1 + " and " + $r1 );
end

-W

On 27/02/2014, Wolfgang Laun  wrote:
> Works as you'd exprect it - and here we go:
>
> declare Thing
>size : int
> end
>
> // A room is also a thing
> declare Room extends Thing
> name : String @key
> end
>
> // A door is a pathway between two rooms
> declare Door extends Thing
>fromRoom : Room @key
>toRoom   : Room @key
> end
>
> rule "startup"
> when
> then
>Room kit = new Room("kitchen");
>kit.setSize( 10 );
>insert( kit );
>Room off = new Room("office");
>kit.setSize( 15 );
>insert( off );
>Door kitoff = new Door( kit, off );
>insert( kitoff );
> end
>
> Output:
>
> Door( size=0, fromRoom=Room( size=15, name=kitchen ), toRoom=Room(
> size=0, name=office ) ) connects Room( size=15, name=kitchen ) and
> Room( size=15, name=kitchen )
>
> -W
>
>
>
> On 27/02/2014, Matthew Versaggi  wrote:
>> But what if you now have 2 declare statements in which one defines itself
>> in terms of the other ...
>>
>> // A room is also a thing
>> declare Room extends Thing
>> name : String @key
>> end
>>
>> One would instantiate an object like this:
>> Room room = new Room("office");
>>
>>
>> // A door is a pathway between two rooms
>> declare Door extends Thing
>>fromRoom : Room @key
>>toRoom   : Room @key
>> end
>>
>> How would one instantiate an object of 'Door' ?
>>
>>
>>
>> On Wed, Feb 26, 2014 at 5:11 PM, Edson Tirelli 
>> wrote:
>>
>>>
>>>Drools bytecode generates these beans without generating java source
>>> code (if you are using the declare, not the data modeller). Having said
>>> that, it is very simple:
>>>
>>> declare Here
>>> location: String @key
>>> end
>>>
>>>Generates a java class roughly equivalent to:
>>>
>>> public class Here implements Serializable {
>>>private String location;
>>>
>>>public Here() {}
>>>
>>>public Here( String location ) {
>>>   this.location = location;
>>>}
>>>
>>>public String getLocation() { return location; }
>>>public void setLocation(String location) { this.location = location;
>>> }
>>>
>>>// generates a toString()
>>>
>>>// generates a hashCode()/equals() method that use the location's
>>> hashcode()/equals()
>>> }
>>>
>>>I did this from memory, but it is pretty much all it does. Nothing
>>> complex there, just a javabean really.
>>>
>>>The difference to not using @key is that the hashCode()/equals()
>>> methods would not take "location" in consideration, and in this case,
>>> since
>>> there are no other attributes, would then rely on system identity.
>>>
>>>Edson
>>>
>>>
>>>
>>>
>>>
>>> On Wed, Feb 26, 2014 at 2:23 PM, profversaggi
>>> wrote:
>>>
 I was looking for something along the lines of a method of inspecting
 the
 resulting code of any arbitrary @key declarations I might want to
 deploy.
 Is
 there such a way?



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/key-declarations-for-a-type-What-s-under-the-hood-tp4028343p4028346.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

>>>
>>>
>>>
>>> --
>>>   Edson Tirelli
>>>   Principal Software Engineer
>>>   Red Hat Business Systems and Intelligence Group
>>>
>>>
>>> ___
>>> rules-users mailing list
>>> rules-users@lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>
>>
>>
>> --
>> #
>> Matthew R. Versaggi, President & CEO
>> Versaggi Information Systems, Inc.
>> Adjunct Professor of eBusiness DePaul University
>> Email: mailto:m...@versaggi.com, profversa...@gmail.com
>> M: 630-292-8422
>> LinkedIn:  http://www.linkedin.com/in/versaggi
>> #
>>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] @key declarations for a type - What's under the hood?

2014-02-27 Thread Wolfgang Laun
Works as you'd exprect it - and here we go:

declare Thing
   size : int
end

// A room is also a thing
declare Room extends Thing
name : String @key
end

// A door is a pathway between two rooms
declare Door extends Thing
   fromRoom : Room @key
   toRoom   : Room @key
end

rule "startup"
when
then
   Room kit = new Room("kitchen");
   kit.setSize( 10 );
   insert( kit );
   Room off = new Room("office");
   kit.setSize( 15 );
   insert( off );
   Door kitoff = new Door( kit, off );
   insert( kitoff );
end

Output:

Door( size=0, fromRoom=Room( size=15, name=kitchen ), toRoom=Room(
size=0, name=office ) ) connects Room( size=15, name=kitchen ) and
Room( size=15, name=kitchen )

-W



On 27/02/2014, Matthew Versaggi  wrote:
> But what if you now have 2 declare statements in which one defines itself
> in terms of the other ...
>
> // A room is also a thing
> declare Room extends Thing
> name : String @key
> end
>
> One would instantiate an object like this:
> Room room = new Room("office");
>
>
> // A door is a pathway between two rooms
> declare Door extends Thing
>fromRoom : Room @key
>toRoom   : Room @key
> end
>
> How would one instantiate an object of 'Door' ?
>
>
>
> On Wed, Feb 26, 2014 at 5:11 PM, Edson Tirelli 
> wrote:
>
>>
>>Drools bytecode generates these beans without generating java source
>> code (if you are using the declare, not the data modeller). Having said
>> that, it is very simple:
>>
>> declare Here
>> location: String @key
>> end
>>
>>Generates a java class roughly equivalent to:
>>
>> public class Here implements Serializable {
>>private String location;
>>
>>public Here() {}
>>
>>public Here( String location ) {
>>   this.location = location;
>>}
>>
>>public String getLocation() { return location; }
>>public void setLocation(String location) { this.location = location; }
>>
>>// generates a toString()
>>
>>// generates a hashCode()/equals() method that use the location's
>> hashcode()/equals()
>> }
>>
>>I did this from memory, but it is pretty much all it does. Nothing
>> complex there, just a javabean really.
>>
>>The difference to not using @key is that the hashCode()/equals()
>> methods would not take "location" in consideration, and in this case,
>> since
>> there are no other attributes, would then rely on system identity.
>>
>>Edson
>>
>>
>>
>>
>>
>> On Wed, Feb 26, 2014 at 2:23 PM, profversaggi
>> wrote:
>>
>>> I was looking for something along the lines of a method of inspecting
>>> the
>>> resulting code of any arbitrary @key declarations I might want to
>>> deploy.
>>> Is
>>> there such a way?
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://drools.46999.n3.nabble.com/key-declarations-for-a-type-What-s-under-the-hood-tp4028343p4028346.html
>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>>> ___
>>> rules-users mailing list
>>> rules-users@lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>
>>
>>
>> --
>>   Edson Tirelli
>>   Principal Software Engineer
>>   Red Hat Business Systems and Intelligence Group
>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
> #
> Matthew R. Versaggi, President & CEO
> Versaggi Information Systems, Inc.
> Adjunct Professor of eBusiness DePaul University
> Email: mailto:m...@versaggi.com, profversa...@gmail.com
> M: 630-292-8422
> LinkedIn:  http://www.linkedin.com/in/versaggi
> #
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] @key declarations for a type - What's under the hood?

2014-02-27 Thread Edson Tirelli
There are no fancy hidden things in this bean generator, so your Door
would have an empty constructor and a constructor with two Room parameters:

Door door = new Door( fromRoom, toRoom );

   Edson


On Thu, Feb 27, 2014 at 11:24 AM, Matthew Versaggi
wrote:

> But what if you now have 2 declare statements in which one defines itself
> in terms of the other ...
>
> // A room is also a thing
> declare Room extends Thing
> name : String @key
> end
>
> One would instantiate an object like this:
> Room room = new Room("office");
>
>
> // A door is a pathway between two rooms
> declare Door extends Thing
>fromRoom : Room @key
>toRoom   : Room @key
> end
>
> How would one instantiate an object of 'Door' ?
>
>
>
> On Wed, Feb 26, 2014 at 5:11 PM, Edson Tirelli wrote:
>
>>
>>Drools bytecode generates these beans without generating java source
>> code (if you are using the declare, not the data modeller). Having said
>> that, it is very simple:
>>
>> declare Here
>> location: String @key
>> end
>>
>>Generates a java class roughly equivalent to:
>>
>> public class Here implements Serializable {
>>private String location;
>>
>>public Here() {}
>>
>>public Here( String location ) {
>>   this.location = location;
>>}
>>
>>public String getLocation() { return location; }
>>public void setLocation(String location) { this.location = location; }
>>
>>// generates a toString()
>>
>>// generates a hashCode()/equals() method that use the location's
>> hashcode()/equals()
>> }
>>
>>I did this from memory, but it is pretty much all it does. Nothing
>> complex there, just a javabean really.
>>
>>The difference to not using @key is that the hashCode()/equals()
>> methods would not take "location" in consideration, and in this case, since
>> there are no other attributes, would then rely on system identity.
>>
>>Edson
>>
>>
>>
>>
>>
>> On Wed, Feb 26, 2014 at 2:23 PM, profversaggi wrote:
>>
>>> I was looking for something along the lines of a method of inspecting the
>>> resulting code of any arbitrary @key declarations I might want to
>>> deploy. Is
>>> there such a way?
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://drools.46999.n3.nabble.com/key-declarations-for-a-type-What-s-under-the-hood-tp4028343p4028346.html
>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>>> ___
>>> rules-users mailing list
>>> rules-users@lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>
>>
>>
>> --
>>   Edson Tirelli
>>   Principal Software Engineer
>>   Red Hat Business Systems and Intelligence Group
>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
> #
> Matthew R. Versaggi, President & CEO
> Versaggi Information Systems, Inc.
> Adjunct Professor of eBusiness DePaul University
> Email: mailto:m...@versaggi.com, profversa...@gmail.com
> M: 630-292-8422
> LinkedIn:  http://www.linkedin.com/in/versaggi
> #
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Principal Software Engineer
  Red Hat Business Systems and Intelligence Group
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] VCRP - Distance calculation in getMilliDistance

2014-02-27 Thread Geoffrey De Smet


On 27-02-14 16:55, Marcus Uerlings wrote:

Hi

I´ve download Optaplanner a couple of months ago and found it 
fantastic!! Congrats to Geoffrey!


I´m not a programmer, but a logistic consultant to a non-governmental 
organization (NGO) of recycling products and like to give my "cent of 
contribuition" if it applies.

Intresting use case :)
I love that fact that NGO's are taking advantage of this software too.

Do note that the examples/docs are aimed at Java programmers (because 
any real-world application requires customization to the actual 
organization that wants to use it), OptaPlanner doesn't try to be a 
generic out-of-the-box VRP solution (but something like that can be 
build downstream upon OptaPlanner).


1. Distance Calculation:

I´ve learned from a person that works with georeference that a good 
aproximation in calculating distances from latitude and longitude is 
to multiply the Euclidean result by "111.1".
This "magic number" will give the approximate distance in kilometers 
and then the final soft score will show the minimum distance in "km" 
and not in "fuel" (although they are related).


=
  public int getMilliDistance(Location location) {
( ... )
  (latitudeDifference * latitudeDifference) + 
(longitudeDifference * longitudeDifference));

  return (int) (distance * 1000.0 * 111.1);
  }
=

2. Heteregenous vehicles

Many times a fleet is made of different vehicles, different sizes, 
capacity and one of the most important,  different mileages (in 
Km/litre or litres/100 km).
How can I put it in vehicle parameters, together with capacity and 
took into account in score calculation?

Doing so, the score would be calculated as minimum(Distance*mileage).

That requires Java programming, but it's not that much work:
- add the fields on the class Vehicle
- add the fields in the xml input
- use the fields in the score DRL


3. Real example
I fed real data into Optaplanner VCRP and plot the results in Googlemaps.
Due to one way streets, the result does not look efficient to the 
drivers of the NGO.
Is there a way to use an internet routing service, like Googlemaps in 
Optaplanner?

If it is possible, can someone help me coding this? :)
Peter Karich was recently planning to combine OptaPlanner with 
Graphhopper (both open source) to accomplish exactly that.
I am not sure if he follows this list, but might be interesting to open 
a conversation with him.


Regards from Brazil
Thank you in advance
Marcus Uerlings
__
*Marcus Uerlings
+11 9 4178-0544*


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


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

Re: [rules-users] @key declarations for a type - What's under the hood?

2014-02-27 Thread Matthew Versaggi
But what if you now have 2 declare statements in which one defines itself
in terms of the other ...

// A room is also a thing
declare Room extends Thing
name : String @key
end

One would instantiate an object like this:
Room room = new Room("office");


// A door is a pathway between two rooms
declare Door extends Thing
   fromRoom : Room @key
   toRoom   : Room @key
end

How would one instantiate an object of 'Door' ?



On Wed, Feb 26, 2014 at 5:11 PM, Edson Tirelli  wrote:

>
>Drools bytecode generates these beans without generating java source
> code (if you are using the declare, not the data modeller). Having said
> that, it is very simple:
>
> declare Here
> location: String @key
> end
>
>Generates a java class roughly equivalent to:
>
> public class Here implements Serializable {
>private String location;
>
>public Here() {}
>
>public Here( String location ) {
>   this.location = location;
>}
>
>public String getLocation() { return location; }
>public void setLocation(String location) { this.location = location; }
>
>// generates a toString()
>
>// generates a hashCode()/equals() method that use the location's
> hashcode()/equals()
> }
>
>I did this from memory, but it is pretty much all it does. Nothing
> complex there, just a javabean really.
>
>The difference to not using @key is that the hashCode()/equals()
> methods would not take "location" in consideration, and in this case, since
> there are no other attributes, would then rely on system identity.
>
>Edson
>
>
>
>
>
> On Wed, Feb 26, 2014 at 2:23 PM, profversaggi wrote:
>
>> I was looking for something along the lines of a method of inspecting the
>> resulting code of any arbitrary @key declarations I might want to deploy.
>> Is
>> there such a way?
>>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/key-declarations-for-a-type-What-s-under-the-hood-tp4028343p4028346.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
>   Edson Tirelli
>   Principal Software Engineer
>   Red Hat Business Systems and Intelligence Group
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
#
Matthew R. Versaggi, President & CEO
Versaggi Information Systems, Inc.
Adjunct Professor of eBusiness DePaul University
Email: mailto:m...@versaggi.com, profversa...@gmail.com
M: 630-292-8422
LinkedIn:  http://www.linkedin.com/in/versaggi
#
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

[rules-users] Kie-sprind.xsd - Are the configuration options limited compare to drools-spring.xsd?

2014-02-27 Thread mattmadhavan
Hello,
I am having hard time moving from 5.4 to 6.x due to the Spring
configuration, viz configuraion options fro Custom operators Evaluators,
Custom accumulators etc.

Can some one please let me know?

This is what see for the configuration option for kie-spring.xsd (Drools
6.1)  



/Look how limited this is to when compared to droos-spring-xsd (Drools
5.x)/. Am I missing some thing? Are many of the old configuration options
condensed to  the *work-item-handler* ?

 

Any ideas please?

I appreciate in advance!

Thanks
Matt'M




--
View this message in context: 
http://drools.46999.n3.nabble.com/Kie-sprind-xsd-Are-the-configuration-options-limited-compare-to-drools-spring-xsd-tp4028383.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] VCRP - Distance calculation in getMilliDistance

2014-02-27 Thread Marcus Uerlings
Hi

I´ve download Optaplanner a couple of months ago and found it fantastic!!
Congrats to Geoffrey!

I´m not a programmer, but a logistic consultant to a non-governmental
organization (NGO) of recycling products and like to give my "cent of
contribuition" if it applies.

1. Distance Calculation:

I´ve learned from a person that works with georeference that a good
aproximation in calculating distances from latitude and longitude is to
multiply the Euclidean result by "111.1".
This "magic number" will give the approximate distance in kilometers and
then the final soft score will show the minimum distance in "km" and not in
"fuel" (although they are related).

=
public int getMilliDistance(Location location) {
( ... )
(latitudeDifference * latitudeDifference) +
(longitudeDifference * longitudeDifference));
return (int) (distance * 1000.0 * 111.1);
}
=

2. Heteregenous vehicles

Many times a fleet is made of different vehicles, different sizes, capacity
and one of the most important,  different mileages (in Km/litre or
litres/100 km).
How can I put it in vehicle parameters, together with capacity and took
into account in score calculation?
Doing so, the score would be calculated as minimum(Distance*mileage).

3. Real example
I fed real data into Optaplanner VCRP and plot the results in Googlemaps.
Due to one way streets, the result does not look efficient to the drivers
of the NGO.
Is there a way to use an internet routing service, like Googlemaps in
Optaplanner?
If it is possible, can someone help me coding this? :)

Regards from Brazil
Thank you in advance
Marcus Uerlings
__

*Marcus Uerlings+11 9 4178-0544*
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Drools 6.x and Maven

2014-02-27 Thread Matthew Versaggi
Matt,

Just checking in  Did this work for you?

-matt


On Wed, Feb 26, 2014 at 6:59 PM, mattmadhavan  wrote:

> HI Matt,
> Your first POM deps resolved but I had bunch of compilation errors. Can you
> please update your examples? I would like to down load them.
>
> Thanks
> Matt
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-6-x-and-Maven-tp4028312p4028364.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
#
Matthew R. Versaggi, President & CEO
Versaggi Information Systems, Inc.
Adjunct Professor of eBusiness DePaul University
Email: mailto:m...@versaggi.com, profversa...@gmail.com
M: 630-292-8422
LinkedIn:  http://www.linkedin.com/in/versaggi
#
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] sliding window question

2014-02-27 Thread Wolfgang Laun
For an average, the accumulate CE would be best:

accumulate( Reading( $reading: reading ) over window:time( 30s );
$avg: average( $reading ) )

You could add this as the last pattern to the rule where you raise the alarm.

None of this was compiled or tested by me.

-W


On 27/02/2014, Lin Lin  wrote:
> Hi Wolfgang,
>
>   Thanks so much!   I will try the sliding window over the time.  I also
> need to give the average reading over the last 30 seconds in the alert
> message. How would I do that?
>
> Thanks
> Lin
>
>> On Feb 27, 2014, at 1:01 AM, Wolfgang Laun 
>> wrote:
>>
>> The correct way to ascertain that something hasn't happened for
>> a certain interval must be based on "staking out" this interval. One
>> way is by means of two distinct events:
>>
>>   when
>> $r1: Reading( reading >90 )
>> $r2: Reading( reading > 90, this after[30s] $r1 )
>> not Reading( reading <= 90, this after $r1 && before $r2 )
>>   then
>>
>> Clearly, this will only work if  Readings arrive regularly, and you may
>> have a
>> certain amount of delay at the end.
>>
>> Another way would be to use a sliding window over time:
>>
>>   when
>> not Reading( reading <= 90 ) over window:time( 30s )
>>   then
>>
>> Here's a snag, too: If there are no readings at all, you'll also get an
>> alert.
>>
>> And then you'll have to think about the seconds following the 30th
>> second: should another alert be emitted repeatedly...
>>
>> Most of the time, it's not an issue in CEP ;-)
>>
>> -W
>>
>>
>>
>>
>>
>>
>>> On 27/02/2014, lin.lin  wrote:
>>> Hi,
>>>
>>> I tried to create a rule that gives an alert when a machine reading is
>>> high
>>> for 30 seconds. I modeled the machine reading input as events.  The
>>> following is the rule:
>>>
>>> rule "rule1"
>>> dialect "mvel"
>>>when
>>>   $rd1 : mReading( reading >90 ) from entry-point ReadingStream
>>>   not ($rd2 : mReading (reading<=90 , this before [0s, 30s] $rd1 )
>>> from entry-point ReadingStream )
>>>then
>>>  System.out.print ("alert: Reading high for 30 seconds \n");
>>> end
>>>
>>> This does not detect detect the bad reading.  However, If I changed the
>>> rule
>>> to be following (change second condition from "not" to "exists"), it
>>> detects
>>> all readings that are good.
>>>
>>> rule "rule1"
>>> dialect "mvel"
>>>when
>>>   $rd1 : mReading( reading >90 ) from entry-point ReadingStream
>>>   exists ($rd2 : mReading (reading<=90 , this before [0s, 30s] $rd1 )
>>> from entry-point ReadingStream )
>>>then
>>>  System.out.print ("alert: Reading high for 30 seconds \n");
>>> End
>>>
>>>
>>> Is this an issue in CEP or did I do something wrong?
>>>
>>> Thanks a lot!
>>> Lily
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://drools.46999.n3.nabble.com/sliding-window-question-tp4028367.html
>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>>> ___
>>> rules-users mailing list
>>> rules-users@lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

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

Re: [rules-users] Rule Flow Creation

2014-02-27 Thread mattmadhavan
Steve,
Also I recommend you ask your question in its own  separate thread. I am
afraid other users may not watch this thread because 
1. Its old
2. Not relevant to the question you have

Thanks
Matt'M



--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-6-x-and-Maven-tp4028312p4028379.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rule Flow Creation

2014-02-27 Thread mattmadhavan
Hi Ray,
Like I am afraid, this is left over document from the old days. You have to
look into jbpm, its actually aneat. But I am afraid Eclipse IDE is not gonna
cut.


If you are looking for simple rule-flow you can achieve it with Salience.
What are your requirements.

Thakis
Matt'M




--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-6-x-and-Maven-tp4028312p4028378.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools 6.0.1 with Spring - Custom Operator - Spring configuration for custom operators

2014-02-27 Thread mattmadhavan
Hello,
I have defined a Drools custom operator which works great in Drools 5.4.0
and I am able to configure it to configure itvia spring Spring as follows.

"inListED"
class="org.facs.ncdb.drools.utils.InListEvaluatorDefinition" */>




<*drools:configuration> 

   

 *



  
I am trying to do the same in Drools 6.x! How do I accomplish this? I cannot
find any documentation.


 
 
 

 
   



*   
   

*   
/>



I need to replace the * *tag  for drools 6.x? 

Any ideas how to configure Drools Custom operator using Spring?

I appreciate in advance!

Thanks
Matt'M





--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-6-0-1-with-Spring-Custom-Operator-Spring-configuration-for-custom-operators-tp4028377.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rule Flow Creation

2014-02-27 Thread mattmadhavan
HI Ray,
Bear with me, I am kind of new to Drools my self. from What I understand .rf
is old. You have to use the new jBPM to which the Ruleflow id part of. The
rule flow file extension is .bpmn.

Also I am afraid the Eclipse plugin does not do a good job of creating the
good rule flow due to its own limitations. You will have to use a different
IDE for that, like Guvnor or the new 6.x Drools workbench, both of which I
have not used.

Are you sure you are looking at the correct version of the manual? You might
be reading an outdated document. Please read more on jbpm.

Thanks
Matt'M




--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-6-x-and-Maven-tp4028312p4028375.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Rule Flow Creation

2014-02-27 Thread Ray Hooker
I am trying to create a rule flow.  I have installed the JBoss Drools 6.0 Core  
IDE component installed.  When I try to create a rule flow, it gives the option 
of a “Flow File” but what is created is a .bpmn file, not a .rf file.  Also the 
options are totally different from the screen shots in the Drools reference 
manual.  Any tips are appreciated.

Ray

P.S. - I am also wondering whether Intellij has better support.





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

Re: [rules-users] sliding window question

2014-02-27 Thread Lin Lin
Hi Wolfgang,

  Thanks so much!   I will try the sliding window over the time.  I also need 
to give the average reading over the last 30 seconds in the alert message. How 
would I do that?

Thanks
Lin

> On Feb 27, 2014, at 1:01 AM, Wolfgang Laun  wrote:
> 
> The correct way to ascertain that something hasn't happened for
> a certain interval must be based on "staking out" this interval. One
> way is by means of two distinct events:
> 
>   when
> $r1: Reading( reading >90 )
> $r2: Reading( reading > 90, this after[30s] $r1 )
> not Reading( reading <= 90, this after $r1 && before $r2 )
>   then
> 
> Clearly, this will only work if  Readings arrive regularly, and you may have a
> certain amount of delay at the end.
> 
> Another way would be to use a sliding window over time:
> 
>   when
> not Reading( reading <= 90 ) over window:time( 30s )
>   then
> 
> Here's a snag, too: If there are no readings at all, you'll also get an alert.
> 
> And then you'll have to think about the seconds following the 30th
> second: should another alert be emitted repeatedly...
> 
> Most of the time, it's not an issue in CEP ;-)
> 
> -W
> 
> 
> 
> 
> 
> 
>> On 27/02/2014, lin.lin  wrote:
>> Hi,
>> 
>> I tried to create a rule that gives an alert when a machine reading is high
>> for 30 seconds. I modeled the machine reading input as events.  The
>> following is the rule:
>> 
>> rule "rule1"
>> dialect "mvel"
>>when
>>   $rd1 : mReading( reading >90 ) from entry-point ReadingStream
>>   not ($rd2 : mReading (reading<=90 , this before [0s, 30s] $rd1 )
>> from entry-point ReadingStream )
>>then
>>  System.out.print ("alert: Reading high for 30 seconds \n");
>> end
>> 
>> This does not detect detect the bad reading.  However, If I changed the
>> rule
>> to be following (change second condition from "not" to "exists"), it
>> detects
>> all readings that are good.
>> 
>> rule "rule1"
>> dialect "mvel"
>>when
>>   $rd1 : mReading( reading >90 ) from entry-point ReadingStream
>>   exists ($rd2 : mReading (reading<=90 , this before [0s, 30s] $rd1 )
>> from entry-point ReadingStream )
>>then
>>  System.out.print ("alert: Reading high for 30 seconds \n");
>> End
>> 
>> 
>> Is this an issue in CEP or did I do something wrong?
>> 
>> Thanks a lot!
>> Lily
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/sliding-window-question-tp4028367.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

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

Re: [rules-users] NullPointerException when calling Scan manually

2014-02-27 Thread Davide Sottara
Could you please share the unit test?
Thanks
Davide

On 02/27/2014 11:42 AM, Brecht De Rooms wrote:
> Dear Drools users,
>
> I just merged all my code to Drools 6.0.1 and I am happy to see that it is  
> more stable. Several issues I had with 5.6.x do not present themselves in  
> 6.0.1. I am still stuck on one bug however that occurs randomly. I wrote a  
> unit test in which I deploy new rules and then call scanNow. Often the  
> unit test succeeds, but sometimes it throws this nullpointer exception.
>
>
> java.lang.NullPointerException
>   at  
> org.drools.core.rule.Package.getRulesGeneratedFromResource(Package.java:668)
>   at  
> org.drools.core.rule.Package.removeRulesGeneratedFromResource(Package.java:658)
>   at  
> org.drools.core.reteoo.ReteooRuleBase.removeObjectsGeneratedFromResource(ReteooRuleBase.java:1653)
>   at  
> org.drools.compiler.compiler.PackageBuilder.removeObjectsGeneratedFromResource(PackageBuilder.java:4150)
>   at  
> org.drools.compiler.kie.builder.impl.KieContainerImpl.updateToVersion(KieContainerImpl.java:149)
>   at  
> org.kie.scanner.KieRepositoryScannerImpl.updateKieModule(KieRepositoryScannerImpl.java:214)
>   at  
> org.kie.scanner.KieRepositoryScannerImpl.scanNow(KieRepositoryScannerImpl.java:204)
>   at derooms.be.engine.RuleEngine.scanNow(RuleEngine.java:111)
>   at  
> derooms.be.engine.ruleDeployment.RulesPackageWriter.deployRules(RulesPackageWriter.java:104)
>   at  
> derooms.be.engine.ruleDeployment.RulesPackageWriter.addRules(RulesPackageWriter.java:84)
>   at  
> derooms.be.engine.dynamicRuleWatcher.RuleFileHandler.handleModifiedFile(RuleFileHandler.java:50)
>   at  
> derooms.be.engine.dynamicRuleWatcher.RulesWatcherRunnable.run(RulesWatcherRunnable.java:105)
>   at java.lang.Thread.run(Thread.java:744)
>
>
> Does anyone have an idea what the problem might be?
> Kind Regards,
> Brecht
>
> -
> Brecht De Rooms
> Phd Student @ WISE
> Department of Computer Science
> Vrije Universiteit Brussel
> Pleinlaan 2, B-1050 Brussels, Belgium
>
> office: 10 G 731f
> phone: +32 2 629 37 49
> email: bdero...@vub.ac.be
> -
>
> ---
> Dit e-mailbericht bevat geen virussen en malware omdat avast! 
> Antivirus-bescherming actief is.
> http://www.avast.com
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>

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


[rules-users] NullPointerException when calling Scan manually

2014-02-27 Thread Brecht De Rooms
Dear Drools users,

I just merged all my code to Drools 6.0.1 and I am happy to see that it is  
more stable. Several issues I had with 5.6.x do not present themselves in  
6.0.1. I am still stuck on one bug however that occurs randomly. I wrote a  
unit test in which I deploy new rules and then call scanNow. Often the  
unit test succeeds, but sometimes it throws this nullpointer exception.


java.lang.NullPointerException
at  
org.drools.core.rule.Package.getRulesGeneratedFromResource(Package.java:668)
at  
org.drools.core.rule.Package.removeRulesGeneratedFromResource(Package.java:658)
at  
org.drools.core.reteoo.ReteooRuleBase.removeObjectsGeneratedFromResource(ReteooRuleBase.java:1653)
at  
org.drools.compiler.compiler.PackageBuilder.removeObjectsGeneratedFromResource(PackageBuilder.java:4150)
at  
org.drools.compiler.kie.builder.impl.KieContainerImpl.updateToVersion(KieContainerImpl.java:149)
at  
org.kie.scanner.KieRepositoryScannerImpl.updateKieModule(KieRepositoryScannerImpl.java:214)
at  
org.kie.scanner.KieRepositoryScannerImpl.scanNow(KieRepositoryScannerImpl.java:204)
at derooms.be.engine.RuleEngine.scanNow(RuleEngine.java:111)
at  
derooms.be.engine.ruleDeployment.RulesPackageWriter.deployRules(RulesPackageWriter.java:104)
at  
derooms.be.engine.ruleDeployment.RulesPackageWriter.addRules(RulesPackageWriter.java:84)
at  
derooms.be.engine.dynamicRuleWatcher.RuleFileHandler.handleModifiedFile(RuleFileHandler.java:50)
at  
derooms.be.engine.dynamicRuleWatcher.RulesWatcherRunnable.run(RulesWatcherRunnable.java:105)
at java.lang.Thread.run(Thread.java:744)


Does anyone have an idea what the problem might be?
Kind Regards,
Brecht

-
Brecht De Rooms
Phd Student @ WISE
Department of Computer Science
Vrije Universiteit Brussel
Pleinlaan 2, B-1050 Brussels, Belgium

office: 10 G 731f
phone: +32 2 629 37 49
email: bdero...@vub.ac.be
-

---
Dit e-mailbericht bevat geen virussen en malware omdat avast! 
Antivirus-bescherming actief is.
http://www.avast.com

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


[rules-users] StatefulKnowledgeSession

2014-02-27 Thread Raja Sekhar
Hi,
How do cache the StatefulKnowledgeSession, instead of creating a new
session every time.
Using storm for data extraction and calling the rules to process them

-- 
Raja Sekhar Amirapu
--
"If any anyone can do it, i can do it. If no one else can do it, i must do
it"
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users