Re: [rules-users] facing problem in KnowledgeAgent

2013-04-19 Thread him
Thanks Manstis,  have some repository issue, now it is running fine ... thank
you very much for your help



--
View this message in context: 
http://drools.46999.n3.nabble.com/facing-problem-in-KnowledgeAgent-tp4023368p4023429.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] Importing Rules as Object into KnowledgeBuilder

2013-04-19 Thread Bojan Janisch
Hello everyone,

is there a way to import Rules as Objects into the Knowledgebase? So far I've 
seen, Drools supports only Bytearray, Files and InputStream as Rule Resources. 

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


Re: [rules-users] Importing Rules as Object into KnowledgeBuilder

2013-04-19 Thread Wolfgang Laun
On 19/04/2013, Bojan Janisch  wrote:
> Hello everyone,
>
> is there a way to import Rules as Objects

java.lang.Object? Anything is an Object.

You can add rules in a KnowledgePackage compiled earlier and serialized.

-W

> into the Knowledgebase? So far
> I've seen, Drools supports only Bytearray, Files and InputStream as Rule
> Resources.
>
> Greetings
> Bojan
> ___
> 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] Importing Rules as Object into KnowledgeBuilder

2013-04-19 Thread Bojan Janisch
Thx for the fast reply Wolfgang, 

but it is not very helpful. Maybe I should have asked another way to get it 
clearer. Is there a way in Drools to represent a rule in another way than file, 
string, bytearray or even a compiled form? For example: I want to create a 
syntaxtree for rules, but I don't know how to import the tree (which simple 
represents a specific rule) into the KnowledgeBuilder. So is there a way how to 
import this object into the Builder or (if it is not possible yet) which 
Interface do I have to use, to write an API between the Tree and the 
KnowledgeBuilder?

Greetings
Bojan

- Ursprüngliche Mail -
Von: "Wolfgang Laun" 
An: "Rules Users List" 
Gesendet: Freitag, 19. April 2013 10:49:15
Betreff: Re: [rules-users] Importing Rules as Object into KnowledgeBuilder

On 19/04/2013, Bojan Janisch  wrote:
> Hello everyone,
>
> is there a way to import Rules as Objects

java.lang.Object? Anything is an Object.

You can add rules in a KnowledgePackage compiled earlier and serialized.

-W

> into the Knowledgebase? So far
> I've seen, Drools supports only Bytearray, Files and InputStream as Rule
> Resources.
>
> Greetings
> Bojan
> ___
> 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] Importing Rules as Object into KnowledgeBuilder

2013-04-19 Thread Wolfgang Laun
On 19/04/2013, Bojan Janisch  wrote:
> Thx for the fast reply Wolfgang,
>
> but it is not very helpful. Maybe I should have asked another way to get it
> clearer. Is there a way in Drools to represent a rule in another way than
> file, string, bytearray or even a compiled form? For example: I want to
> create a syntaxtree for rules, but I don't know how to import the tree
> (which simple represents a specific rule) into the KnowledgeBuilder. So is
> there a way how to import this object into the Builder or (if it is not
> possible yet) which Interface do I have to use, to write an API between the
> Tree and the KnowledgeBuilder?

This is indeed clearer. - See 4.4.2.6, Rule API, in Drools
Introduction and General User Guide.
-W

>
> Greetings
> Bojan
>
> - Ursprüngliche Mail -
> Von: "Wolfgang Laun" 
> An: "Rules Users List" 
> Gesendet: Freitag, 19. April 2013 10:49:15
> Betreff: Re: [rules-users] Importing Rules as Object into KnowledgeBuilder
>
> On 19/04/2013, Bojan Janisch  wrote:
>> Hello everyone,
>>
>> is there a way to import Rules as Objects
>
> java.lang.Object? Anything is an Object.
>
> You can add rules in a KnowledgePackage compiled earlier and serialized.
>
> -W
>
>> into the Knowledgebase? So far
>> I've seen, Drools supports only Bytearray, Files and InputStream as Rule
>> Resources.
>>
>> Greetings
>> Bojan
>> ___
>> 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


[rules-users] Fetch Packages using REST api --> KnowledgeBuilder

2013-04-19 Thread Charles Moulliard
Hi,

Using the following code, I can fetch the packages from Guvnor using Rest
API (source) but How can I next create a KnowledgeBuilder based on the
source of Packages retrieved ?

My idea is to use ResourceFactory.

// Fetch Packages from Guvnor
URL url = new URL("
http://127.0.0.1:8080/guvnor.war/rest/packages/mortgages/source";);
HttpURLConnection connection = (HttpURLConnection)
url.openConnection();
connection.setRequestProperty("Authorization",
"Basic " + new
Base64().encodeToString(("admin:admin".getBytes(;
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", MediaType.WILDCARD);
connection.connect();

System.out.println("ResponseCode: " + connection.getResponseCode());
System.out.println("MediaType: " + connection.getContentType());

String packages = IOUtils.toString(connection.getInputStream());
InputStream is = connection.getInputStream();

Regards,

-- 
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Importing Rules as Object into KnowledgeBuilder

2013-04-19 Thread Bojan Janisch
Thanks Wolfgang,

this Information is indeed useful (btw. I found the API under section 4.5.2.6, 
maybe there are different versions on the net, I didn't found a user guide 
where you section matches the topic), but it is a bit thin. Could you explain 
the use of the API or do you know a more detailed documentation about this 
topic?

Greetings
Bojan

- Ursprüngliche Mail -
Von: "Wolfgang Laun" 
An: "Rules Users List" 
Gesendet: Freitag, 19. April 2013 11:17:28
Betreff: Re: [rules-users] Importing Rules as Object into KnowledgeBuilder

On 19/04/2013, Bojan Janisch  wrote:
> Thx for the fast reply Wolfgang,
>
> but it is not very helpful. Maybe I should have asked another way to get it
> clearer. Is there a way in Drools to represent a rule in another way than
> file, string, bytearray or even a compiled form? For example: I want to
> create a syntaxtree for rules, but I don't know how to import the tree
> (which simple represents a specific rule) into the KnowledgeBuilder. So is
> there a way how to import this object into the Builder or (if it is not
> possible yet) which Interface do I have to use, to write an API between the
> Tree and the KnowledgeBuilder?

This is indeed clearer. - See 4.4.2.6, Rule API, in Drools
Introduction and General User Guide.
-W

>
> Greetings
> Bojan
>
> - Ursprüngliche Mail -
> Von: "Wolfgang Laun" 
> An: "Rules Users List" 
> Gesendet: Freitag, 19. April 2013 10:49:15
> Betreff: Re: [rules-users] Importing Rules as Object into KnowledgeBuilder
>
> On 19/04/2013, Bojan Janisch  wrote:
>> Hello everyone,
>>
>> is there a way to import Rules as Objects
>
> java.lang.Object? Anything is an Object.
>
> You can add rules in a KnowledgePackage compiled earlier and serialized.
>
> -W
>
>> into the Knowledgebase? So far
>> I've seen, Drools supports only Bytearray, Files and InputStream as Rule
>> Resources.
>>
>> Greetings
>> Bojan
>> ___
>> 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

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

Re: [rules-users] Importing Rules as Object into KnowledgeBuilder

2013-04-19 Thread Wolfgang Laun
4.4.2.6 is from 5.5.0 Final.
This is not part of the "stable" API
Documentation: read the source files.
-W

On 19/04/2013, Bojan Janisch  wrote:
> Thanks Wolfgang,
>
> this Information is indeed useful (btw. I found the API under section
> 4.5.2.6, maybe there are different versions on the net, I didn't found a
> user guide where you section matches the topic), but it is a bit thin. Could
> you explain the use of the API or do you know a more detailed documentation
> about this topic?
>
> Greetings
> Bojan
>
> - Ursprüngliche Mail -
> Von: "Wolfgang Laun" 
> An: "Rules Users List" 
> Gesendet: Freitag, 19. April 2013 11:17:28
> Betreff: Re: [rules-users] Importing Rules as Object into KnowledgeBuilder
>
> On 19/04/2013, Bojan Janisch  wrote:
>> Thx for the fast reply Wolfgang,
>>
>> but it is not very helpful. Maybe I should have asked another way to get
>> it
>> clearer. Is there a way in Drools to represent a rule in another way than
>> file, string, bytearray or even a compiled form? For example: I want to
>> create a syntaxtree for rules, but I don't know how to import the tree
>> (which simple represents a specific rule) into the KnowledgeBuilder. So is
>> there a way how to import this object into the Builder or (if it is not
>> possible yet) which Interface do I have to use, to write an API between
>> the
>> Tree and the KnowledgeBuilder?
>
> This is indeed clearer. - See 4.4.2.6, Rule API, in Drools
> Introduction and General User Guide.
> -W
>
>>
>> Greetings
>> Bojan
>>
>> - Ursprüngliche Mail -
>> Von: "Wolfgang Laun" 
>> An: "Rules Users List" 
>> Gesendet: Freitag, 19. April 2013 10:49:15
>> Betreff: Re: [rules-users] Importing Rules as Object into KnowledgeBuilder
>>
>> On 19/04/2013, Bojan Janisch  wrote:
>>> Hello everyone,
>>>
>>> is there a way to import Rules as Objects
>>
>> java.lang.Object? Anything is an Object.
>>
>> You can add rules in a KnowledgePackage compiled earlier and serialized.
>>
>> -W
>>
>>> into the Knowledgebase? So far
>>> I've seen, Drools supports only Bytearray, Files and InputStream as Rule
>>> Resources.
>>>
>>> Greetings
>>> Bojan
>>> ___
>>> 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
>
> ___
> 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] Util Method to split "String" content containing declare/end, rule/end, ...

2013-04-19 Thread Charles Moulliard
Hi,

Is there a util method in drools / kie project to split content of a
package that we retrieve using REST from Guvnor ?

package mortgages

// BEGIN
declare LoanApplication
  amount: Integer
  approved: Boolean
  deposit: Integer
  approvedRate: Integer
  lengthYears: Integer
  explanation: String
  insuranceCost: Integer
end // SPLIT END HERE

...

rule "CheckBoxDslRule"
dialect "mvel"
when
then
end

Regards,

-- 
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Optaplan6.0.0Beta1:chaining-simpleScore OK, DRL Score corruption

2013-04-19 Thread Paul T
Hi Geoffrey - thanks for the prompt reply.

Installed the latest OptaPlanner snapshot but did not resolve the error - no
change.
I have played around and made some incremental improvements and although I
can still replicate the error I described earlier the single constraint
match error appears easier to debug with this test data.

SimpleScore still works fine and comes up with best answer SOFT -2. DRL
score corruption (only 1 rule) occurs in local search - gets through
FIRST_FIT heuristics OK. 
I am still using 4 Plan entities,1 equipment(anchor) to schedule.
Equip idNo:44 fryer1
Plan  idNo:58 T1 fryer fry chips duration : 3 stand: 1
Plan  idNo:61 T1 fryer fry snitzel duration: 7 stand: 2
Plan  idNo:64 T2 fryer fry chips duration : 3 stand: 1
Plan  idNo:67 T2 fryer fry snitzel duration: 7 stand: 2
Table idNo:41 T1
Table idNo:42 T2


Exception in thread "main" java.lang.IllegalStateException: Score
corruption: the workingScore (0hard/0medium/-8soft) is not the
uncorruptedScore (0hard/0medium/-12soft):
  The corrupted scoreDirector has no ConstraintMatch(s) which are in excess.
  The corrupted scoreDirector has 1 ConstraintMatch(s) which are missing:
com.umple.solver/standtime vs
maxendtime/level2/[org.drools.core.reteoo.InitialFactImpl@4dde85f0,
[Table-41], 
fryer1 44 T1POS:4 Plan: id 58 fry chips, 
fryer1 44 T1POS:2 Plan: id 61 fry snitzel]=-4

rule "standtime vs maxendtime"
salience 20
when
not Plan(previousItemTaskorEquip== null)
// forces all plans to be
initialised
$table : Table(id!=null,$tableName : name)  

   $latestplan : Plan(previousItemTaskorEquip!= null,tableName
==$tableName,
$maxend : getEquipEndTime(),$maxid : 
id,$maxstandtime :
taskSeqStandTime 
)   

// NB working - selects correct latestplan  - strange not all the
latestplans used in heuristics - but are used in local search   
not Plan(previousItemTaskorEquip != null,tableName
==$tableName,getEquipEndTime() > $maxend)

// check all plans vs latestplan
$plan : Plan(previousItemTaskorEquip!= null,id != 
null,equip!=null,
tableName 
==$tableName,getEquipEndTime()<$maxend,id != $maxid,
$equip :equip,$endtime: 
getEquipEndTime(),$standtime :
taskSeqStandTime,$id : id)

eval ($endtime+$standtime-$maxend<0)  

then
   scoreHolder.addSoftConstraintMatch(kcontext,
$endtime+$standtime-$maxend); 
end

The part of xml config file which is most likely relevant:


  
  

   
  

  6


  2000

  

If the Rule looks OK, I will manually step through the trace as it is doable
but am not sure how to do so or what to look for.

Thanks Paul





--
View this message in context: 
http://drools.46999.n3.nabble.com/Optaplan6-0-0Beta1-chaining-simpleScore-OK-DRL-Score-corruption-tp4023365p4023454.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] Optaplan6.0.0Beta1:chaining-simpleScore OK, DRL Score corruption

2013-04-19 Thread Geoffrey De Smet
Ok, this is starting to look like a genuine bug in drools/optaplanner.
Would it be possible to get a reproducer of this to me?

Easy way:
Zip up (part of) your project, attach it to jira issue for optaplanner
   http://issues.jboss.org/browse/PLANNER
and include detailed instructions how to reproduce it (e.g. which 
main(String[]) to run, which working dir, ...).
Try out your own instructions first pls :)

Preferred way:
Create a public unit test to reproduce it (if possible).

General hints:
The smaller the dataset to reproduce, the better.
The less steps/moves to reproduce, the better.
The less rules active to reproduce, the better.

I 'll isolate the bug from that reproducer, so Mario can fix it.

On 19-04-13 15:27, Paul T wrote:
> Hi Geoffrey - thanks for the prompt reply.
>
> Installed the latest OptaPlanner snapshot but did not resolve the error - no
> change.
> I have played around and made some incremental improvements and although I
> can still replicate the error I described earlier the single constraint
> match error appears easier to debug with this test data.
>
> SimpleScore still works fine and comes up with best answer SOFT -2. DRL
> score corruption (only 1 rule) occurs in local search - gets through
> FIRST_FIT heuristics OK.
> I am still using 4 Plan entities,1 equipment(anchor) to schedule.
> Equip idNo:44 fryer1
> Plan  idNo:58 T1 fryer fry chips duration : 3 stand: 1
> Plan  idNo:61 T1 fryer fry snitzel duration: 7 stand: 2
> Plan  idNo:64 T2 fryer fry chips duration : 3 stand: 1
> Plan  idNo:67 T2 fryer fry snitzel duration: 7 stand: 2
> Table idNo:41 T1
> Table idNo:42 T2
>
>
> Exception in thread "main" java.lang.IllegalStateException: Score
> corruption: the workingScore (0hard/0medium/-8soft) is not the
> uncorruptedScore (0hard/0medium/-12soft):
>The corrupted scoreDirector has no ConstraintMatch(s) which are in excess.
>The corrupted scoreDirector has 1 ConstraintMatch(s) which are missing:
>  com.umple.solver/standtime vs
> maxendtime/level2/[org.drools.core.reteoo.InitialFactImpl@4dde85f0,
> [Table-41],
>   fryer1 44 T1POS:4 Plan: id 58 fry chips,
>   fryer1 44 T1POS:2 Plan: id 61 fry snitzel]=-4
>
> rule "standtime vs maxendtime"
>   salience 20
>   when
>   not Plan(previousItemTaskorEquip== null)
> // forces all plans to be
> initialised
>   $table : Table(id!=null,$tableName : name)  
> 
> $latestplan : Plan(previousItemTaskorEquip!= null,tableName
> ==$tableName,
>   $maxend : getEquipEndTime(),$maxid : 
> id,$maxstandtime :
> taskSeqStandTime
>   )
>   
> // NB working - selects correct latestplan  - strange not all the
> latestplans used in heuristics - but are used in local search 
> 
>   not Plan(previousItemTaskorEquip != null,tableName
> ==$tableName,getEquipEndTime() > $maxend)
>
> // check all plans vs latestplan
>   $plan : Plan(previousItemTaskorEquip!= null,id != 
> null,equip!=null,
>   tableName 
> ==$tableName,getEquipEndTime()<$maxend,id != $maxid,
>   $equip :equip,$endtime: 
> getEquipEndTime(),$standtime :
> taskSeqStandTime,$id : id)
>
>   eval ($endtime+$standtime-$maxend<0)
>
>   then
>  scoreHolder.addSoftConstraintMatch(kcontext,
> $endtime+$standtime-$maxend);
> end
>
> The part of xml config file which is most likely relevant:
> 
>  
>
>
> 
> 
>  
>  
>6
>  
>  
>2000
>  
>
>
> If the Rule looks OK, I will manually step through the trace as it is doable
> but am not sure how to do so or what to look for.
>
> Thanks Paul
>
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Optaplan6-0-0Beta1-chaining-simpleScore-OK-DRL-Score-corruption-tp4023365p4023454.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] Error deploying Guvnor 6.0.0.Beta1 on Tomcat 7

2013-04-19 Thread maunakea
I was excited to try out Guvnor 6. Downloaded the Beta1 and tried deploying
on Tomcat 7.0.32. It deployed fine, but when I access the URL, I get the
trace below. Anybody able to deploy on Tomcat 7?

org.jboss.errai.bus.client.api.base.MessageDeliveryFailure: error invoking
endpoint
at
org.jboss.errai.bus.server.io.ConversationalEndpointCallback.callback(ConversationalEndpointCallback.java:132)
at
org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54)
at
org.jboss.errai.cdi.server.CDIExtensionPoints$3.callback(CDIExtensionPoints.java:512)
at
org.jboss.errai.bus.client.framework.DeliveryPlan.deliver(DeliveryPlan.java:43)
...
Caused by: java.lang.NullPointerException
at
org.uberfire.backend.server.UserServicesImpl.buildPath(UserServicesImpl.java:71)
at
org.uberfire.backend.server.UserServicesImpl$Proxy$_$$_WeldClientProxy.buildPath(UserServicesImpl$Proxy$_$$_We
at
org.uberfire.backend.server.WorkbenchServicesImpl.getPathToDefaultEditors(WorkbenchServicesImpl.java:105)
at
org.uberfire.backend.server.WorkbenchServicesImpl.loadDefaultEditorsMap(WorkbenchServicesImpl.java:76)
at
org.uberfire.backend.server.WorkbenchServicesImpl$Proxy$_$$_WeldClientProxy.loadDefaultEditorsMap(WorkbenchSer
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.jboss.errai.bus.server.io.ConversationalEndpointCallback.callback(ConversationalEndpointCallback.java:114)
... 29 more
*** Message delivery failure ***
Bus: org.jboss.errai.bus.server.ServerMessageBusImpl@134137c
Message: CommandType=loadDefaultEditorsMap:,
ErrorTo=org.uberfire.client.workbench.services.WorkbenchServices:RPC.loadDef
errorMessage: Error calling remote service:
org.uberfire.client.workbench.services.WorkbenchServices:RPC
exception: org.jboss.errai.bus.client.api.base.MessageDeliveryFailure: error
invoking endpoint
disconnect: false
org.jboss.errai.bus.client.api.base.MessageDeliveryFailure: error invoking
endpoint
at
org.jboss.errai.bus.server.io.ConversationalEndpointCallback.callback(ConversationalEndpointCallback.java:132)
at
org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54)
at
org.jboss.errai.cdi.server.CDIExtensionPoints$3.callback(CDIExtensionPoints.java:512)
at
org.jboss.errai.bus.client.framework.DeliveryPlan.deliver(DeliveryPlan.java:43)



--
View this message in context: 
http://drools.46999.n3.nabble.com/Error-deploying-Guvnor-6-0-0-Beta1-on-Tomcat-7-tp4023456.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] Optaplan6.0.0Beta1:chaining-simpleScore OK, DRL Score corruption

2013-04-19 Thread Paul T
Hi Geoffrey
Again thanks for quick response - I will do so although a public unit test
is beyond me as I am no expert in Java or Drools but will provide a simple
stripped run example. The 4 entities,1 anchor,1 rule is the simplest
crashing example data I have.

Thanks Paul



--
View this message in context: 
http://drools.46999.n3.nabble.com/Optaplan6-0-0Beta1-chaining-simpleScore-OK-DRL-Score-corruption-tp4023365p4023457.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] Error adding new rule at Runtime drools 5.4.0.Final

2013-04-19 Thread Tushar
Hi all,

I am using Drools-Fusion v5.4.0.Final. My use case is to add rules
dynamically at runtime which should get automatically updated in the
KnowledgeSession. Rules in my application are defined as DTO. I have
written a toDrl() method which returns a String which essentially is a rule
in drl. I use following code to add it to the already running instance of
rule engine.

*Initialize Rule Engine
*KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase();
if(kBase != null){
kBase.addKnowledgePackages(kBuilder.getKnowledgePackages());
}

// Populate rules from DB
List alertDefs = getDbRules();
for(AlertDefinitionDto alertDef : alertDefs) {
 addRule(alertDef);
}
StatefulKnowledgeSession kSession = kBase.newStatefulKnowledgeSession();

*Add Rule
*try {
rwl.lock();
// Create new rule from AlertDefinitionDto

kBuilder.add(org.drools.io.ResourceFactory.newByteArrayResource(alertDef.toDrl().getBytes()),
org.drools.builder.ResourceType.DRL);
if(kBuilder.hasErrors()) {
kBuilder.undo();
KnowledgeBuilderErrors errs = kBuilder.getErrors();
System.err.print(AlertGenerationServiceImpl.class, "Error
adding rule : "+alertDef.getName());
String errorStr = "";
for (KnowledgeBuilderError error : errs) {
errorStr = errorStr + error.getMessage()+"\\n";
}
System.err.print("Error adding new rule: "+errorStr);
}
} finally {
rwl.unlock();
}
*
*
*   *// No errors. Update KnowledgeBase.
try {
Collection kPkgs =
kBuilder.getKnowledgePackages();
kBase.addKnowledgePackages(kPkgs);
} catch (RuntimeException e) {
if(kBase.getRule(RULE_PACKAGE_NAME, alertDef.getName()) !=
null) {
kBuilder.undo();
}
e.printStackStrace();
}
*
*
*Fire Rules
*
**LogMessage logMsg = getLog();*
*
kSession.insert(logMsg);
kSession.fireAllRules();


This code works fine under all conditions for initialization where rules
are fetched from DB and rule engine is initialized.

The code fails to add new rule dynamically, when the rule engine is already
initialized and fired few number of times with LogMessage as fact. The
errors which I am getting are

--

1. For the first time when it fails to add new rule.

--
java.lang.RuntimeException: Null accessor on node: null
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeNode(ConditionAnalyzer.java:229)
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeSingleCondition(ConditionAnalyzer.java:126)
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:102)
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeCombinedCondition(ConditionAnalyzer.java:134)
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:94)
at
org.drools.rule.constraint.ConditionAnalyzer.analyzeCondition(ConditionAnalyzer.java:73)
at
org.drools.rule.constraint.MvelConditionEvaluator.getAnalyzedCondition(MvelConditionEvaluator.java:78)
at
org.drools.rule.constraint.MvelConstraint.getListenedPropertyMask(MvelConstraint.java:273)
at org.drools.reteoo.AlphaNode.calculateDeclaredMask(AlphaNode.java:372)
at org.drools.reteoo.ObjectSource.initDeclaredMask(ObjectSource.java:151)
at org.drools.reteoo.AlphaNode.(AlphaNode.java:86)
at
org.drools.reteoo.builder.PatternBuilder.attachAlphaNodes(PatternBuilder.java:323)
at
org.drools.reteoo.builder.PatternBuilder.attachPattern(PatternBuilder.java:162)
at org.drools.reteoo.builder.PatternBuilder.build(PatternBuilder.java:80)
at
org.drools.reteoo.builder.GroupElementBuilder$AndBuilder.build(GroupElementBuilder.java:113)
at
org.drools.reteoo.builder.GroupElementBuilder.build(GroupElementBuilder.java:71)
at
org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(ReteooRuleBuilder.java:155)
at
org.drools.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:128)
at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:116)
at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:445)
at org.drools.common.AbstractRuleBase.addRule(AbstractRuleBase.java:956)
at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:627)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:472)
at
org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:150)
--

2. Everytime after 1st failure.

--
java.lang.NullPointerException
at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java

[rules-users] KnowledgeBase in drools 6.0.0.beta1

2013-04-19 Thread gboro54
I am evaluating 6.0.0.beta1 and seem to have issues with the KnowledgeBase.
It looks like it is marked with @Deprecated. What is the proper way to build
the KnowledgeBase in 6(as the documentation still refers to this way).

TIA!



--
View this message in context: 
http://drools.46999.n3.nabble.com/KnowledgeBase-in-drools-6-0-0-beta1-tp4023459.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] KnowledgeBase in drools 6.0.0.beta1

2013-04-19 Thread Mark Proctor
The is a complet api change in 6.0. We've moved from a pure api approach, to 
something convention and configuration based.
We've done a number of examples for this, but unfortunately not had time to 
document them :(
https://github.com/droolsjbpm/drools/tree/master/drools-examples-api

Mark
On 19 Apr 2013, at 16:43, gboro54  wrote:

> I am evaluating 6.0.0.beta1 and seem to have issues with the KnowledgeBase.
> It looks like it is marked with @Deprecated. What is the proper way to build
> the KnowledgeBase in 6(as the documentation still refers to this way).
> 
> TIA!
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/KnowledgeBase-in-drools-6-0-0-beta1-tp4023459.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] KnowledgeBase in drools 6.0.0.beta1

2013-04-19 Thread gboro54
Thanks Mark! I will do my best to reverse engineer what is needed from the
examples.  Is there a good place to get information on changes to the drools
syntax(if any) or additional information on the new algorithms implemented(I
know RETE was going bye-bye)? 



--
View this message in context: 
http://drools.46999.n3.nabble.com/KnowledgeBase-in-drools-6-0-0-beta1-tp4023459p4023461.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] Guvnor 5.5.0.Final with IE and Firefox issues

2013-04-19 Thread Sean Su
Do we have existing issues being tracked for "Guided Rule Editor" in Guvnor
5.5.0.Final not working on IE? The same Editor opened fine with Firefox.

Also noticed, even though the editor can be opened in Firefox, the "Load
Template Data" button in the "rule template" seems not working. There is no
visible response after it is clicked.

Unfortunately, I can't test this on IE as I could not open the "editor" in
the first place.

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

Re: [rules-users] Guvnor 5.5.0.Final with IE and Firefox issues

2013-04-19 Thread Michael Anstis
Both issues you report have been fixed on the 5.5.x and master branches.

There is a JIRA for the template issue but I forget the number. There was a
fix provided by a commumity member for the Guided Rule Editor issue on IE.

I believe 5.6 will be released soon (but I've heard that for the last
month).
On 19 Apr 2013 22:03, "Sean Su"  wrote:

> Do we have existing issues being tracked for "Guided Rule Editor" in
> Guvnor 5.5.0.Final not working on IE? The same Editor opened fine with
> Firefox.
>
> Also noticed, even though the editor can be opened in Firefox, the "Load
> Template Data" button in the "rule template" seems not working. There is no
> visible response after it is clicked.
>
> Unfortunately, I can't test this on IE as I could not open the "editor" in
> the first place.
>
> Sean
>
> ___
> 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 queries: strange dependency

2013-04-19 Thread Davide Sottara
I created a test case which shows a combination of traits+BC

http://pastebin.com/Wrq6Hj5L

it's pending a tiny but critical bug fix in core, so it won't be
"officially" available
until early next week.

What essentially happens is:
- dynamic traits are used to "inject interfaces" to a class - it's
stronger than simply
storing the class literal in a field (which it does anyway), because it
now allows to
use the object through the newly added interface.
I am working on a way to derive the interfaces - and some classification
rules -
directly from an ontology
- BC is used to resolve the transitive queries.
Consider that queries are "LHS" elements, so they are evaluated as
tuples are being
propagated.

If you run the example with the string "Como", it will look for a **
Country **
that the place called "Como" is also in (transitively)

The last pattern in the rule is redundant - for test purpose only - and
is remarking
that the returned Country is actually Italy :)

Best
Davide


On 04/15/2013 09:45 PM, Upali Kohomban wrote:
> hi Davide,
>
> Your summary is quite accurate about my case.
>
> Thanks for the pointer, I will look in to hybrid chaining once I do a
> little investigation on why exactly the original problem occurred. I'm
> still having little issues with the 5.5.1 source compilation (for
> which your help worked flawlessly to get the source working, but there
> were test fails during the compilation. I will try myself to fix them
> before asking questions on that).
>
> As i said, the bigger problem is with the rules that are transitive in
> nature. Let's say there is a is_in rule which is used to derive
> spacial relationships. For instance, a concrete example
>
> is_in (uni_of_michigan, ann_arbor).
> is_in(ann_arbor, MI).
> is_in(MI, USA).
> is_in(A, C) <- is_in(A, B), is_in(B, C).
>
> I want to deduce (in general course of reasoning) such stuff as
> is_in(uni_of_michigan, USA), but if I do it in the regular drools way,
> I'd end up with a load of unnecessary deductions. This is the biggest
> problem I have. If you want a more involved concrete example, say I
> define (for the sake of simplicity)
>
> romantic(A) <- scenic(A), secluded(A).
> scenic(A) <- next_to(A, B), scenic_artefact(B).
> scenic_artefact(B) <- lake(B) or waterfall(B) or ... and so on
> secluded(A) <-  [ situated further than N km from the nearest city ]
>
> Now this last rule is where logic gives way to POJO and databases. It
> seems to me that this is the most sensible thing to do. Also, this is
> as far as I want to go at the moment. (Having known the non-boolean
> reasoning ability of drools from your mail, I can think of many ways I
> want to use it :) )
>
> I looked into your profile and saw that you have a background on the
> ontologies. Especially what you have mentioned under Drools - "Open
> Source Knowledge Integration and Reasoning Platform" in your
> university profile seems quite intersting and seems to be exactly the
> things I might be needing in the near future. I was thinking that I'll
> have to implement non-boolean reasoning using some fuzzy toolkit, if
> it becomes available with drools I'll be really happy to give it a try.
>
> If you have any material to share for further reading on your drools
> research, I'd be grateful.
>
> Thanks,
> Upali
>
>
> On 15/04/2013 03:10, Davide Sottara wrote:
>> Correct me if I'm wrong, I would summarize your requirements as follows:
>> - you need some "A-box" reasoning, but you are fine with a rule-based
>> approach
>> - the object-oriented integration Drools provides is quite convenient
>> - you have large data sets for which an opportunistic,
>> "query-oriented" approach
>> would work better rather than a fully generative "forward chaining"
>> approach
>>
>> Drools "hybrid-chaining" approach could be very useful here - I'm not
>> sure how
>> well documented it is, and how you are planning to use it, but it
>> would be interesting
>> to see one of your rules - even "stripped" of the details you don't
>> want to show -
>> to discuss the behaviour of the engine and its implications.
>>
>> I had a use case apparently very similar to yours some time ago.. I'm
>> working even
>> now on some experimental forms of rule/object/ontology integration.
>> The "trait"
>> feature might be an alternative to the explicit addition of classes
>> to objects .. it was
>> enhanced a few days ago to support updates and modifications.
>> If you have an ontology to begin with, you might also be interested
>> in the ontology -> class
>> conversion tool I'm working on even now
>>
>> Davide
>
>
>
>
> ___
> 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] Fusion: Null pointer exception when using sliding windows

2013-04-19 Thread Davide Sottara
I have identified the problem and submitted a tentative patch:
I guess it will be discussed and (hopefully) integrated early next week
If you want, you can try and apply it yourself
https://github.com/sotty/drools/commit/c949ef0195ad174fadae6369985fa17d46c54834


On 04/18/2013 12:28 PM, burmanator wrote:
> The missing ":" was just a typo in my transcribing. I'm running my code in a
> virtual machine so I couldn't copy and paste and have to hand type
> everything out.  I go through and check the knowledge builder for errors by
> checking the size of KnowledgeBuilder.getErrors() and if the size is greater
> then 0, display the error. However nothing comes up.
>
> I'm running Drools 5.5.0.Final that I just downloaded recently.
>
> the DRL I'm using consists of:
>
> package testing2;
>
> import test2.*; 
> import java.util.*;
> import org.drools.*;
>
> declare Foo
> @role(event)
> @timestamp(Start)
> @duration(Duration)
> end
>
> rule test
> when
> $primary : Foo($name : Name) over window:length(24)
> $prev : ArrayList(size<1) from collect ( Foo(Name == $name, this before
> $primary)) 
> then
> System.out.println("Found name: " + $name);
> end
>
>
> The error in the console that gets spit back out is:
>
> java.land.NullPointerException
>at org.drools.core.util.index.RightTupleIndexHashTable.remove
> (RightTupleIndexHashTable.java : 363)
>at org.drools.reteoo.AccumulateNode.retractRightTuple
> (AccumulateNode.java : 318)
>at org.drools.rule.SlidingLengthWindow.assertFact
> (SlidingLengthWindow.java : 116)
>at org.drools.rule.BehaviorManager.assertFact (BehaviorManager.java : 94)
>at org.drools.reteoo.WindowNode.assertObject (WindowNode.java : 167)
>at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject
> (CompositeObjectSinkAdapter.java : 497)
>at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
> (CompositeObjectSinkAdapter.java : 382)
>at org.drools.reteoo.ObjectTypeNode.assertObject (ObjectTypeNode.java :
> 235)
>at org.drools.reteoo.EntryPointNode.assertObject (EntryPointNode.java :
> 240)
>at org.drools.common.NamedEntryPoint.insert (NamedEntryPoint.java : 350)
>at org.drools.common.NamedEntryPoint.insert (NamedEntryPoint.java : 311)
>at org.drools.common.AbstractWorkingMemory.insert
> (AbstractWorkingMemory.java : 903)
>at org.drools.common.AbstractWorkingMemory.insert
> (AbstractWorkingMemory.java : 847)
>at
> org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java
> : 269)
>at test2.Engine2.main (ngine2.java : 78)
>
> that last line points to my main class where I add the events into the
> knowledge session.
>
> When I change "over window:length(24)" to "over window:time(21d)" (my sample
> data is about 22 days old now) I get the error:
>
> org.drools.RuntimeDroolsException : Unexpected exception executing action
> org.drools.rule.SlidingTimeWIndow$BehaviorExpireWMAction@491cc367
>at org.drools.common.AbstractWorkingMemory.executeQueuedActions
> (AbstractWorkingMemory.java : 995)
>at org.drools.common.NamedEntryPoint.insert (NamedEntryPoint.java : 362)
>at org.drools.common.NamedEntryPoint.insert (NamedEntryPoint.jaba : 311)
>at org.drools.common.AbstractWorkingMemory.insert
> (AbstractWorkingMemory.java : 903)
>at org.drools.common.AbstractWorkingMemory.insert
> (AbstractWorkingMemory.java : 847)
>at org.drools.impl.StatefulKnowledgeSessionImpl.insert
> (StatefulKnowledgeSessionImpl.java : 269)
>at test2.Engine2.main (Engine2.java : 78)
> Caused by: java.lang.NullPointerException
>at
> org.drools.core.util.index.RightTupleIndexHashTable.remove(RightTupleIndexHashTable.java
> : 363)
>at org.drools.reteoo.AccumulateNode.retractRightTuple
> (AccumulateNode.java : 318)
>at org.drools.rule.SlidingTimeWindow.expireFacts(SlidingTimeWindow.java :
> 189)
>at org.drools.rule.SlidingTimeWindow$BehaviorExpireWMAction.execute
> (SlidingTimeWindow.java : 471)
>at org.drools.common.AbstractWorkingMemory.executeQueuedActions
> (AbstractWorkingMemory.java : 993)
> ... 6 more
>
>
> When I get rid of any over window statements, everything runs just fine.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Fusion-Null-pointer-exception-when-using-sliding-windows-tp4023410p4023426.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] NullPointerException when using bean property which happens to be a Enum name

2013-04-19 Thread Sean Su
Case has been created:

https://issues.jboss.org/browse/GUVNOR-2007

thanks

Sean


On Thu, Apr 18, 2013 at 2:54 PM, Michael Anstis wrote:

> Please raise a JIRA for Guvnor and attach your model JAR. I will take a
> look.
> On 18 Apr 2013 18:50, "Sean Su"  wrote:
>
>> yes. you are correct.
>>
>>
>> On Thu, Apr 18, 2013 at 1:28 PM, Stephen Masters 
>> wrote:
>>
>>> Shouldn't that have been:
>>>
>>> $foo : Foo (myEnum == MyEnum.someItem)
>>>
>>> Your field is presumably "myEnum", whereas the class is "MyEnum".
>>>
>>>
>>> On 18 Apr 2013, at 18:19, Sean Su  wrote:
>>>
>>> $foo : Foo (MyEnum == MyEnum.someItem)
>>>
>>>
>>>
>>> ___
>>> 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] Fusion: Null pointer exception when using sliding windows

2013-04-19 Thread Wolfgang Laun
On 18/04/2013, burmanator  wrote:
>
> rule test
> when
> $primary : Foo($name : Name) over window:length(24)
> $prev : ArrayList(size<1) from collect ( Foo(Name == $name, this before
> $primary))
> then
> System.out.println("Found name: " + $name);
> end
>

Apart from the sliding window and the manifest bug: I just wonder why
nobody has pointed out that the rule can be rewritten as:

rule test
when
$primary : Foo($name : Name) over window:length(24)
not Foo(Name == $name, this before $primary)
then
   System.out.println("Found name: " + $name);
end

There is no other way the list size can be less than 1 :-)
-W
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Fusion: Null pointer exception when using sliding windows

2013-04-19 Thread Davide Sottara
Wolfgang,
I was expecting you to do that :)

Btw, I don't know the requirements, but I wonder if some window
filter or temporal horizon (i.e. before[x,y]) shouldn't be applied to
the second pattern too... the use of a plain "before" requires to
keep all events in the WM since the beginning of time



On 04/19/2013 08:48 PM, Wolfgang Laun wrote:
> On 18/04/2013, burmanator  wrote:
>> rule test
>> when
>> $primary : Foo($name : Name) over window:length(24)
>> $prev : ArrayList(size<1) from collect ( Foo(Name == $name, this before
>> $primary))
>> then
>> System.out.println("Found name: " + $name);
>> end
>>
> Apart from the sliding window and the manifest bug: I just wonder why
> nobody has pointed out that the rule can be rewritten as:
>
> rule test
> when
> $primary : Foo($name : Name) over window:length(24)
> not Foo(Name == $name, this before $primary)
> then
>System.out.println("Found name: " + $name);
> end
>
> There is no other way the list size can be less than 1 :-)
> -W
> ___
> 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