Conditional rules

The user selects an option and that option is translated to a construct in the database that needs to be used as a conditional check beford conclusions can be drawn. Ex: depending on the criticality of something for a specific project at certain stages, a stakeholder might want to include reworked items in the conclusion (reports).
1 Reply
krishnan
krishnan2y ago
I can't think of a great way to do this. But just to feed the discussion, would either of the following work for you: 1. If the condition (e.g. the current phase of a project) is something stored in the database.
rule triggered-only-during-planning-phase:
when {
$p isa project, has phase "planning";
...
} then {
(project: $p, ... ) isa some-conclusion;
};
rule triggered-only-during-planning-phase:
when {
$p isa project, has phase "planning";
...
} then {
(project: $p, ... ) isa some-conclusion;
};
2. If it's specified at query time, you'd have to add the condition as a role to the relation being concluded to be able to pass it down.
rule triggered-on-query-time-phase:
when {
$phase = "planning";
$p isa project;
...

} then {
(current-phase: $phase, project: $p) isa some-conclusion;
};
rule triggered-on-query-time-phase:
when {
$phase = "planning";
$p isa project;
...

} then {
(current-phase: $phase, project: $p) isa some-conclusion;
};

Did you find this page helpful?