Semantic Web Drools Module, Request for Feedbak
by Xavier Breton
Hi,
I'm looking for feedback, I'll develop a Semantic Web Drools Module that
will be the subject of my Master Degree Tesis.
The idea is to use Eclipse Modelling Framework (EMF) for prototyping and
follow a Model Driven Architecture (MDA) where the source language is
Semantic of Business Vocabularies and Business Rules (SBVR) and the target
language is Drools DRL.
The mapping could be (PIM level):
- Semantic Web Rule Language (SWRL)
- Ontology Web Language (OWL)
- RuleML
- Rule Interchange Format (RIF)
- REWERSE Rule Markup Language (R2ML)
It could be added to the module at the source UML or Entity Relationship
like models to transform the models into SBVR.
Regards
Xavier Breton
10 years, 10 months
Attach custom editor on guided decision table cell
by c3310082
Hi,
We would like to render a custom editor when a user double-clicks on a cell
that is present in web guided decision table in Guvnor 5.1 (or later). The
custom editor needs to be invoked for cells that represent a particular fact
model attribute only.
This is somewhat similar to WS custom forms functionality available for
guided business rules.
So far we have seen the
org.drools.guvnor.client.decisiontable.GuidedDecisionTableWidget class that
contains implementation for:
public void onCellDblClick(GridPanel grid,
int rowIndex,
int colIndex,
EventObject e)
in the GridCellListenerAdapter class that opens up text editor or drop down
editor.
We're new to GWT and Guvnor so would appreciate it if anyone can provide the
high level steps.
Thanks
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Attach-custom-editor-...
Sent from the Drools - Dev mailing list archive at Nabble.com.
12 years, 2 months
Does not assign employee to shift in drool planner
by mkbhuktar
Hi all,
I am new bee to drool planner, and I am able to run couldbalancing
example,and now i am try to develop my own example.
Problem::::
I have shift and employee i would like to employee whose prefferdShift is
equal to the shiftType.So that I was create domain classes as follow
Shift--------planning entity class
Employee
EmployeeRoster -----Solution class
=====================================Shift.java====================
package com.drools.planner.domain;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.drools.planner.api.domain.entity.PlanningEntity;
import org.drools.planner.api.domain.solution.PlanningEntityProperty;
import org.drools.planner.api.domain.variable.PlanningVariable;
import org.drools.planner.api.domain.variable.ValueRange;
import org.drools.planner.api.domain.variable.ValueRangeType;
import com.drools.planner.comparator.EmployeeStrenghtComparator;
import com.drools.planner.comparator.ShiftDifficultyComparator;
@PlanningEntity(difficultyComparatorClass = ShiftDifficultyComparator.class)
public class Shift {
private int id;
private String shiftType;
//employee is plannign entity variable
private Employee employee;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getShiftType() {
return shiftType;
}
public void setShiftType(String shiftType) {
this.shiftType = shiftType;
}
public String getPrefferdShift()
{
return employee.getPrefferedShift();
}
@SuppressWarnings("restriction")
@PlanningVariable(strengthComparatorClass=EmployeeStrenghtComparator.class)
@ValueRange(type=ValueRangeType.FROM_SOLUTION_PROPERTY,solutionProperty="employeeList")
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
public Shift clone()
{
Shift clone=new Shift();
clone.employee=employee;
clone.id=id;
clone.shiftType=shiftType;
return clone;
}
public boolean SolutionEquals(Object o)
{
if(this==o)
{
return true;
}else if(this instanceof Shift)
{
Shift other =new Shift();
return new EqualsBuilder()
.append(id, other.id)
.append(employee, other.employee)
.append(shiftType,other.shiftType).isEquals();
}else
{
return false;
}
}
public int solutionHashCode() {
return new HashCodeBuilder()
.append(id)
.append(employee)
.toHashCode();
}
}
===============================Employee.java===================
package com.drools.planner.domain;
public class Employee {
private int id;
private String name;
private String prefferedShift;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPrefferedShift() {
return prefferedShift;
}
public void setPrefferedShift(String prefferedShift) {
this.prefferedShift = prefferedShift;
}
}
=================================EmployeeRoster.java==========================
package com.drools.planner.domain;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import
org.drools.planner.api.domain.solution.PlanningEntityCollectionProperty;
import org.drools.planner.core.score.buildin.hardandsoft.HardAndSoftScore;
import org.drools.planner.core.solution.Solution;
public class EmployeeRoster implements Solution<HardAndSoftScore> {
private int id;
private List<Shift> shiftList;
private List<Employee> employeeList;
private HardAndSoftScore score;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@PlanningEntityCollectionProperty
public List<Shift> getShiftList() {
return shiftList;
}
public void setShiftList(List<Shift> shiftList) {
this.shiftList = shiftList;
}
public List<Employee> getEmployeeList() {
return employeeList;
}
public void setEmployeeList(List<Employee> employeeList) {
this.employeeList = employeeList;
}
@Override
public EmployeeRoster cloneSolution() {
EmployeeRoster employeeRoster=new EmployeeRoster();
employeeRoster.id=id;
employeeRoster.shiftList=shiftList;
employeeRoster.employeeList=employeeList;
employeeRoster.score=score;
return employeeRoster;
}
@Override
public Collection<? extends Object> getProblemFacts() {
ArrayList face=new ArrayList();
face.add(shiftList);
return face;
}
@Override
public HardAndSoftScore getScore() {
return score;
}
@Override
public void setScore(HardAndSoftScore score) {
this.score=score;
}
}
========================my rule file is====================
//created on: Aug 31, 2012
package com.drool.planner.resourse
//list any import classes here.
dialect "java"
import
org.drools.planner.core.score.buildin.hardandsoft.HardAndSoftScoreHolder;
import org.drools.planner.core.score.constraint.IntConstraintOccurrence;
import org.drools.planner.core.score.constraint.ConstraintType;
import com.drools.planner.domain.Shift;
import com.drools.planner.domain.Employee;
//declare any global variables here
global HardAndSoftScoreHolder scoreHolder;
rule "requireEmployeeShift"
when
$e:Employee($prefferedShift:prefferedShift)
exists Shift(employee==$e && shiftType==$prefferedShift)
then
insertLogical(new IntConstraintOccurrence("periodDurationTooShort",
ConstraintType.NEGATIVE_HARD,
1));
end
rule "hardConstraintsBroken"
salience -1 // Do the other rules first (optional, for performance)
when
$hardTotal : Number() from accumulate(
IntConstraintOccurrence(constraintType ==
ConstraintType.NEGATIVE_HARD, $weight : weight),
sum($weight) // Vote for
http://jira.jboss.com/jira/browse/JBRULES-1075
)
then
scoreHolder.setHardConstraintsBroken($hardTotal.intValue());
end
=======================================================================
when I run my application I dose not get proper output
Shift ID Shift Type Employee Preffered Shift
0 night sachin night
1 evening shahid morning
2 morning shahid morning
please give me some hint about this problem
--
View this message in context: http://drools.46999.n3.nabble.com/Does-not-assign-employee-to-shift-in-dr...
Sent from the Drools: Developer (committer) mailing list mailing list archive at Nabble.com.
12 years, 3 months