Preface: I don't have experience with rules engines, building rules, modeling rules. Therefore, I don't know what I'm doing or if what I attempted below is way off base.
I have a set of 'id's and these ids are active only at some specific time. For example the id "xyz" is active on monday and friday from 10AM to 12PM and from 6PM to 7PM. So i need to design a database to store these data( the ids and the time in which they are active ). Currently the precision is hour but later it may become minutes. Also frequent insertion and removal may happen. what is the best way to achieve this? I am using java + mongo (can use sql if necessary).
One solution is to store the data as a set of rules, but this seems very dirty: "id","days","minHour","maxHour"`
id days minHour maxHour
-----------------------------------
sd3 1,2,3 1 5
sd3 4,5 6 7
fd5 1,2,3 4 5
another solution is to :
day hour ids
-------------------------------------
1 1 as1,fg2,ew3
1 2 as1,fg2,dsf6,sdf34
1 . . . .
1 24 . . .
2 1
2 2
. .
. .
7 24
and just insert the ids in all the rows necessary.