If you'll indulge me, I have a couple more questions on temporal
operators. I have specific requirements where the built-in operators
don't *quite* fit. I'm finding workarounds but I don't love them and
basically I'm looking for validation of my approach or better ideas.
1. I need an operator that means "includes with endpoints". In other
words, "A includeswithendpoints B" means A.start <= B.start < B.end <=
A.end. Another way to look at it is: A "includes or coincides or
starts or finishedby" B.
I've been messing around with the parameters to includes. Ideally, I'd
represent this as "includes[0, duration]", where "duration" is
A's
duration. This would mean that the minimum distance between the start
and end timestamps is 0 and the maximum distance between the start and
end points is Event A's duration. However, I haven't been able to find
a way to pass a dynamic parameter to the operator.
My workaround in this case is "includes[0, 1000000d]", where 1000000d
is just an arbitrarily large number. My tests so far have borne this
out as working, but I don't like it because it's not very
self-explanatory; everywhere I use it, I will need to include a
comment. The beauty of the temporal operators is that they are
intuitive and I feel like this workaround is compromising that.
2. Given an interval-based event A and a point-in-time event B, I need
an operator which means A "finishedby or includes" B; i.e., A.start <
B.timestamp <= A.end.
Similarly, in this case, the workaround is "includes[1ms, 1000000d, 0,
1000000d]". This takes the ugliness and need for explanatory comments
to a new level.
A few questions:
1. Is there any technical reason why my workarounds won't work
(besides the obvious one where there is an event that lasts 1000001
days)?
2. Are there better solutions? (e.g., can I define my own operators?)
3. As a general rule, I avoid using "or" logic in my rules. However,
is this a case where I should consider it? To me, "EventA( this
includes $eventB || this finishedby $eventB )" is much cleaner than
"EventA( this includes[1ms, 1000000d, 0, 1000000d] $eventB )", but
that doesn't mean I like it.
Thanks in advance for any feedback.
Mike