1

My problem is that if i want to check if an instance is in range, i use the following rule:

Rule1: Error(?d), TimeRelatedError(?c), TimeRelatedError_start_at(?c, ?s), error_at(?d, ?b), greaterThan(?b, ?s) -> is_after_TimeRelatedError_start(?d, true)
Rule2: Error(?d), TimeRelatedError(?c), TimeRelatedError_end_at(?c, ?e), error_at(?d, ?b), lessThan(?b, ?e) -> is_before_TimeRelatedError_end(?d, true)

It works if i have only one TimeRelatedError in my ontology, if i have more instances, it will always trigger true (because one of the TimeRelatedError are always before/after start/end point). Do you have any ideas how to solve this problem? I think i could tackle the problem if i assign my TimeRelatedError somehow to the Error instance but i do not know how. Please OWL/SWRL professionals help me with this task :)

lkaupp
  • 551
  • 1
  • 6
  • 17
  • it sounds like you have a sequence of errors, indeed this won't work. You'd have to find the latest error before the current error I guess? That's impossible with your current data model. either you use some list structure for OWL (there are some approaches) or it is out of scope for SWRL I think. With keeping track of predecessor and successor it might work. But on the other hand, I might not get the domain of you data. You should also add some sample data + the expected inferred result – UninformedUser Aug 06 '19 at 17:19
  • Thanks for your fast responses @AKSW . It is amazing how fast you are :) . Found the mistake that caused the problem. – lkaupp Aug 06 '19 at 17:24
  • ah, great that you found a solution. the only thing I don't understand what `in_range` means. Don't you need the relationship to the range itself? So far, you only infer that the error is in some range, but what if you have multiple ranges? Wouldn't it make sense to keep track of which range? – UninformedUser Aug 07 '19 at 06:45

1 Answers1

0

I only can blame myself, i found a solution, only one rule with:

Error(?d), TimeRelatedError(?c), TimeRelatedError_start_at(?c, ?s), error_at(?d, ?b), greaterThan(?b, ?s), TimeRelatedError_end_at(?c, ?e), error_at(?d, ?b), lessThan(?b, ?e) -> in_range(?d, true)

It works because everything after greaterThan will only be called if the statement (greaterThan) is true, in the end if the end is also less than, we can call it in_range. I leave it here, for other that stumble upon the same question.

lkaupp
  • 551
  • 1
  • 6
  • 17