Information about Datalog
Datalog is a query and rule language for deductive databases that syntactically is a subset of Prolog. Its origins date back to the beginning of logic programming, but it became prominent as a separate area around 1978 when Hervé Gallaire and Jack Minker organized a workshop on logic and databases. The term Datalog was coined in the mid 1980s by a group of researchers interested in database theory.
In contrast to Prolog, it
Datalog was popular in academic database research but never succeeded in becoming part of a commercial database system, despite its advantages (compared to other database languages such as SQL) such as recursive queries and a clean semantics. Even so, some widely used database systems include ideas and algorithms developed for Datalog. For example, the SQL99 standard includes recursive queries, and the Magic Sets algorithm (initially developed for the faster evaluation of Datalog queries) is implemented in IBM's DB2.
Two extensions that have been made to Datalog include an extension to allow object-oriented programming and an extension to allow disjunctions as heads of clauses. Both extensions have major impacts on the definition of Datalog's semantics and on the implementation of a corresponding Datalog interpreter.
parent(bill,mary). parent(mary,john).
These two lines define two facts, i.e. things that always hold. They can be intuitively understood as: the parent of bill is mary and the parent of mary is john.
ancestor(X,Y) :- parent(X,Y). ancestor(X,Y) :- ancestor(X,Z),ancestor(Z,Y).
These two lines describe the rules that define the ancestor relationship. A rule consists of two main parts separated by the :- symbol. The part to the left of this symbol is the head, the part to the right the body of the rule. A rule is read (and can be intuitively understood) as if it is known that . Uppercase letters stand for variables. Hence in the example the first rule can be read as X is the ancestor of Y if it is known that X is the parent of Y. And the second rule as X is the ancestor of Y if it is known that X is the ancestor of some Z and Z is the ancestor of Y. The ordering of the clauses is irrelevant in Datalog in contrast to Prolog which depends on the ordering of clauses for computing the result of the query call.
Datalog distinguishes between extensional and intensional predicate symbols. While extensional predicate symbols are only defined by facts, intensional predicate symbols are defined only by rules. In the example above
A rule without a head is called a query. The query above asks for all ancestors of bill and would return mary and john when posed against a Datalog system containing the facts and rules described above.
..... Click the link for more information.
Features, limitations and extensions
Query evaluation with Datalog is sound and complete and can be done efficiently even for large databases. Query evaluation is usually done using bottom up strategies.In contrast to Prolog, it
- disallows complex terms as arguments of predicates, e.g. P(1, 2) is admissible but not P(f1(1), 2),
- imposes certain stratification restrictions on the use of negation and recursion, and
- only allows range restricted variables, i.e. each variable in the conclusion of a rule must also appear in a not negated clause in the premise of this rule.
Datalog was popular in academic database research but never succeeded in becoming part of a commercial database system, despite its advantages (compared to other database languages such as SQL) such as recursive queries and a clean semantics. Even so, some widely used database systems include ideas and algorithms developed for Datalog. For example, the SQL99 standard includes recursive queries, and the Magic Sets algorithm (initially developed for the faster evaluation of Datalog queries) is implemented in IBM's DB2.
Two extensions that have been made to Datalog include an extension to allow object-oriented programming and an extension to allow disjunctions as heads of clauses. Both extensions have major impacts on the definition of Datalog's semantics and on the implementation of a corresponding Datalog interpreter.
Example
Example Datalog program:parent(bill,mary). parent(mary,john).
These two lines define two facts, i.e. things that always hold. They can be intuitively understood as: the parent of bill is mary and the parent of mary is john.
ancestor(X,Y) :- parent(X,Y). ancestor(X,Y) :- ancestor(X,Z),ancestor(Z,Y).
These two lines describe the rules that define the ancestor relationship. A rule consists of two main parts separated by the :- symbol. The part to the left of this symbol is the head, the part to the right the body of the rule. A rule is read (and can be intuitively understood) as if it is known that . Uppercase letters stand for variables. Hence in the example the first rule can be read as X is the ancestor of Y if it is known that X is the parent of Y. And the second rule as X is the ancestor of Y if it is known that X is the ancestor of some Z and Z is the ancestor of Y. The ordering of the clauses is irrelevant in Datalog in contrast to Prolog which depends on the ordering of clauses for computing the result of the query call.
Datalog distinguishes between extensional and intensional predicate symbols. While extensional predicate symbols are only defined by facts, intensional predicate symbols are defined only by rules. In the example above
ancestor is an intensional predicate symbol, and parent is extensional. Predicates may also be defined by facts and rules and therefore neither be purely extensional nor intensional, but any datalog program can be rewritten into an equivalent program without such predicate symbols with duplicate roles.
- - ancestor(bill,X).
A rule without a head is called a query. The query above asks for all ancestors of bill and would return mary and john when posed against a Datalog system containing the facts and rules described above.
Systems implementing Datalog
Most implementations of Datalog stem from university projects.[1] Here is a short list of a few open source systems that are either based on Datalog or are providing a Datalog interpreter:- bddbddb, an implementation of Datalog done at Stanford University. It is mainly used to query Java bytecode including points-to analysis on large Java programs.
- ConceptBase, a deductive and object-oriented database system based on a Datalog query evaluator. It is mainly used for conceptual modeling and meta-modeling.
- DES, an open-source implementation of Datalog to be used for teaching Datalog in courses.
- XSB, a logic programming and deductive database system for Unix and Windows.
- .QL, an object-oriented variant of Datalog created by Semmle.
- Datalog http://www.ccs.neu.edu/home/ramsdell/tools/datalog, a lightweight deductive database system written in Lua.
- SecPAL a security policy language developed by Microsoft Research http://research.microsoft.com/projects/secpal
See also
- Logic programming
- Answer set programming
- SWRL
- D (data language specification)
- D4 (programming language)
- Prolog
- IBM DB2
References
Query languages are computer languages used to make queries into databases and information systems.
Broadly, query languages can be classified according to whether they are database query languages or information retrieval query languages. Examples include:
..... Click the link for more information.
Broadly, query languages can be classified according to whether they are database query languages or information retrieval query languages. Examples include:
- .
..... Click the link for more information.
A deductive database system is a database system which can make deductions (ie: conclude additional facts) based on and facts stored in the (deductive) database. Datalog is the language typically used to specify facts, rules and queries in deductive databases.
..... Click the link for more information.
..... Click the link for more information.
Prolog
Paradigm: Logic programming
Appeared in: 1972
Designed by: Alain Colmerauer
Major implementations: BProlog, GNU Prolog, Quintus, SICStus, Strawberry, SWI-Prolog, YAP-Prolog
Dialects: ISO Prolog, Edinburgh Prolog
..... Click the link for more information.
Paradigm: Logic programming
Appeared in: 1972
Designed by: Alain Colmerauer
Major implementations: BProlog, GNU Prolog, Quintus, SICStus, Strawberry, SWI-Prolog, YAP-Prolog
Dialects: ISO Prolog, Edinburgh Prolog
..... Click the link for more information.
<noinclude></noinclude> Logic programming (which might better be called logical programming by analogy with mathematical programming and linear programming) is, in its broadest sense, the use of mathematical logic for computer programming.
..... Click the link for more information.
..... Click the link for more information.
19th century - 20th century - 21st century
1940s 1950s 1960s - 1970s - 1980s 1990s 2000s
1975 1976 1977 - 1978 - 1979 1980 1981
Year 1978 (MCMLXXVIII
..... Click the link for more information.
1940s 1950s 1960s - 1970s - 1980s 1990s 2000s
1975 1976 1977 - 1978 - 1979 1980 1981
Year 1978 (MCMLXXVIII
..... Click the link for more information.
Jack Minker is a leading authority in artificial intelligence, deductive databases, logic programming and non-monotonic reasoning. He is also an internationally recognized leader in the field of human rights of computer scientists.
..... Click the link for more information.
..... Click the link for more information.
Logic (from Classical Greek λόγος logos; meaning word, thought, idea, argument, account, reason, or principle) is the study of the principles and criteria of valid inference and demonstration.
..... Click the link for more information.
..... Click the link for more information.
database is a structured collection of records or data that is stored in a computer system so that a computer program or person using a query language can consult it to answer queries. The records retrieved in answer to queries are information that can be used to make decisions.
..... Click the link for more information.
..... Click the link for more information.
Stratification has several usages in mathematics.
..... Click the link for more information.
In mathematical logic
In mathematical logic, stratification is any consistent assignment of numbers to predicate symbols guaranteeing that a unique formal interpretation of a logical theory exists...... Click the link for more information.
SQL
Paradigm: multi-paradigm
Appeared in: 1974
Designed by: Donald D. Chamberlin and Raymond F. Boyce
Developer: IBM
Latest release: SQL:2003/ 2003
Typing discipline: static, strong
Major implementations: Many
SQL
..... Click the link for more information.
Paradigm: multi-paradigm
Appeared in: 1974
Designed by: Donald D. Chamberlin and Raymond F. Boyce
Developer: IBM
Latest release: SQL:2003/ 2003
Typing discipline: static, strong
Major implementations: Many
SQL
..... Click the link for more information.
DB2 is one of IBM's lines of relational database management system (or, as IBM now calls it, data server) software products within IBM's broader Information Management Software line.
..... Click the link for more information.
..... Click the link for more information.
Object-oriented programming (OOP) is a programming paradigm that uses "objects" and their interactions to design applications and computer programs. It is based on several techniques, including inheritance, modularity, polymorphism, and encapsulation.
..... Click the link for more information.
..... Click the link for more information.
or, also known as logical disjunction or inclusive disjunction is a logical operator that results in true whenever one or more of its operands are true. In grammar, or is a coordinating conjunction.
..... Click the link for more information.
..... Click the link for more information.
clause is a disjunction of literals. In propositional logic, clauses are usually written as follows, where the symbols are literals:
In some cases, clauses are written as sets of literals, so that clause above would be written as .
..... Click the link for more information.
In some cases, clauses are written as sets of literals, so that clause above would be written as .
..... Click the link for more information.
Leland Stanford Junior University, commonly known as Stanford University or simply Stanford, is a private university located approximately 37 miles (60 kilometers) southeast of San Francisco and approximately 20 miles (32 km) northwest of San Jose in Stanford,
..... Click the link for more information.
..... Click the link for more information.
XSB is the name of a dialect of the Prolog programming language and its implementation developed at Stony Brook University in collaboration with the Katholieke Universiteit Leuven, the New University of Lisbon, Uppsala University and software vendor XSB, Inc.
..... Click the link for more information.
..... Click the link for more information.
.QL
Paradigm: multi-paradigm,logic-paradigm,object-oriented-paradigm
Appeared in: 2007
Developer: Semmle
Typing discipline: static, strong
Major implementations: SemmleCode
.
..... Click the link for more information.
Paradigm: multi-paradigm,logic-paradigm,object-oriented-paradigm
Appeared in: 2007
Developer: Semmle
Typing discipline: static, strong
Major implementations: SemmleCode
.
..... Click the link for more information.
Lua
Paradigm: Multi-paradigm
Appeared in: 1993
Designed by: Roberto Ierusalimschy Waldemar Celes Luiz Henrique de Figueiredo
Latest release: 5.1.
..... Click the link for more information.
Paradigm: Multi-paradigm
Appeared in: 1993
Designed by: Roberto Ierusalimschy Waldemar Celes Luiz Henrique de Figueiredo
Latest release: 5.1.
..... Click the link for more information.
SecPAL Introduction
SecPAL is a declarative, logic-based, security policy language that has been developed to support the complex access control requirements of large scale distributed computing environments...... Click the link for more information.
<noinclude></noinclude> Logic programming (which might better be called logical programming by analogy with mathematical programming and linear programming) is, in its broadest sense, the use of mathematical logic for computer programming.
..... Click the link for more information.
..... Click the link for more information.
Answer set programming (ASP) is a form of declarative programming oriented towards difficult (primarily NP-hard) search problems. It is based on the stable model (answer set) semantics of logic programming, and uses answer set solvers -- programs for generating stable models -- to
..... Click the link for more information.
..... Click the link for more information.
SWRL (Semantic Web Rule Language) is a proposal for a Semantic Web rules-language, combining sublanguages of the OWL Web Ontology Language (OWL DL and Lite) with those of the Rule Markup Language (Unary/Binary Datalog).
..... Click the link for more information.
..... Click the link for more information.
D is a set of requirements proposed by Christopher J. Date and Hugh Darwen in their book The Third Manifesto for what they believe a relational database query language ought to be like; D is not a language itself.
..... Click the link for more information.
..... Click the link for more information.
D4 is a computer language used in Dataphor, a truly Relational Database Management System.
..... Click the link for more information.
Syntax
Alphora, the creators of D4, have given it a Pascal like syntax. Sample code in D4 made by Alphora is usually written in UpperCamelCase, which is also widely used in Pascal..... Click the link for more information.
Prolog
Paradigm: Logic programming
Appeared in: 1972
Designed by: Alain Colmerauer
Major implementations: BProlog, GNU Prolog, Quintus, SICStus, Strawberry, SWI-Prolog, YAP-Prolog
Dialects: ISO Prolog, Edinburgh Prolog
..... Click the link for more information.
Paradigm: Logic programming
Appeared in: 1972
Designed by: Alain Colmerauer
Major implementations: BProlog, GNU Prolog, Quintus, SICStus, Strawberry, SWI-Prolog, YAP-Prolog
Dialects: ISO Prolog, Edinburgh Prolog
..... Click the link for more information.
DB2 is one of IBM's lines of relational database management system (or, as IBM now calls it, data server) software products within IBM's broader Information Management Software line.
..... Click the link for more information.
..... Click the link for more information.
This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.
Herod_Archelaus