Ticker

6/recent/ticker-posts

Deductive Database Deduce new fact using fact and rule

 Deductive Database Deduce new fact using fact and rule

Deductive database use inference engine within the system can deduce new fact from the database by interpreting these rules.The model used for deductive database is closely related to the relational data model.It is also related to the field of logic programming and the prolog language.A variation of prolog called datalog is used to define rules decoratively in conjunction with an existing set of relation.

A deductive database uses two main types of specification:

  • Facts.
  • Rules.
Facts are specified similar to the way relations are specified except that it is not necessary to include the attribute names.
Rules are somewhat similar to relational views.They specify virtual relation that are not actually stored but that can be formed from the facts by applying inference mechanism based on rule specifications. The evaluation of prolog programs is based on technique called backward chaining which involves a top-down evaluation of goals.In the deductive database that use catalog.


Example
Rules
Component(part,subpart)--Assembly(part,subpart)
Component(part,subpart)--Assembly(part,x,qty)  , component(x,subpart)


Assembly 



Use fact and rule deduce new fact
According to rule1
Store Assembly data in component table 
                                                               Component

and according to rule 2
Component(part,subpart)--Assembly(part,x,qty)  , component(x,subpart)

subpart of part is wheel and wheel subpart in component table is spoke and tire
so deduce new fact 
Trike     spoke
Trike     Tire 
Trike      seat 
Trike      pedal
wheel     rim
wheel     tube

Add this new fact in component table



Again use fact and rule deduce new facts
use Assembly and new component table 

Trike    Spoke
Trike    Tire
Trike    Rim
Trike    Tube
Trike     Seat
Trike     Pedal
Wheel    Rim
Wheel    Tube

New component table



So deductive inference engine deduce new fact base on fact and rules .Inference engine continuously create new table until previous and current table result is not same and give answer of recursive query. 

Example
Recursive query find all the component of Trike.

So inference engine use fact and rules create new table to answer the query.
so answer is based on new component table
rim,tire,tube,frame,pedal,spoke,seat,wheel   



Post a Comment

0 Comments