This file is indexed.

/usr/share/doc/racket/datalog/datalog.html is in racket-doc 6.7-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>1&nbsp;Datalog Module Language</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_0&quot;);">&#9660;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Datalog:<span class="mywbr"> &nbsp;</span> Deductive Database Programming</a></td></tr></table></div><div class="tocviewsublistonly" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Datalog Module Language</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="Tutorial.html" class="tocviewlink" data-pltdoc="x">Tutorial</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="Parenthetical_Datalog_Module_Language.html" class="tocviewlink" data-pltdoc="x">Parenthetical Datalog Module Language</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="interop.html" class="tocviewlink" data-pltdoc="x">Racket Interoperability</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="Acknowledgments.html" class="tocviewlink" data-pltdoc="x">Acknowledgments</a></td></tr></table></div></div></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.7&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="index.html" title="backward to &quot;Datalog: Deductive Database Programming&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Datalog: Deductive Database Programming&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="Tutorial.html" title="forward to &quot;2 Tutorial&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h3 x-source-module="(lib &quot;datalog/scribblings/datalog.scrbl&quot;)" x-source-pkg="datalog" x-part-tag="&quot;datalog&quot;">1<tt>&nbsp;</tt><a name="(part._datalog)"></a><a name="(mod-path._datalog/lang/reader)"></a>Datalog Module Language</h3><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace">&nbsp;</span><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&amp;rel=Module_Syntax.html%23%2528part._hash-lang%2529&amp;version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace">&nbsp;</span><a href="interop.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">datalog</span></a></td><td align="right"><span class="RpackageSpec"><span class="Smaller">&nbsp;package:</span> <span class="stt">datalog</span></span></td></tr></table></p><p>In Datalog input, whitespace characters are ignored except when they separate adjacent tokens or when they occur in strings.
Comments are also considered to be whitespace. The character <span class="RktInBG"><span class="hspace"></span><span class="RktIn">%</span><span class="hspace"></span></span> introduces a comment, which extends to the next line break.
Comments do not occur inside strings.</p><p>A variable is a sequence of Unicode "Uppercase" and "Lowercase" letters, digits, and the underscore character. A variable must begin with a Unicode "Uppercase" letter.</p><p>An identifier is a sequence of printing characters that does not contain any of the following characters: <span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">`</span><span class="hspace"></span></span>,
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">'</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">=</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">:</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">.</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">~</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">?</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">"</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">%</span><span class="hspace"></span></span>, and space.
An identifier must not begin with a Latin capital letter. Note that the characters that start punctuation are forbidden in identifiers,
but the hyphen character is allowed.</p><p>A string is a sequence of characters enclosed in double quotes. Characters other than double quote, newline, and backslash may be directly
included in a string. The remaining characters may be specified using escape characters, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\"</span><span class="hspace"></span></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">\</span><span class="hspace">&nbsp;</span></span>, and
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">\\</span><span class="hspace"></span></span> respectively.</p><p><div class="SIntrapara">A literal, is a predicate symbol followed by an optional parenthesized list of comma separated terms. A predicate symbol is either an identifier
or a string. A term is either a variable or a constant. As with predicate symbols, a constant is either an identifier or a string. As a special case,
two terms separated by <span class="RktInBG"><span class="hspace"></span><span class="RktIn">=</span><span class="hspace"></span></span> (<span class="RktInBG"><span class="hspace"></span><span class="RktIn">!=</span><span class="hspace"></span></span>) is a literal for the equality (inequality) predicate.
The following are literals:
</div><div class="SIntrapara"><table cellspacing="0" cellpadding="0"><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">parent(john, douglas)</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">zero-arity-literal</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">"="(3,3)</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">""(-0-0-0,&amp;&amp;&amp;,***,"\00")</span></p></td></tr></table></div></p><p>A clause is a head literal followed by an optional body. A body is a comma separated list of literals. A clause without a body is called a <a name="(tech._fact)"></a><span style="font-style: italic">fact</span>,
and a rule when it has one. The punctuation <span class="RktInBG"><span class="hspace"></span><span class="RktIn">:-</span><span class="hspace"></span></span> separates the head of a rule from its body. A clause is safe if every variable in its head
occurs in some literal in its body. The following are safe clauses:</p><p><table cellspacing="0" cellpadding="0"><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">parent(john, douglas)</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">ancestor(A, B) :-</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt"></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">parent(A, B)</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">ancestor(A, B) :-</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt"></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">parent(A, C),</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt"></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">ancestor(C, B)</span></p></td></tr></table></p><p>A program is a sequence of zero or more statements. A statement is an assertion, a retraction, or a query. An assertion is a clause followed by
a period, and it adds the clause to the database if it is safe. A retraction is a clause followed by a tilde, and it removes the clause from
the database. A query is a literal followed by a question mark.</p><p>The following BNF describes the syntax of Datalog.</p><p><table cellspacing="0" cellpadding="0"><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">program</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">statement</span>&#8250;</span><span class="sroman">*</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">statement</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">assertion</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">retraction</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">query</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">assertion</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">clause</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">.</span><span class="hspace"></span></span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">retraction</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">clause</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">~</span><span class="hspace"></span></span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">query</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">literal</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">?</span><span class="hspace"></span></span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">clause</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">literal</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">:-</span><span class="hspace"></span></span><span class="hspace">&nbsp;</span><span class="sroman">&#8249;<span style="font-style: italic">body</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">literal</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">body</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">literal</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">,</span><span class="hspace"></span></span><span class="hspace">&nbsp;</span><span class="sroman">&#8249;<span style="font-style: italic">body</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">literal</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">literal</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">predicate-sym</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">predicate-sym</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">(</span><span class="hspace"></span></span><span class="hspace">&nbsp;</span><span class="sroman">&#8249;<span style="font-style: italic">terms</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">)</span><span class="hspace"></span></span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">predicate-sym</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">term</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">=</span><span class="hspace"></span></span><span class="hspace">&nbsp;</span><span class="sroman">&#8249;<span style="font-style: italic">term</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">term</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">!=</span><span class="hspace"></span></span><span class="hspace">&nbsp;</span><span class="sroman">&#8249;<span style="font-style: italic">term</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">predicate-sym</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">IDENTIFIER</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">STRING</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">terms</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">term</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">term</span>&#8250;</span><span class="hspace">&nbsp;</span><span class="RktInBG"><span class="hspace"></span><span class="RktIn">,</span><span class="hspace"></span></span><span class="hspace">&nbsp;</span><span class="sroman">&#8249;<span style="font-style: italic">terms</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">term</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">VARIABLE</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">constant</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">constant</span>&#8250;</span></p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span>::=<span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">IDENTIFIER</span>&#8250;</span></p></td></tr><tr><td valign="baseline"><p><span class="hspace">&nbsp;</span></p></td><td valign="baseline"><p> </p></td><td valign="baseline"><p><span class="stt"><span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span>|<span class="hspace">&nbsp;</span><span class="hspace">&nbsp;</span></span></p></td><td valign="baseline"><p><span class="sroman">&#8249;<span style="font-style: italic">STRING</span>&#8250;</span></p></td></tr></table></p><p>The effect of running a Datalog program is to modify the database as directed
by its statements, and then to return the literals designated by the query.
The modified database is provided as <span class="RktSym">theory</span>.</p><p>The following is a program:</p><p><table cellspacing="0" cellpadding="0"><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt"></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">#lang datalog</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt"></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">edge(a, b). edge(b, c). edge(c, d). edge(d, a).</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt"></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">path(X, Y) :- edge(X, Y).</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt"></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">path(X, Y) :- edge(X, Z), path(Z, Y).</span></p></td></tr><tr><td><p><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt"></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="stt">path(X, Y)?</span></p></td></tr></table></p><p>The Datalog REPL accepts new statements that are executed as if they were in the original program text.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.7&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="index.html" title="backward to &quot;Datalog: Deductive Database Programming&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Datalog: Deductive Database Programming&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="Tutorial.html" title="forward to &quot;2 Tutorial&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>