In my code below, I am using the id property to distinguish between two objects ($stp2 is not $stp1). How can I rather do it at object-level, instead of using some property?
rule "multipleSTPSamePeriod"
when
$stp1 : SubjectTeacherPeriod( $id:id, $period:period)
$stp2 : SubjectTeacherPeriod(id>$id, period==$period)
You can use the “this” special property:
If you want that behavior on all your rules, though, you can set a knowledge base configuration option and the engine will automatically check that for you without the need to add the constraint to every pattern.
Using a system property or conf file you can set:
Or using the API: