Hi Edson,
thanks a lot for the advice. In the mean time I tried to create another
class which encapsulate the data, so that I don't have any list and map
anymore.
But as you already kindly give the syntax... I tried that syntax before and
somehow it didn't work too.
Unfortunately I can't give the exception I got because I already changes the
codes a lot.
Thanks
bb
Edson Tirelli-3 wrote:
Hi
As a general advice, try to avoid using abstract data structures
(lists,
maps, etc) as facts, since they have no semantics in the problem domain.
If
you have students, insert each student in the working memory. If you have
student activities, either have an activities list "as a student
attribute",
or create a domain object that relates students to their activity list.
If you do the above, rules will be so much simpler and more
performant,
that you will not regret.
But, since you asked, I see no reason for you to not insert students
directly, instead of the list of students. Your rule would be like:
when
$std : Student( $id : id )
$map : Map( )
$act : Activity ($date : date, length > 180) from $map[$id]
then
end
[]s
Edson
2009/6/24 Brody bach <brodybach(a)yahoo.com>
>
> Hi,
>
> I need to put a map into the working memory and make some check on the
> values
>
> I have an object called Student with Id
> And for every student there is a list of activity.
> Each activity has date and the time for the activity
> What I will be putting in the working memory looks as follows:
>
> List<Student> studentList = getStudentList();
> Map<Student, List<Activity>> studentActivityMap =
> getStudentActivities(studentList);
> List objects = new ArrayList();
> objects.add(studentList);
> objects.add(studentActivityMap);
>
> ksession.execute(objects);
>
> ====================
>
> Now i need to check for every student, if there is/are activity(ies)
> which
> needs more than 2 hours. If yes, give an output information which
> mention,
> which student and on which day the activity is longer than 2 hours
>
> when
> $studentList : List
> $std : Student($id : id) from $studentList
> $activityList : ****how to get the list of activity for the student with
> this $id from the given map *****
> $act : Activity ($date : date, length > 180) from $activityList
>
> then
> (print something out using $id from std and $date from act)
>
>
> Would really appreciate any help and hints here
>
> Regards
> bb
> --
> View this message in context:
>
http://www.nabble.com/Another-question-on-how-to-use-map-tp24181278p24181...
> Sent from the drools - user mailing list archive at
Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users