Drools JBoss World 2010.odp

All things Artificial Intelligence related: Rules, Processes, Events, Agents, Planning, Ontologies and more :)
Drools JBoss World Presentation Slides
Unstructured, Ad-Hoc Processes
Browser Based BPMN2 Authoring in Drools Guvnor (see video)
Write Drools Books - Packt Publishing.
AI Research Overview
Submission deadline for RuleML-2010 research papers in 3 days
Submission Deadline Approaching
RuleML-2010
4th International Web Rule Symposium:
Research Based and Industry Focused
Paper submission deadline: June 11, 2010
http://2010.ruleml.org/
October 21-23, 2010, Washington, DC, USA
collocated with the Business Rules Forum, the Business Analysis Forum and the Business Process Forum
Proceedings: Springer LNCS volume
Post-proceedings: Selected papers from the symposium will be published in the *International Journal of Cooperative Information
Systems* (World Scientific) and in *Artificial Intelligence and Law* (Springer).
Registration: all W3C, OASIS, OMG, ECCAI, and EPTS members will receive a 15% discount for the registration fee.
RuleML Submission Deadline in 3 days
$m : Message( routingValue str[startsWith] "R1" )
$m : Message( routingValue str[endsWith] "R2" )
$m : Message( routingValue str[length] 17 )
public class StrEvaluatorDefinition implements EvaluatorDefinition {
public static final Operator STR_COMPARE = Operator.addOperatorToRegistry(
"str", false);
public static final Operator NOT_STR_COMPARE = Operator
.addOperatorToRegistry("str", true);
private static final String[] SUPPORTED_IDS = { STR_COMPARE
.getOperatorString() };
public enum Operations {
startsWith, endsWith, length;
}
private Evaluator[] evaluator;
@Override
public Evaluator getEvaluator(ValueType type, Operator operator) {
return this.getEvaluator(type, operator.getOperatorString(), operator
.isNegated(), null);
}
@Override
public Evaluator getEvaluator(ValueType type, Operator operator,
String parameterText) {
return this.getEvaluator(type, operator.getOperatorString(), operator
.isNegated(), parameterText);
}
@Override
public Evaluator getEvaluator(ValueType type, String operatorId,
boolean isNegated, String parameterText) {
return getEvaluator(type, operatorId, isNegated, parameterText,
Target.FACT, Target.FACT);
}
@Override
public Evaluator getEvaluator(ValueType type, String operatorId,
boolean isNegated, String parameterText, Target leftTarget,
Target rightTarget) {
StrEvaluator evaluator = new StrEvaluator(type, isNegated);
evaluator.setParameterText(parameterText);
return evaluator;
}
@Override
public String[] getEvaluatorIds() {
return SUPPORTED_IDS;
}
@Override
public Target getTarget() {
return Target.FACT;
}
@Override
public boolean isNegatable() {
return true;
}
@Override
public boolean supportsType(ValueType type) {
return true;
}
@Override
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
evaluator = (Evaluator[]) in.readObject();
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(evaluator);
}
...
}
this after[0, 3m] $t
public static class StrEvaluator extends BaseEvaluator {
private Operations parameter;
public void setParameterText(String parameterText) {
this.parameter = Operations.valueOf(parameterText);
}
public Operations getParameter() {
return parameter;
}
public StrEvaluator(final ValueType type, final boolean isNegated) {
super(type, isNegated ? NOT_STR_COMPARE : STR_COMPARE);
}
@Override
public boolean evaluate(InternalWorkingMemory workingMemory,
InternalReadAccessor extractor, Object object, FieldValue value) {
final Object objectValue = extractor
.getValue(workingMemory, object);
switch (parameter) {
case startsWith:
return this.getOperator().isNegated() ^ (((String)objectValue).startsWith( (String)value.getValue() ));
case endsWith:
return this.getOperator().isNegated() ^ (((String)objectValue).endsWith( (String)value.getValue() ));
case length:
return this.getOperator().isNegated() ^ (((String)objectValue).length() == ((Long) value.getValue()).longValue() );
default:
throw new IllegalAccessError("Illegal str comparison parameter");
}
}
...
}
KnowledgeBuilderConfiguration builderConf = KnowledgeBuilderFactory
.newKnowledgeBuilderConfiguration();
builderConf.setOption(EvaluatorOption.get("str",
new StrEvaluatorDefinition()));
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder(builderConf);
rule routeToR1
when
$m : Message( routingValue str[startsWith] "R1" )
then
# routing to destination R1
end
rule routeToDefault
when
$m : Message( routingValue not str[startsWith] "R1" )
then
# routing to default destination
end
rule routeToSpecial
when
$m : Message( routingValue str[startsWith] "R1" && str[endsWith] "R2" && str[length] 17)
then
# routing to super special destination
end
Creating pluggable operators
Planner benchmarker: summary bar chart