[rules-users] Matching items based on values in lists

Wolfgang Laun wolfgang.laun at gmail.com
Tue Aug 10 13:19:36 EDT 2010


On 10 August 2010 19:04, cortlander <cortlander at gmail.com> wrote:
>
> Thanks very much Wolfgang - that was clumsy of me!
>
> I corrected a couple of other errors, my code now runs, but does not work.

Not firing as expected? Or in what other way does it not work?

> Am I approaching this correctly?

This sort of fact structure is not very well suited for RBS like Drools.

If "not firing" is the problem, I suggest that you add rules using a subset of
the conditions (e.g., the "subject" part, and the "resource" part) and see
what matches and whether ypur facts are really what you expect.

You might also change the second part to follow the same pattern as
the first part:
  $resource: RqTargetType( $resourceAttribs : rqAttribs )
  ... from $resourceAttribs
  ... from $resourceAttribs
but I don't think that matters except for readability.

-W

>
> rule "Patient Access Rule"
>        when
>                #conditions
>                RqTargetType( $subjectAttribs : rqAttribs )
>                RqAttrib (attribType == "subject", designator == "subject.role",
>                        attribValue == "patient") from $subjectAttribs
>                RqAttrib (attribType == "subject", designator == "subject.id",
>                        $subjectId: attribValue) from $subjectAttribs
>
>                $resource: RqTargetType( )
>                RqAttrib (attribType == "resource", designator == "resource.patient",
>                        attribValue == $subjectId ) from $resource.getRqAttribs()
>                RqAttrib (attribType == "resource", designator == "resource.id",
>                        $resourceId: attribValue ) from $resource.getRqAttribs
>        then
>                #actions
>                System.out.println( "resource: " + $resourceId );
>                System.out.println( "subject: " + $subjectId );
>                System.out.println( "Patient Access rule decision: Permit" );
>                decisions.add("Permit");
> end
>
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Matching-items-based-on-values-in-lists-tp1075556p1076024.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




More information about the rules-users mailing list