On 31/07/12 09:41, Alejandro Rodríguez González wrote:
Hi Dave,

Thanks, this makes my task harder :-) Let me then ask you a question about
the rules that I have. Maybe you can help me with this. Based on the same
example that we were talking I want to create a rules that are executed
when "I have sign A, B (compulsory) and one of the following: C, D, E). For
this, I already have a solution creating several combinations such as
A,B,C; A,B,D; etc.. but I want other design.

Why?

The correct, standard way to do disjunctions in rule systems is to have multiple rules. Stick with that approach.

I've then some rules where, first of all, I close the world using noValue
and specifying only A,B,C,D, and E as valid signs. Then, I've created a
rule that should be fired (with diagnosis result) only if I have A, B
(compulsory) and a counter with a value greater or equal to 1.

Counting in JenaRules is a pain because it is non-monotonic, you have to go round deleting values and using noValue checks. It is really outside the design centre for JenaRules (deductive closures for RDFS++). If you find you have to do that sort of thing a lot then JenaRules may not be the right technology for your problem.

Then, I've developed also three more rules (one per remaining sign: C,D,E),
that increases this counter. However it seems to not be working.

Here are the rules:

http://pastebin.com/LeWY7Ndq

The only rule that that initializes the counter is:

rule_dX_NOT_REST_SIGNS

which (a) only fires if there is a finding other than sA to sE and (b) asserts your ont:dX_NOT_SIGNS flag.

So the only situation in which there is a zero counter to get the counting started is one where you have some other finding and even then those counting rules will never fire because they are guarded by:

   noValue(?i, ont:hasNegSign ont:dX_NOT_SIGNS)

If they did fire than be aware that the counting rules you have do not remove the older counts (the painful bit of counting in JenaRules) so you'll end up with all the count values not a single total value.

Dave

Reply via email to