Bottom Clause Construction
A tightly-coupled approach
- prepare the tables for each modeb
- prepare the tables for registered term for each type
SELECT DISTINCT T.att1, ... ,T.attM,
(depth+1) as depth, R1.id
FROM rterm1 R1, … ,rtermN RN, modeb T
(R1.id = R2.id AND ... AND R(N-1).id = RN.id)
(R1.depth = depth OR ... OR RN.depth = depth)
(R1.inst = T.att1 AND ... AND RN.inst = T.attn)
AND … //Some Condition for modeb