Re: [rules-users] Bad Gateway at http://www.jboss.org/drools
Thanks. -- View this message in context: http://drools.46999.n3.nabble.com/Bad-Gateway-at-http-www-jboss-org-drools-tp4022614p4022650.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] Bad Gateway at http://www.jboss.org/drools
I can't access http://www.jboss.org/drools http://www.jboss.org/drools for two days :-( The error message is sjown: Bad Gateway We're experiencing a problem with one of the servers behind our gateway. Please try again in a while. -- View this message in context: http://drools.46999.n3.nabble.com/Bad-Gateway-at-http-www-jboss-org-drools-tp4022614.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
I updated Drools plug-in and currently the error is not shown. -- View this message in context: http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3554176.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
I am still wondering why the following query doesn't work: query sortFactsQuery1 $tm: TreeMap() from accumulate( $f: Fact(), init( TreeMap map = new TreeMap(); ), action( map.put(factKey($f), $f); ), reverse( map.remove(factKey($f)); ), result( map ) ) $sortedFacts: Collection() from $tm.values() end -- View this message in context: http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3554200.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
Thank you! Quite clear -- View this message in context: http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3555087.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
You are right. Your query is better -- View this message in context: http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3551056.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
But I didn't check when I answered: [ERR 101] Line 34:31 no viable alternative at input ')' in query sortFactsQuery1 in pattern TreeMap I tried: query sortFactsQuery1 $tm: TreeMap() from accumulate( $f: Fact(), init( TreeMap map = new TreeMap(); ), action( map.put(factKey($f), $f); ), reverse( map.remove(factKey($f)); ), result( map ) ) $sortedFacts: Collection() from $tm.values() end It doesn't return any results. But the following query works: query sortFactsQuery2 $tm: TreeMap() from accumulate( $f: Fact(), init( TreeMap map = new TreeMap(); ), action( map.put(factKey($f), $f); ), reverse( map.remove(factKey($f)); ), result( map ) ) $sortedFacts: List() from accumulate( $f: Fact() from $tm.values(), collectList( $f ) ) end -- View this message in context: http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3551208.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
Sorry, I didn't want to blame you. I have to agree. Your query works, I have just run it. But eclipse shows the error given above. Probably, I have some problems with environment. -- View this message in context: http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3552224.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
I don't want to sort facts outside of drools rules. The sorting is part of business requirements. My opinion is that is not a good thing to keep parts of business logic in different places. I spent some time to figure out how it is possible to sort a collection of facts and here is my solution: --- function String factKey(Fact f) { return String.format( %010d~~%s~~%s, f.getRank(), f.getName(), f.getValue() ); } query sortFactsQuery $factsMap: HashMap() from accumulate( $f: Fact(), init( HashMap map = new HashMap(); ), action( map.put(factKey($f), $f); ), reverse( map.remove(factKey($f)); ), result( map ) ) $sortedKeyList: TreeSet() from collect( String() from $factsMap.keySet() ) $sortedFacts: List() from accumulate( $key: String() from $sortedKeyList, collectList( $factsMap.get( $key ) ) ) end --- -- View this message in context: http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3541805.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] Call query from other query
I read in Drools guide, that queries can now call other queries. But the guide doesn't give much details, mostly paying attention to a rather specific case. I have two queries having common parts and try to figure out how to get rid of duplicate code. Here is the simplified form of queries I'd like to have: - query query1 $facts: List() from collect( Fact( name == name1 ) ) end query query2 $l: List() from collect( Fact( value == 1 ) from ?query1() ) end - query2 syntax is invalid and and it is not clear for me how $facts from query1 can be accessed in query2. -- View this message in context: http://drools.46999.n3.nabble.com/Call-query-from-other-query-tp3542082p3542082.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] facts custom sort
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] decision tables and default rules for case when part of LHS failes for other rules
First I wanted to add parameters from condition 1 column to a session and to add condition which makes default rule true if no parameter in session is equal to an entry argument. But I couldn't find a way to add a parameter from a condition expression to a session. Is it possible? -- View this message in context: http://drools.46999.n3.nabble.com/decision-tables-and-default-rules-for-case-when-part-of-LHS-failes-for-other-rules-tp3162872p3165180.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] decision tables and default rules for case when part of LHS failes for other rules
In fact, I don't need to have default values if no values were found. I need default values if part of LHS is never true. If I have the rule: rule rule_11 when Object1( constraint1 ) Object2( constraint2 ) then insert(new Result()); end I'd like to have rule applying when Object1( constraint1 ) fails. In decision table. -- View this message in context: http://drools.46999.n3.nabble.com/decision-tables-and-default-rules-for-case-when-part-of-LHS-failes-for-other-rules-tp3162872p3165787.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] decision tables and default rules for case when part of LHS failes for other rules
Yes. The rule is good for DRL. But I need to have it in decision table. -- View this message in context: http://drools.46999.n3.nabble.com/decision-tables-and-default-rules-for-case-when-part-of-LHS-failes-for-other-rules-tp3162872p3166650.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] decision tables and default rules for case when part of LHS failes for other rules
It doesn't suit :( A blank column causes an action applies additionally. But I need it applies only if no other conditions from first column is true. -- View this message in context: http://drools.46999.n3.nabble.com/decision-tables-and-default-rules-for-case-when-part-of-LHS-failes-for-other-rules-tp3162872p3163069.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] decision tables and default rules for case when part of LHS failes for other rules
It is in XLS decision table. -- View this message in context: http://drools.46999.n3.nabble.com/decision-tables-and-default-rules-for-case-when-part-of-LHS-failes-for-other-rules-tp3162872p3163227.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