Add a count function

Issue #48 new
Sean Kauffman repo owner created an issue

The idea is that there are some useful things to compute that nfer is quite bad at, but can basically do. For example, to find the number of x events that come in some region defined by a before b you need rules like the following:

region :- a before b
firstx :- x1:x unless after x2:x
countx :- a before firstx map { count -> 1 }
xx :- (x1:x before x2:x) unless contain x3:x
countx :- countx meet xx map { count -> countx.count + 1 }
lastx :- (x1:xx before b) unless contain x2:xx
final :- lastx slice countx map { count -> countx.count }
regionx :- final during region map { count -> final.count }

Where regionx has the final count. This also, by the way, requires the extended semantics.

If there was instead a function like count(x) or something this could be made much simpler. It’s not clear how this should look, though. You would need to somehow include the temporal relationship between the interval and the thing you’re counting, although it does seem like containment is the natural choice.

Comments (0)

  1. Log in to comment