The main differences between the proposed SQL model and the abstract model are:
1. the term table does not link to the link table. This is order to reduce any potential performance problems with using nested selects. By separating out the term table from the link the basic attributes of the entities can be selected using simple tables joins rather than nested selects.
For example to find all the people with the occupation 'doctor'.
Query 4
select name.fullname from name, term, vocab where name.name_id = term.entity_id and term.table_ptr = 'name' and term.term_id = vocab.vocab_id and vocab.term = 'doctor'
If we had the terms in the link table as the abstract model does, we would have to use a nested query.
Query 5
select name.fullname from name, link where link.entity_id = name.name_id and link.table_ptr = 'name' link.diary_id = (select link.diary_id from link, vocab where link.link.entity_id = vocab.vocab_id and link.table_ptr = 'vocab' and vocab.value = 'doctor')
2. the Diary table has a one to many relationship with the link table, however unlike the entity tables every link record must point to a diary record. This also has performance advantages as it means the link_id can actually be the diary_id. This means no nested selects are necessary to get the diary information about a link (see Query 1).
3. All the mass events are entered in the event table. However 'indivisible acts' which are described by one rule, such as 'act of violence' are only entered in the link and diary table.