Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Deductive Databases
An area that is the intersection of databases, logic, and artificial intelligence or knowledge bases; A deductive database system is a database system that includes capabilities to define (deductive) rules, which can deduce or infer additional information from the facts that are stored in a database Part of the theoretical foundation for some deductive database systems is mathematical logic, such rules are often referred to as logic databases. May be also referred to as intelligent databases, expert database systems or knowledge-based systems. This systems also incorporate reasoning and inferencing capabilities using techniques that were developed in the field of artificial intelligence.
A deductive database uses two main types of specifications: facts and rules. Facts are specified in a manner similar to the ways relations are specified, except that it is not necessary to include attribute names.
Recall that a tuple in a relation describes some real-world fact whose meaning is partly determined by the attribute name. In a deductive database, the meaning of an attribute value in a tuple is determined solely by its position within the tuple. They specify virtual relations that are not actually stored but can be formed from the facts by applying inference mechanisms based on the rule specifications. The main difference between rules and views is that rules may involve recursion and hence may yield virtual relations that cannot be defined in terms of standard relational views.
ComponentsofthePrologSystem
P r o lo g S y s t e m
P r o lo g D a t a b a s e (P D B )
P r o lo g I n f e r e n c e E n g i n e (P IE )
Q u e r ie s U SER S R e s u lt s
Constants include integers (e.g. 0, 1, 10), reals (e.g. 1.45, 10.04), strings (e.g. "Hello") and atoms (e.g. like, john, 'New York') which normally begin with a lower case letter or enclosed in single quotations. Some special combinations are also considered atoms (e.g.? ,:, >).Thespecialunderlinecharacter'_'maybeinsertedin themiddleofanatomtoimproveitslegibility. Variablesaresimilartoatomsexceptthattheybeginwithacapital letter or an underline character '_' (e.g. X, Name, _address). The underline character '_' also denotes an anonymous variable whose instancesarealwaysuniquewithinthePrologsystem.
Structuresaremorecomplexdataobjects.Astructurecomprisesafunctor and a sequence of one or more terms called arguments. A functor is characterized by its name, which is an atom, and its arity or number of arguments. In contrast to functional expressions, structures are not evaluated when used as arguments. However, the use of structures as argumentsallowsmetaprogramminginPrologsinceastructurebothcanbe manipulated as a datum when used as an argument and evaluated as a procedure when taken independently as a predicate. For example, the structurepoint/3withargumentsX,YandZ,whichiswrittenaspoint(X,Y, Z), can be used as an argument to line/2 as follows: line(point(X1, Y1, Z1), point(X2,Y2,Z2)). ListsareconcatenationsofPrologtermsthathastheform.(a,.(b,.(c,[]))) orsimply[a,b,c].
Similartologicprograms,aclauseinPrologcanbeeitherafact,aruleor a query. In Prolog, the ':' is used instead of '' as the implication symbol and the naming convention for atoms and variables is the reverse of that of the standard logic program notation, that is, atoms startwithalowercasecharacterandvariablesstartwithanuppercase character. Prolog has a declarative and procedural semantics which is
PrologComparisonPredicates
PrologRepresentationofEntity RelationshipDatabaseSchemes
PrologRepresentationofEntity RelationshipDatabaseRelations
PrologRepresentationofEntity RelationshipDatabaseRelations
PrologEvaluation:(a)Database,(b)Query,(c)EvaluationTrace
Prolog/Datalog Notation
Notation is based on providing predicates with unique names. A predicate has an implicit meaning, which is suggested by the predicate name, and a fixed number of arguments. If an argument are all constant values, the predicate simply states that a certain fact is true. If the predicate has variables for arguments, it is either considered as a query or as part of a rule or constraint. Prolog convention - all constant values in a predicate are either numeric or character strings; they are represented as identifiers (or names) starting with lowercase letters only, whereas variable names always start with an uppercase letter.
Prolog/Datalog: Example
(a) Prolog notation Facts
supervise(franklin,john). supervise(franklin,namesh). supervise(franklin,joyce). supervise(jennifer,alicia). supervise(jennifer,ahmad). supervise(james, franklin). supervise(james, jennifer).
(b) The supervisory tree james franklin john ramesh joyce jennifer alicia ahmad
Rules
superior(X,Y) :- supervise(X,Y). superior(X,Y) :- supervise(X,Z), superior(Z,Y). subordinate(X,Y) :- superior(Y,X).
Queries
superior(james,Y)? superior(james,joyce)?
KBMS or Expert Databases - use expert system IF..THEN..ELSE type rules Deductive or Logic-Based databases often use Prolog-type rules
Expert databases generally incorporate knowledge extracted from experts in the field to provide reasoning and inferencing capabilities. Logic-Based use axioms (logic theory) to store the data and deductive axioms (rules) to extend that information
eg: to store the fact that Anne is the parent of Betty use: parent (Anne, Betty); parent (Betty, Cameron); Now a grandparent can be defined by the rule: grandparent (X, Z) = parent (X, Y), parent (Y, Z);
Many forms of deductive databases exist including Deductive Object-Oriented Databases Applications include: