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
                                
                         
                        
                                
                                11 years, 8 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.
                                
                         
                        
                                
                                13 years
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Guided Editor in BRMS / Guvnor Version 5 (Snapshot of 26 June)
                                
                                
                                
                                    
                                        by Paul Browne
                                    
                                
                                
                                        Folks,
For various reasons I'm trying out the Guided Editor for Business Rules in
the Guvnor Version 5 (Snapshot of 26 June from Hudson, deployed on JBoss App
Server 4.2.2GA).
I've created the Package / Category and uploaded a simple fact model (as
works in BRMS version 4). I create a new business rule using the guided
editor and the screen shows successfully with both 'When' and 'Then'
parts.Assume the next question is due to me missing something, but wanted to
double check:
When I press the green '+' to the right of the screen I am shown the message
/ dialog layer saying '
*Add a condition to the rule... *or* Add an action to the rule.
*Problem is that there doesn't appear to be a way of adding a condition or
action. The only thing I'm seeing in the logs is
* (Contexts.java:flushAndDestroyContexts:335)         could not discover
transaction status
*Am I missing something or should I come back to Guvnor later in the
development Cycle?
Thanks
Paul
                                
                         
                        
                                
                                13 years, 7 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Drools on android
                                
                                
                                
                                    
                                        by Justin King
                                    
                                
                                
                                        Hi All,
I'm wondering if anyone has tried to use drools in a google android
application, and if so what problems did you have? I'd also be interested to
know if its even possible!
Thanks!
-- 
Regards,
Justin King
PhD Candidate
Faculty of Information and Communication Technologies
Swinburne University of Technology
http://www.ict.swin.edu.au/ictstaff/justinking
-- 
Regards,
Justin King
PhD Candidate
Faculty of Information and Communication Technologies
Swinburne University of Technology
http://www.ict.swin.edu.au/ictstaff/justinking
                                
                         
                        
                                
                                13 years, 10 months
                        
                        
                 
         
 
        
            
        
        
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Ant Work Item
                                
                                
                                
                                    
                                        by Mark Proctor
                                    
                                
                                
                                        I saw this jira and thought it's a nice idea:
https://issues.jboss.org/browse/JBRULES-2445
Should be able to select either build.xml files on a path/classpath or 
paste in a xml. The GUI should  show targets and other information (xml 
comments doc etc) and allow targets to be selected with variable 
assignments for execution.
Any takers?
Mark
                                
                         
                        
                                
                                14 years, 4 months
                        
                        
                 
         
 
        
            
        
        
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Planner design naming: phasing
                                
                                
                                
                                    
                                        by Geoffrey De Smet
                                    
                                
                                
                                        Once I introduce phasing, it will be possible to configure 2 or more 
sequential solver algorithms in planner, for example:
   Solver algorithm 1 = First Fit Decreasing (for initialization)
   Solver algorithm 2 = Simulated Annealing (after initialization)
   Solver algorithm 3 = Tabu search (when things get really hard)
I see 2 ways of naming these concepts.
What do you consider better? Or do you see a better alternative?
Alternative 1: A Solver has Phases
There is only 1 Solver, with the .solve() method, which is external API.
A Solver is constructed from a SolverConfiguration.
The Solver has n Phases.
A Phase is a solver algorithm implementation (for example tabu search).
A Phase also has a .solve() method, but that's internal API.
Alternative 2: A Planner has Solvers.
There is only 1 Planner, with the .solve() method, which is external API.
A Planner is constructed from a PlannerConfiguration.
The Planner has n Solvers.
A Solver is a solver algorithm implementation (for example tabu search).
A Solver also has a .solve() method, but that's internal API.
-- 
With kind regards,
Geoffrey De Smet
                                
                         
                        
                                
                                14 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Planner big user impacting changes: declarative metamodel
                                
                                
                                
                                    
                                        by Geoffrey De Smet
                                    
                                
                                
                                        Hi guys
For Drools Planner 5.3.0 (not the upcoming release)
I am working on a separate branch [1] to allow Planner to understand 
your domain model better.
*This will force some big changes upon you as a user*, but it will also 
allow many new features.
Reading and replying to this mail is your chance to steer those changes, 
and verify that they are a good thing for your implementation too.
I'll push those changes to master in a day or 2 ... unless someone finds 
a good reason not too.
Any feed-back, especially on concept names, is welcome.
*The Bad News*
You'd have to do some serious upgrading changes. Although I am confident 
this can be done in an hour or 2.
Here is the upgrading recipe as in github. Please go through to this 
list to understand the impact of these changes.
Once the changes are on master, I 'll update the reference manual.
[MAJOR] You need to define your solution class in the configuration now:
Before in *SolverConfig.xml and *BenchmarkConfig.xml:
<localSearchSolver>
<scoreDrl>...</scoreDrl>
After in *SolverConfig.xml and *BenchmarkConfig.xml:
<localSearchSolver>
<solutionClass>org.drools.planner.examples.curriculumcourse.domain.CurriculumCourseSchedule</solutionClass>
<scoreDrl>...</scoreDrl>
[RECOMMENDED] Understand the concept of a "planning entity" class.
The class (or classes) that change during planning (and do not implement 
Solution) are a planning entity.
For example: ShiftAssignment, BedDesignation, Queen, CloudAssignment, ...
The other domain classes are considered normal planning facts,
for example Shift, Employee, Bed, Room, Department, ...
They do not change during planning (at least not without pausing the 
solver).
Read the manual to understand the "planning entity" concept better.
[MAJOR] You need to define your planning entity class(es) in the 
configuration now:
Before in *SolverConfig.xml and *BenchmarkConfig.xml:
<localSearchSolver>
<solutionClass>....</solutionClass>
<scoreDrl>...</scoreDrl>
After in *SolverConfig.xml and *BenchmarkConfig.xml:
<localSearchSolver>
<solutionClass>....</solutionClass>
<planningEntityClass>org.drools.planner.examples.curriculumcourse.domain.Lecture</planningEntityClass>
<scoreDrl>...</scoreDrl>
[MAJOR] You need to annotate your planning entity class(es) with the 
@PlanningEntity annotation
Before in *.java:
     public class Lecture ... {
         ...
     }
After in *.java:
     @PlanningEntity
     public class Lecture ... {
         ...
     }
[RECOMMENDED] Understand the concept of a "planning variable" property.
The property (or properties) on a planning entity class that are changed 
(through their setter) during planning
are planning variables.
For example: ShiftAssignment.getEmployee(), BedDesignation.getBed(), 
Queen.getY(), ...
Note that most planning entities have 1 property which defines the 
planning entity
and that property is NOT a planning variable.
For example: ShiftAssignment.getShift(), 
BedDesignation.getAdmissionPart(), Queen.getX(), ...
Read the manual to understand the "planning variable" concept better.
[MAJOR] You need to annotate your planning variable property(ies) with 
the @PlanningVariable annotation.
Furthermore, you need to annotate a @ValueRange* annotation on to define 
the allowed values.
Commonly, you 'll use @ValueRangeFromSolutionProperty which specifies a 
property name on the solution
which returns a collection of the allowed values for that variable.
Before in *.java:
     @PlanningEntity
     public class Lecture ... {
         private Course course;
         private int lectureIndexInCourse;
         // Changed by moves, between score calculations.
         private Period period;
         private Room room;
         public Course getCourse() {...}
         public void setCourse(Course course) {...}
         public int getLectureIndexInCourse() {...}
         public void setLectureIndexInCourse(int lectureIndexInCourse) {...}
         public Period getPeriod() {...}
         public void setPeriod(Period period) {...}
         public Room getRoom() {...}
         public void setRoom(Room room) {...}
         ...
         public int getStudentSize() {
             return course.getStudentSize();
         }
         public Day getDay() {
             return period.getDay();
         }
     }
After in *.java:
     @PlanningEntity
     public class Lecture ... {
         private Course course;
         private int lectureIndexInCourse;
         // Changed by moves, between score calculations.
         private Period period;
         private Room room;
         // This is not a PlanningVariable: it defines the planning entity
         public Course getCourse() {...}
         public void setCourse(Course course) {...}
         // This is not a PlanningVariable: it defines the planning entity
         public int getLectureIndexInCourse() {...}
         public void setLectureIndexInCourse(int lectureIndexInCourse) {...}
         @PlanningVariable
         @ValueRangeFromSolutionProperty(propertyName = "periodList")
         public Period getPeriod() {...}
         public void setPeriod(Period period) {...}
         @PlanningVariable
         @ValueRangeFromSolutionProperty(propertyName = "roomList")
         public Room getRoom() {...}
         public void setRoom(Room room) {...}
         ...
         // This is not a PlanningVariable: no setter
         public int getStudentSize() {
             return course.getStudentSize();
         }
         // This is not a PlanningVariable: no setter
         public Day getDay() {
             return period.getDay();
         }
     }
[MAJOR] Annotate every property on your Solution that returns a 
collection of planning entities
with @PlanningEntityCollectionProperty.
Before in *.java:
     public class CurriculumCourseSchedule ... implements Solution<...> {
         private List<Lecture> lectureList;
         ...
         public List<Lecture> getLectureList() {...}
         public void setLectureList(List<Lecture> lectureList) {...}
     }
After in *.java:
     public class CurriculumCourseSchedule ... implements Solution<...> {
         private List<Lecture> lectureList;
         ...
         @PlanningEntityCollectionProperty
         public List<Lecture> getLectureList() {...}
         public void setLectureList(List<Lecture> lectureList) {...}
     }
[MAJOR] The method getFacts() has been removed from the Solution interface.
Annotate every property that returns a fact or fact collection with the 
@PlanningFactProperty
or @PlanningFactCollectionProperty annotation respectively,
except those already annotated with @PlanningEntityCollectionProperty.
Properties annotated with these annotations are inserted into the 
working memory as facts:
- @PlanningFactProperty
- @PlanningFactCollectionProperty: each element in the collection
- @PlanningEntityCollectionProperty: each planning entity in the 
collection that is initialized
Remove the getFacts() method.
Before in *.java:
     public class ... implements Solution<...> {
         private InstitutionalWeighting institutionalWeighting;
         private List<Teacher> teacherList;
         private List<Curriculum> curriculumList;
         ...
         private List<UnavailablePeriodConstraint> 
unavailablePeriodConstraintList;
         private List<Lecture> lectureList;
         private HardAndSoftScore score;
         ...
         public String getName() {...}
         public InstitutionalWeighting getInstitutionalWeighting() {...}
         public List<Teacher> getTeacherList() {...}
         public List<Curriculum> getCurriculumList() {...}
         ...
         public List<UnavailablePeriodConstraint> 
getUnavailablePeriodConstraintList() {...}
         @PlanningEntityCollectionProperty
         public List<Lecture> getLectureList() {...}
         public ...Score getScore() {...}
         public Collection<? extends Object> getFacts() {
             List<Object> facts = new ArrayList<Object>();
             facts.addAll(teacherList);
             facts.addAll(curriculumList);
             ...
             facts.addAll(unavailablePeriodConstraintList);
             if (isInitialized()) {
                 facts.addAll(lectureList);
             }
             facts.addAll(calculateTopicConflictList());
             return facts;
         }
         public List<TopicConflict> calculateTopicConflictList() {...}
     }
After in *.java:
     public class ... implements Solution<...> {
         private InstitutionalWeighting institutionalWeighting;
         private List<Teacher> teacherList;
         private List<Curriculum> curriculumList;
         ...
         private List<UnavailablePeriodConstraint> 
unavailablePeriodConstraintList;
         private List<Lecture> lectureList;
         private HardAndSoftScore score;
         ...
         // This is not a PlanningFactProperty: the name is inserted 
into the working memory
         public String getName() {...}
         @PlanningFactProperty
         public InstitutionalWeighting getInstitutionalWeighting() {...}
         @PlanningFactCollectionProperty
         public List<Teacher> getTeacherList() {...}
         @PlanningFactCollectionProperty
         public List<Curriculum> getCurriculumList() {...}
         ...
         @PlanningFactCollectionProperty
         public List<UnavailablePeriodConstraint> 
getUnavailablePeriodConstraintList() {...}
         // This is not a PlanningFactCollectionProperty: it is a 
PlanningEntityCollectionProperty
         @PlanningEntityCollectionProperty
         public List<Lecture> getLectureList() {...}
         // This is not a PlanningFactProperty: the score is inserted 
into the working memory
         public ...Score getScore() {...}
         // renamed from calculateTopicConflictList because these are 
also facts needed in the working memory
         @PlanningFactCollectionProperty
         public List<TopicConflict> getTopicConflictList() {...}
     }
[RECOMMEND] A planning entity is considered uninitialized if one if at 
least on of its planning variables is null.
Therefor it's now possible to start from a partially initialized solution,
for example during real-time re-planning as new facts events come in.
[MAJOR] The StartingSolutionInitializer no longer has a 
isSolutionInitialized(AbstractSolverScope) method
Before in *StartingSolutionInitializer.java:
     public class ...StartingSolutionInitializer extends 
AbstractStartingSolutionInitializer {
         @Override
         public boolean isSolutionInitialized(AbstractSolverScope 
abstractSolverScope) {
             ...
         }
         ...
     }
After in *StartingSolutionInitializer.java:
     public class ...StartingSolutionInitializer extends 
AbstractStartingSolutionInitializer {
         ...
     }
[MAJOR] The planning entity collection in the Solution can never be null,
but some (or all) of its planning entity's can be uninitialized.
So create them before setting the starting solution, instead of in your 
StartingSolutionInitializer.
Before in *.java:
     public class ... {
         public void ...() {
             CurriculumCourseSchedule schedule = new 
CurriculumCourseSchedule();
             schedule.setTeacherList(teacherList);
             schedule.setCourseList(courseList);
             ...
             solver.setStartingSolution(schedule);
         }
     }
After in *.java:
     public class ... {
         public void ...() {
             CurriculumCourseSchedule schedule = new 
CurriculumCourseSchedule();
             schedule.setTeacherList(teacherList);
             schedule.setCourseList(courseList);
             ...
             
schedule.setLectureList(createLectureList(schedule.getCourseList()));
             solver.setStartingSolution(schedule);
         }
         private List<Lecture> createLectureList(List<Course> courseList) {
             List<Lecture> lectureList = new 
ArrayList<Lecture>(courseList.size());
             long id = 0L;
             for (Course course : courseList) {
                 for (int i = 0; i < course.getLectureSize(); i++) {
                     Lecture lecture = new Lecture();
                     lecture.setId((long) id);
                     id++;
                     lecture.setCourse(course);
                     // Make sure to set all non PlanningVariable properties
                     lecture.setLectureIndexInCourse(i);
                     // Notice that we lave the PlanningVariable 
properties on null
                     lectureList.add(lecture);
                 }
             }
             return lectureList;
         }
     }
[RECOMMENDED] Remove the isInitialized() from Solution if you copied 
that from the examples.
Before in *.java:
     public class ... implements Solution<...> {
         public boolean isInitialized() {
             return (lectureList != null);
         }
         ...
     }
After in *.java:
     public class ... implements Solution<...> {
         ...
     }
*
The Good News*
I already have written a brute force solver (only useful for very very 
small toy problems of course).
In time, I 'll write a branch and bound solver (only useful for very 
small toy problems of course).
I 'll write generic, high-quality StartingSolutionInitializers that work 
on any program,
such as First Fit Decreasing and Cheapest Insertion.
A good StartingSolutionInitializer is really important to get a good 
result from Planner.
Currently writing a StartingSolutionInitializer was a bit of a black art.
Some users use a highly under optimized version or - even worse - none 
at all.
Phasing. This will be fun.
You 'll be able to do configure this really easily:
   Phase 1 = First Fit Decreasing (for initialization)
   Phase 2 = Simulated Annealing (after initialization)
   Phase 3 = Tabu search (when things get really hard)
Notice that a StartingSolutionInitializer is just a phase.
[1] https://github.com/droolsjbpm/drools-planner/pull/2/files
-- 
With kind regards,
Geoffrey De Smet
                                
                         
                        
                                
                                14 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Cloning Collections issue
                                
                                
                                
                                    
                                        by Mark Proctor
                                    
                                
                                
                                        https://issues.jboss.org/browse/JBRULES-3051
Previously ALL collections where cloned when bound:
public  Object  getNonShadowedValue(InternalWorkingMemory workingMemory,
                                       final  Object  object) {
         Object  result =this.readAccessor.getValue( workingMemory,
                                                     object );
         if  (this.isInternalFact()&&  resultinstanceof  Collection ) {
             try  {
                 Collection newCol = (Collection) result.getClass().newInstance();
                 for  ( Iterator it = ((Collection) result).iterator(); it.hasNext(); ) {
                     Object  element = it.next();
                     newCol.add( element );
                 }
                 return  newCol;
             }catch  ( InstantiationException e ) {
                 // nothing we cando, so justreturn  the resulting object
             }catch  ( IllegalAccessException e ) {
                 // TODO Auto-generatedcatch  block
             }
         }
         return  result;
     }
This was left over from shadow facts and actually still existed today. I 
have removed the code but now we have a failing test in 
FirstOrderLogicTest.testCollectResultConstraints.
rule"Collect Test"  salience 70
     when
         $cheeseList  : ArrayList(size == 1) from collect( Cheese( ) );
     then
         results.add($cheeseList);
end
The reason why this passed before was the collection was cloned, so the 
accumulate's evaulations would not impact it. Now it is no longer cloned 
and while the rule does not fire the Collection is updated. I think the 
later is the correct behaviour and I've updated the test as expected. 
Everyone agreed?
                                
                         
                        
                                
                                14 years, 5 months