Professional Documents
Culture Documents
Introduction To Drools: Dr. Adrian Giurca Brandenburg University of Technology Cottbus, Germany
Introduction To Drools: Dr. Adrian Giurca Brandenburg University of Technology Cottbus, Germany
Introduction To Drools: Dr. Adrian Giurca Brandenburg University of Technology Cottbus, Germany
Introduction to Drools
package org.btu.it.userv.vocabulary;
// properties
//default constructor
public YoungDriver(){
}
//setters and getters for the properties
}
// Rules
To do:
– Download Drools
– Use it. Make running an
example from their library
For example:
For example:
$driver:Driver(age < 25)
YoungDriver(maritalStatus == MaritalStatus.MARRIED)
uses the getMaritalStatus() method on the YoungDriver
instance.
For example:
eval(isApprovedByManager($client, $vip))
supposing
isApprovedByManager() be a Boolean function.
For example:
$item : OrderItem( value > 100 ) from $order.items
$item is bounded sequentially to all OrderItem objects
with value greater than 100 from the list $order.items
$drivers : ArrayList()
from
collect(
Driver( gender == 'F', noOfAccidents > 0 )
from $town.getDrivers() )
• Is a form of collect
• Allows a rule to iterate over a collection of objects, executing
custom actions for each of the elements, and at the end
return a result object.