knowrob
2.1.0
A Knowledge Base System for Cognition-enabled Robots
|
Prolog-based inference integrates nicely in KnowRob query evaluation. The data structures used by KnowRob can easily be mapped to Prolog terms and ice versa.
Prolog uses its owl in-memory triple store, and the common way would be to load triples from the KnowRob triple store into Prolog such that Prolog can reason over them. However, Prolog can also interact with other data backends in theory, but due to the way how query evaluation works via backtracking, the overhead of performing evaluation with external data backends can be high.
To use the PrologReasoner
with your own rules, you need to create a Prolog file that defines the rules and register them in the configuration file. An example of such a file is shown below.
It configures the PrologReasoner
to use the Prolog:rdf_db
backend and to import the lpn.pl
and lpn.owl
files.
Prolog rules can then be linked to KnowRob through RDF predicates. The following example shows how to define a Prolog rule in a file lpn.pl
and link it to KnowRob.
It defines a rule that states that two persons are jealous of each other if they both love the same person. The rule is registered as a computable predicate lpn:jealous
and can be used in KnowRob queries.