Re: [rules-users] How to find rules, that use special fields in their Condition

2013-05-06 Thread mdzaebel
Drools-Verifier is interesting, as it uses rules to verify rules. However, I
solved the problem using DrlParser.parse(...).getRules() but your hint about
constraints and Descrs guided me. 

Thanks, Marc



--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-find-rules-that-use-special-fields-in-their-Condition-tp4023673p4023696.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] How to find rules, that use special fields in their Condition

2013-05-03 Thread mdzaebel
Hi,

the following code traverses rules and their conditions. However, I did not
find a method to find conditions, that match over a certain field of a
declared class. I know, that the rule API should be hidden for good reasons
(Mark Proctor).

for(Rule ruleDef : kb.getKnowledgePackages().iterator().next().getRules()) {
for(RuleConditionElement rce :
((RuleImpl)ruleDef).getRule().getLhs().getChildren()) {
for(Map.EntryString, Declaration entry :
rce.getInnerDeclarations().entrySet()) {
??

Thanks, Marc







--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-find-rules-that-use-special-fields-in-their-Condition-tp4023673.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] To group some objects by type

2013-02-08 Thread mdzaebel
Mister Nono wrote
 ... only the last car is in the TreeMap

Thats why I said /you need Lists or Maps as values of the TreeMap/.

*Here is fast solution:*
import Vehicle
import java.util.*
rule Print grouped vehicles
when  $map : Map() from accumulate ($v : Vehicle($w : wheels), 
init(TreeMap map=new TreeMap()), 
action( if(map.containsKey($w)) 
((List)map.get($w)).add($v); 
else map.put($w, new 
ArrayList(Arrays.asList($v)));),
result(map))
then  System.out.println($map);
end



--
View this message in context: 
http://drools.46999.n3.nabble.com/To-group-some-objects-by-type-tp4022085p4022167.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] To group some objects by type

2013-02-08 Thread mdzaebel
see expert documentation for *accumulate*



--
View this message in context: 
http://drools.46999.n3.nabble.com/To-group-some-objects-by-type-tp4022085p4022173.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] Extending declared imported type

2013-02-06 Thread mdzaebel
This bug was just resolved by /Mario Fusco/ in an impressive time!



--
View this message in context: 
http://drools.46999.n3.nabble.com/Extending-declared-imported-type-tp4022068p4022088.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] To group some objects by type

2013-02-06 Thread mdzaebel
global java.util.TreeMap vehicles
rule ... when v:Vehicle() then vehicles.put(v.wheels, v);

/Marc/



--
View this message in context: 
http://drools.46999.n3.nabble.com/To-group-some-objects-by-type-tp4022085p4022089.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] To group some objects by type

2013-02-06 Thread mdzaebel
well, you need Lists or Maps as values of the TreeMap



--
View this message in context: 
http://drools.46999.n3.nabble.com/To-group-some-objects-by-type-tp4022085p4022090.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] Extending declared imported type

2013-02-05 Thread mdzaebel
/Hi,/

I just tested the following documented .drl example:

*import org.people.Person
declare Person end
declare Student extends Person end* / // this line leads to NPE /
...

Any tip appreciated.

See also issue  DROOLS-27 https://issues.jboss.org/browse/DROOLS-27  .

/Thanks, Marc/




--
View this message in context: 
http://drools.46999.n3.nabble.com/Extending-declared-imported-type-tp4022068.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] How to import query or class in .drl to another .drl

2013-02-05 Thread mdzaebel
Hi,

may be set /Allow cross references in DRL files/ in Eclipse Drools
Preferences.

Marc



--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-import-query-or-class-in-drl-to-another-drl-tp4022069p4022070.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