[rules-users] help! rulerule_key failed to predicate

2011-04-15 Thread 赵慧
 hello,everyone! I wrote a rule with Drools, I compile the program and get the 
errors as follows: 

[3,0]: [ERR 103] Line 3:0 rule 'rule_key' failed predicate: 
{(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
[3,9]: [ERR 101] Line 3:9 no viable alternative at input 'com' in rule package
[7,0]: [ERR 101] Line 7:0 no viable alternative at input 'import' in rule 
package in rule sample  

I don't know how it happened, looking forward to your reply! thank you !!! 
 
PS: My rules are here:
 dialect mvel
package  com.sample
import com.sample.Server;

rule system will execute 'tc' command
   
 when
eval(Server.Message8388608)
 then 
 System.out.println(The network is so crowd that it needs repairing.);
Runtime.getRuntime().exec(tc);#give the authority and execute the tc 
command
end
 
rule caution
when 
eval(Server.Message==8388608)
then 
System.out.println(caution!The network maybe will get blocked very 
soon.);
end 
 
rule fluent network
  when
  eval(Server.Message8388608)#conditions
 then 
  System.out.println(the current network is very good);#actions
end
 
 
  

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


Re: [rules-users] help! rulerule_key failed to predicate

2011-04-15 Thread FrankVhh
Hi,

I thnik you might need to reposition dialect = mvel. The compiling error
will go away if you put it inside each of your rules. See example:

rule system will execute 'tc' command
   
 when
dialect mvel
eval(Server.Message8388608)
 then 
 System.out.println(The network is so crowd that it needs repairing.);
Runtime.getRuntime().exec(tc);#give the authority and execute the tc
command
end
 
rule caution
dialect mvel
when 
eval(Server.Message==8388608)
then 
System.out.println(caution!The network maybe will get blocked very
soon.);
end 
 
rule fluent network
  dialect mvel
  when
  eval(Server.Message8388608)#conditions
 then 
  System.out.println(the current network is very good);#actions
end

Also, mvel is needed to make the eval statement work. In your case, it
might not be needed to work with eval at all.

WHEN Server.message   should work as well. Providing you have an
attribute message in Server with a getter defined.

Regards,
Frank


赵慧 wrote:
 
 hello,everyone! I wrote a rule with Drools, I compile the program and get
 the errors as follows: 
 
 [3,0]: [ERR 103] Line 3:0 rule 'rule_key' failed predicate:
 {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
 [3,9]: [ERR 101] Line 3:9 no viable alternative at input 'com' in rule
 package
 [7,0]: [ERR 101] Line 7:0 no viable alternative at input 'import' in rule
 package in rule sample  
 
 I don't know how it happened, looking forward to your reply! thank you !!! 
  
 PS: My rules are here:
  dialect mvel
 package  com.sample
 import com.sample.Server;
 
 rule system will execute 'tc' command

  when
 eval(Server.Message8388608)
  then 
  System.out.println(The network is so crowd that it needs
 repairing.);
 Runtime.getRuntime().exec(tc);#give the authority and execute the
 tc command
 end
  
 rule caution
 when 
 eval(Server.Message==8388608)
 then 
 System.out.println(caution!The network maybe will get blocked
 very soon.);
 end 
  
 rule fluent network
   when
   eval(Server.Message8388608)#conditions
  then 
   System.out.println(the current network is very good);#actions
 end
  
  
   
 
 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 


--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-help-rule-rule-key-failed-to-predicate-tp2823695p2823722.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] help! rulerule_key failed to predicate

2011-04-15 Thread Wolfgang Laun
The package declaration must be first.

You don't have to insert the dialect attribute into each rule.

Please consult the manual when programming.

-W





2011/4/15 赵慧 zh...@hpnl.ac.cn

  hello,everyone! I wrote a rule with Drools,
 I compile the program and get the errors as follows:


 [3,0]: [ERR 103] Line 3:0 rule 'rule_key' failed predicate:
 {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
 [3,9]: [ERR 101] Line 3:9 no viable alternative at input 'com' in rule
 package
 [7,0]: [ERR 101] Line 7:0 no viable alternative at input 'import' in rule
 package in rule sample


 I don't know how it happened, looking forward to your reply! thank you !!!



 PS: My rules are here:

  dialect mvel
 package  com.sample

 import com.sample.Server;


 rule system will execute 'tc' command

  when
 eval(Server.Message8388608)
  then
  System.out.println(The network is so crowd that it needs
 repairing.);
 Runtime.getRuntime().exec(tc);#give the authority and execute the
 tc command
 end



 rule caution
 when
 eval(Server.Message==8388608)
 then
 System.out.println(caution!The network maybe will get blocked very
 soon.);
 end



 rule fluent network
   when
   eval(Server.Message8388608)#conditions
  then
   System.out.println(the current network is very good);#actions
 end











 ___
 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] Expert versus Expert

2011-04-15 Thread martindavid
Hi, thanks for the tips.
I wasn't aware of drools-server. There's not much documentation about it, 
especially how it can work with Guvnor in order to get the assets. Or maybe I 
wasn't able to find it.

Such a centralized approach makes sense to me, I hope it to be a reality soon.

David

- Mail Original -
De: Mark Proctor mproc...@codehaus.org
À: rules-users@lists.jboss.org
Envoyé: Jeudi 14 Avril 2011 16h07:10 GMT +01:00 Amsterdam / Berlin / Berne / 
Rome / Stockholm / Vienne
Objet: Re: [rules-users] Expert versus Expert

On 14/04/2011 09:11, delirii wrote:
 A few months ago a question was asked about the difference and the use case
 involving Drools Expert and Drools Guvnor.

 To be honest, it isn't clear for me too and as there wasn't any answer to
 this first question, so I'm trying to have an answer with your help :)

 What's clear :
 - Guvnor is a repository for the assets
 - The easiest (?) and certainly the mainly available as a tutorial solution
 is to create in each application an agent that grabs the assets and execute
 the whole thing in its own context.

 What's not clear :
 - how to centralize the execution in order to know exactly what's executed,
 by whom, and how (be able to log which facts are sent, to which rules, and
 be able to read the execution plan
 - if it exists a real stand alone centralized engine that match this need
 (Drools Expert ?)

 If some can explain this a little bit more, I'll be really happy to read !
 And if it can be added to the current documentation, it could be a great
 idea too.

I think that's fair. We don't have centralised management of expert 
runtime's yet. It's currently de-coupled via a pull mechanism.

Mark
 Thanks for your help.


 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Expert-versus-Expert-tp1739141p2819515.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] Expert versus Expert

2011-04-15 Thread Sébastien Raickman
This helped me for linking drools-server to Guvnor:

http://www.plugtree.com/drools-server-configuration-using-spring-3/

Best regards,

Seb

On Fri, Apr 15, 2011 at 11:39 AM, martinda...@free.fr wrote:

 Hi, thanks for the tips.
 I wasn't aware of drools-server. There's not much documentation about it,
 especially how it can work with Guvnor in order to get the assets. Or maybe
 I wasn't able to find it.

 Such a centralized approach makes sense to me, I hope it to be a reality
 soon.

 David

 - Mail Original -
 De: Mark Proctor mproc...@codehaus.org
 À: rules-users@lists.jboss.org
 Envoyé: Jeudi 14 Avril 2011 16h07:10 GMT +01:00 Amsterdam / Berlin / Berne
 / Rome / Stockholm / Vienne
 Objet: Re: [rules-users] Expert versus Expert

 On 14/04/2011 09:11, delirii wrote:
  A few months ago a question was asked about the difference and the use
 case
  involving Drools Expert and Drools Guvnor.
 
  To be honest, it isn't clear for me too and as there wasn't any answer to
  this first question, so I'm trying to have an answer with your help :)
 
  What's clear :
  - Guvnor is a repository for the assets
  - The easiest (?) and certainly the mainly available as a tutorial
 solution
  is to create in each application an agent that grabs the assets and
 execute
  the whole thing in its own context.
 
  What's not clear :
  - how to centralize the execution in order to know exactly what's
 executed,
  by whom, and how (be able to log which facts are sent, to which rules,
 and
  be able to read the execution plan
  - if it exists a real stand alone centralized engine that match this
 need
  (Drools Expert ?)
 
  If some can explain this a little bit more, I'll be really happy to read
 !
  And if it can be added to the current documentation, it could be a great
  idea too.
 
 I think that's fair. We don't have centralised management of expert
 runtime's yet. It's currently de-coupled via a pull mechanism.

 Mark
  Thanks for your help.
 
 
  --
  View this message in context:
 http://drools.46999.n3.nabble.com/Expert-versus-Expert-tp1739141p2819515.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


[rules-users] Planner and optional rules

2011-04-15 Thread ToTToRRo
Hello.

I'm working on a planning system and my customer is requesting to use a rule
engine. Of course, we are gonna use Drools and we are considering planner.

The customer already talked about having hard and soft constraints, however,
one request of the users is to enable them to inactivate specific
constraints for some specific one-shot calculation when required.

I've been thinking of using specific RuleFlows in order to not use the
different constraints selected by the user, but is seems a bit long and
risky as the number of selectable constraints could be high therefore
increasing the number of combination (RuleFlows) to write.

Is there any native solution to this issue knowing that performances are in
the spotlight as well?

Thanx in advance.

Nico

--
View this message in context: 
http://drools.46999.n3.nabble.com/Planner-and-optional-rules-tp2823955p2823955.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] Planner and optional rules

2011-04-15 Thread Geoffrey De Smet
In the examination example some data sets don't use some of the soft 
constraints.
Those soft constraint score rules are disabled because they start with a 
check on the InstitutionalWeighting singleton:

// Two exams in a row which share students
rule twoExamsInARow
 when
 $institutionalWeighting : 
InstitutionalWeighting(twoInARowPenality != 0)
 ... // real soft constraints
 then
 ...
end

IIRC, there's no measurable performance cost to this technique.

Op 15-04-11 11:53, ToTToRRo schreef:
 Hello.

 I'm working on a planning system and my customer is requesting to use a rule
 engine. Of course, we are gonna use Drools and we are considering planner.

 The customer already talked about having hard and soft constraints, however,
 one request of the users is to enable them to inactivate specific
 constraints for some specific one-shot calculation when required.

 I've been thinking of using specific RuleFlows in order to not use the
 different constraints selected by the user, but is seems a bit long and
 risky as the number of selectable constraints could be high therefore
 increasing the number of combination (RuleFlows) to write.

 Is there any native solution to this issue knowing that performances are in
 the spotlight as well?

 Thanx in advance.

 Nico

 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Planner-and-optional-rules-tp2823955p2823955.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


-- 
With kind regards,
Geoffrey De Smet


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


Re: [rules-users] Drools server and knowledge agent functionality

2011-04-15 Thread Esteban Aliverti
Hi.
You can configure a Knowledge Agent in Drools-Server using spring. You have
to declare it in knowledge-services.xml config file. You need to do
something like:

drools:kagent id=kagent1 kbase=kbase1 new-instance=false
 drools:resources
drools:resource  type=DRL
source=file:/some/path/to/apache-tomcat-7.0.6/webapps/drools-server/WEB-INF/classes/test.drl/
drools:resource  type=PKG source=
http://somehost:8080/droolg-guvnor/.../LATEST/
 /drools:resources
/drools:kagent

For configure the scan interval, you can use:

drools:resource-change-scanner id=s1 interval=5 /

There are, though, some caveats:

   - If you are deploying drools-server in tomcat, then you can't use
   classpath resources in the kagent. I have reported this problem today.
   - drools-server doesn't start ResourceChangeNotifierService
   nor ResourceChangeScannerService automatically. You need to hack some way to
   invoke ResourceFactory.getResourceChangeNotifierService().start();
   and ResourceFactory.getResourceChangeScannerService().start();. I was
   thinking in a Servlet that calls these methods in its init() method.

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


2011/4/15 Manuel Ortiz manuel.ortizra...@gmail.com

 Hello everybody:

 I am taking a look at Drools Integration documentation to understand how
 Drools server works and how can be used, and have a doubt concerning, let's
 say... 'KnowledgeAgent capabilities'. Does Drools server support on the fly
 rule updating as when using KnowledgeAgent to create KnowledgeBase objects?
 If it does, where can be configured 'KnowledgeAgent related' properties such
 as newInstance or resource scanner interval?

 Thank you in advance for your time.

 Kind regards,

 Manuel Ortiz.

 ___
 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] Simple rule and Query

2011-04-15 Thread DECOUX Yannick
I'am using 5.2.0-SNAPSHOT using maven from 
https://repository.jboss.org/nexus/content/groups/public/ and i can't make it 
work...
The query still return a size of 0...

Can you share your entire project with me ?

Thanks


De : Wolfgang Laun [mailto:wolfgang.l...@gmail.com]
Envoyé : jeudi 14 avril 2011 09:34
À : Rules Users List
Objet : Re: [rules-users] Simple rule and Query

This seems to be fixed for 5.2.x.:

declare Num
  num : Integer
end

rule sort
when
Integer( $i: intValue )
then
insert( new Num( $i ) );
end

query numbers
$a: Num( $b: num )
end


QueryResults qRes = session.getQueryResults( numbers );
System.out.println( result count:  + qRes.size() );
for( QueryResultsRow row: qRes ){
Object obj = row.get( $b );
System.out.println( $b= + obj.toString() );
}

This produces the expected results.

Calling getQueryResults with a string not denoting an existing query returns an 
empty result set. I've updated the javadoc - thanks.

-W




2011/4/14 DECOUX Yannick yannick.dec...@ucm.bemailto:yannick.dec...@ucm.be
query numbers
$a: Num( $b: num )
end
Hi everyone,

I'am still stuck with this simple example, anyone can tell me where to look or 
what I'm missing ?

Thanks
Yannick


De : DECOUX Yannick [mailto:yannick.dec...@ucm.bemailto:yannick.dec...@ucm.be]
Envoyé : mardi 5 avril 2011 07:52
À : rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org
Objet : [rules-users] Simple rule and Query

Hi,

I'am trying to use Query and i'am facing a little problem :
Given this simple rule :

package be.test.person
import be.test.person.*

query get adult
  adult : Adult( )
end

query get person
  person : Person( )
end

declare Adult
  name : String
end

rule A person over 18 is an adult
  when
Person( age = 18)
  then
System.out.println(Adult detected);
insert(new Adult());
end

Lets suppose one Person over 18 is inserted inside the working memory, the 
result of the query « get adult » is 0 (Please note the declaration of Adult 
type inside the rule)
If I create a Java class Adult (commenting the one in the .drl file) and then 
run the query again, this time the result is 1
Also, the signature of 
org.drools.runtime.rule.WorkingMemory.getQueryResults(String) says 
IllegalArgumentException when query is not found in the KnowledgeBase. This 
doesn't seems to be the case when I use a fake query name.
I'am using drools 5.1.1

Any idea on this ?

Thanks


___
rules-users mailing list
rules-users@lists.jboss.orgmailto: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