fr.boreal.backward_chaining.api.BackwardChainingAlgorithm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of integraal-backward-chaining Show documentation
Show all versions of integraal-backward-chaining Show documentation
InteGraal has been designed in a modular way, in order to facilitate
software reuse and extension.
It should make it easy to test new scenarios and techniques, in
particular by combining algorithms.
The main features of Graal are currently the following:
(1) internal storage to store data by using a SQL or RDF representation
(Postgres, MySQL, HSQL, SQLite, Remote SPARQL endpoints, Local in-memory
triplestores) as well as a native in-memory representation
(2) data-integration capabilities for exploiting federated heterogeneous
data-sources through mappings able to target systems such as SQL, RDF,
and black-box (e.g. Web-APIs)
(3) algorithms for query-answering over heterogeneous and federated data
based on query rewriting and/or forward chaining (or chase)
package fr.boreal.backward_chaining.api;
import fr.boreal.model.formula.api.FOFormula;
import fr.boreal.model.kb.api.RuleBase;
import fr.boreal.model.query.api.FOQuery;
import fr.boreal.model.query.impl.UnionFOQuery;
import java.util.Set;
/**
* A Backward Chaining algorithm rewrites a {@link FOQuery} according to the
* given {@link RuleBase}.
*/
public interface BackwardChainingAlgorithm {
/**
* Execute the algorithm
*
* @param query the query to rewrite
* @param rules the rules with which to rewrite the query
* @return the union of all rewritings of the query with the rules
*/
default UnionFOQuery rewrite(FOQuery extends FOFormula> query, RuleBase rules) {
return this.rewrite(new UnionFOQuery(Set.of(query)), rules);
}
/**
* Execute the algorithm
*
* @param queries the ucq to rewrite
* @param rules the rules with which to rewrite the query
* @return the union of all rewritings of the queries with the rules
*/
UnionFOQuery rewrite(UnionFOQuery queries, RuleBase rules);
}