A LogDB database is filled with facts. A fact is a name with a body consisting of a parenthesized list of names. This is similar to a function call: fact1(arg1,arg2,arg_3,4,4)thing(p1,arg2,p3)fac
A LogDB database is filled with facts. A fact is a name with a body consisting of a parenthesized list of names. This is similar to a function call: fact1(arg1,arg2,arg_3,4,4)thing(p1,arg2,p3)fact1(arg1, arg2, arg_3, 4, 4)thing(p1, arg2, p3)fact1(arg1,arg2,arg_3,4,4)thing(p1,arg2,p3). fact1fact1fact1 is the name of the fact and the list of names in the body are the arguments of the fact. thingthingthing is another fact. The names in the list are separated by commas and optional whitespace. There will be at least one name in the list. Names consist of alphanumeric characters (a-z,A-Z,0-9) plus ‘_’. However, the name of a fact and the names in the body cannot start with an ‘_’. Names, parentheses, and commas may be preceded and followed by whitespace. However a fact or query cannot be split across lines. Facts with different numbers of arguments are different facts. A fact may appear multiple times in the database. Queries are like facts except the argument list can contain variables. Variables are names that start with ‘_’. A query searches the database for facts with the same name as the query that have the same number of arguments as the query and where the names in the fact body match the names in the query body in their respective positions. A variable consisting of only ‘_’ is special and will match any name. A variable other than ‘_’ will also match any name but if that variable appears more than once in a query, the names in the fact must be the same. A query: fact1(arg1,_,_,_check,_check)fact1(arg1, _, _, _check, _check)fact1(arg1,_,_,_check,_check) will match fact1(arg1,arg2,arg_3,4,4)fact1(arg1, arg2, arg_3, 4, 4)fact1(arg1,arg2,arg_3,4,4). Variables are only defined in the query they appear in. They are not necessarily related if they are in different queries.
