| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.98.0/library/datalog/NOTES.md |
This file is part of Logtalk https://logtalk.org/ SPDX-FileCopyrightText: 1998-2026 Paulo Moura <pmoura@logtalk.org> SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
datalogThis library provides a portable Datalog and incremental rule engine for educational purposes and non-demanding applications. This library is work-in-progress and changes, possibly breaking backwards compatibility, are to be expected.
Open the [../../apis/library_index.html#datalog](../../apis/library_index.html#datalog) link in a web browser.
To load all entities in this library, load the loader.lgt file:
| ?- logtalk_load(datalog(loader)).
To run the library unit tests, load the tester.lgt file:
| ?- logtalk_load(datalog(tester)).
agg(Op, Template, Goals, Result)) with lower-strata dependencies (Op in count, sum, min, max)rule(Id, Head, Body) where Body is a list of Literal terms:
neg(Term)agg(Op, Template, Goals, Result) where Op is one of count, sum, min, maxfact(Fact) for extensional database (EDB) facts
Aggregate notes:min and max require at least one matching value; otherwise no fact is derived.
| ?- logtalk_load(datalog(loader)).
...
| ?- Program = [
rule(path_base, path(X,Y), [edge(X,Y)]),
rule(path_rec, path(X,Z), [edge(X,Y), path(Y,Z)]),
fact(edge(a,b)),
fact(edge(b,c))
],
datalog::load_program(Program),
datalog::query(path(a,c)).
This first version intentionally keeps the implementation simple and portable.
Negation support is currently limited to stratified programs. Aggregates and
cost-based optimization are planned future enhancements. Aggregate support is
currently limited to count, sum, min, and max.