Re: [rules-users] Calling drools from Javascript

2011-11-26 Thread Michael Anstis
If you can choose the Java Script engine, ie it is not necessarily a
browser implementation, you could try Mozilla Rhino - which AFAIK is the
basis of Java 6's scripting implementation.

If the Java Script application is client side in a browser use of a web
service of some description would be the normal solution.

sent on the move

On 26 Nov 2011 19:20, "ihabo01"  wrote:

> Hello all,
>
> I have a JS application and I would like to know if there is a simple way
> to
> call and execute a .drl file from it?
>
> Regards,
>
> Ihab
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Calling-drools-from-Javascript-tp3538585p3538585.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] Calling drools from Javascript

2011-11-26 Thread ihabo01
Hello all,

I have a JS application and I would like to know if there is a simple way to
call and execute a .drl file from it?

Regards,

Ihab



--
View this message in context: 
http://drools.46999.n3.nabble.com/Calling-drools-from-Javascript-tp3538585p3538585.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] facts custom sort

2011-11-26 Thread Wolfgang Laun
You can have a rule fire repeatedly according to a numeric fact property:

rule "Rule 03"
salience (- $intValue)
when
   $number: Number( $intValue: intValue )
then
   System.out.println("Number found with value: "+$intValue() );
end

You can't do this with a query. Use some Java method for sorting the
collection of facts.

Both techniques (not/retract and salience) result in algorithms that
perform considerably worse than the best custom sort algorithms.

-W

On 26 November 2011 18:37, Syargey  wrote:

> Hello all,
>
> I experienced a problem I can't solve.
>
> After rules firing I got a number of facts of certain type.
>
> I would like to get a collection of facts sorted by custom field with a
> query.
>
> Drools guide proposes to sort facts by a rule like:
>
> rule "Rule 03"
> when
>$number : Number( )
>not Number( intValue < $number.intValue )
> then
>System.out.println("Number found with value: "+$number.intValue() );
>retract( $number );
> end
>
> But it doesn't suit me:
> 1) I can't retract facts from session
> 2) I need to get sorted collection with a query which doesn't have 'then'
> part.
>
> Is there any method to get custom sorted collection with a query?
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3538410.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] facts custom sort

2011-11-26 Thread Syargey
Hello all,

I experienced a problem I can't solve.

After rules firing I got a number of facts of certain type.

I would like to get a collection of facts sorted by custom field with a
query.

Drools guide proposes to sort facts by a rule like:

rule "Rule 03"   
when
$number : Number( )
not Number( intValue < $number.intValue )
then
System.out.println("Number found with value: "+$number.intValue() ); 
retract( $number );
end

But it doesn't suit me:
1) I can't retract facts from session
2) I need to get sorted collection with a query which doesn't have 'then'
part.

Is there any method to get custom sorted collection with a query?



--
View this message in context: 
http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3538410.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] Guvnor hates me

2011-11-26 Thread Michael Anstis
Guvnor only adds fields with "getters" for use in the LHS (and "setters"
for use in the RHS).

Ideally the field would be a Java enumeration (that Guvnor would allow use
of). Alternatively you can define a "Guvnor enumeration" for the field in
question.

Please feel free to raise a JIRA (https://issues.jboss.org/browse/GUVNOR)
requesting enhancement for public static fields.

2011/11/25 Ronald Albury 

> New Issue:
>
> My Message class has an int field (status) and several "public static
> final int" values representing possibile statuses.  I am trying to use the
> directed rules editor to create a rule when clause: There is a Message with
> status equal to Message.SOME_STATUS.
>
> I don't see any way to do this.  I can put in a constant value, or a
> free-form formula - neither is what I want.  I tried to use the
> 'expression' editor, but all I got was an empty drop-down with the
> directive 'Choose.."
>
> Where do I go from here?
>
> ___
> 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] duration attribute & other rule language features issue

2011-11-26 Thread Wolfgang Laun
Rule timers using int: or cron: work pretty much as described in the Expert
documentation.

With 5.1.1, there was an issue with timer(int:...) due to a parser bug, see
JBRULES-2778 

Also, @expires with declare is working. Notice, though, that it is not
alway immediately apparent why a fact is not retracted after the indicated
time. Please provide a full working example where you find that it does not
work.

-W


2011/11/25 Prashant Badhe 

> Hi,
>
> we were using drools engine 5.0.1 version with rules having 'duration',
> 'agenda-group' attributes and now we want to upgrade drools engine to 5.1.1
> or latest 5.3.0 but we find 'duration' feature not working. What are the
> equivalents of those features in 5.1.1 and in 5.3.0?
>
>
> From drools-expert document, 'duration' seems as deprecated with 'timer'.
> But even 'timer' is not working. Putting 'timer' attribute as:
>
>
> rule "test timer attribute"
> agenda-group "enrichment"
> auto-focus true
> no-loop
> salience 140
> timer ( int: 5s )
> //duration ( 5000 )
> when
>   ..
>then
>  ..
>end
>
> gives "Error: java.lang.ArrayStoreException" Drools compilation error.
> "timer ( 5s )" compiles, but the rule never fires.
>
> We are also planning to use @expires in declare. But facts are not seems
> to be expiring.
>
> What am I missing here? What are the equivalent for 'duration' in
> 5.1.1/5.3.0 and how to use @expires in declare?
> Please point us to some sample rules that uses these semantics and are
> working.
>
> Thanks in advance,
> Prashant B.
>
> ___
> 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