knowrob
2.1.0
A Knowledge Base System for Cognition-enabled Robots
|
#include <PrologTerm.h>
Public Member Functions | |
PrologTerm () | |
PrologTerm (const GraphQueryPtr &query) | |
PrologTerm (const std::shared_ptr< GraphTerm > &kbTerm) | |
PrologTerm (const TermPtr &kbTerm) | |
PrologTerm (const FormulaPtr &kbFormula) | |
PrologTerm (const TriplePattern &literal, const char *triple_functor) | |
PrologTerm (const Triple &triple, std::string_view functor) | |
PrologTerm (const std::vector< PrologTerm > &args, std::string_view functor) | |
template<typename ... Args> | |
PrologTerm (std::string_view functor, Args &&... args) | |
PrologTerm (const PrologTerm &other)=default | |
term_t | operator() () const |
PrologTerm | operator& (const PrologTerm &other) const |
PrologTerm | operator| (const PrologTerm &other) const |
PrologTerm | operator~ () const |
void | setModule (std::string_view module) |
auto | module () const |
bool | putTriple (std::string_view functor, const Triple &triple) |
bool | putTerm (const TermPtr &kbTerm) |
bool | putTerm (const std::shared_ptr< GraphTerm > &kbTerm) |
bool | putFormula (const FormulaPtr &phi) |
bool | isGround () const |
auto & | vars () const |
qid_t | openQuery (int flags) const |
TermPtr | toKnowRobTerm () const |
FormulaPtr | toKnowRobFormula () const |
void | write (std::ostream &os) const override |
PrologTerm () | |
PrologTerm (const GraphQueryPtr &query) | |
PrologTerm (const std::shared_ptr< GraphTerm > &kbTerm) | |
PrologTerm (const TermPtr &kbTerm) | |
PrologTerm (const FormulaPtr &kbFormula) | |
PrologTerm (const TriplePattern &literal, const char *triple_functor) | |
PrologTerm (const Triple &triple, std::string_view functor) | |
PrologTerm (const std::vector< PrologTerm > &args, std::string_view functor) | |
template<typename ... Args> | |
PrologTerm (std::string_view functor, Args &&... args) | |
PrologTerm (const PrologTerm &other)=default | |
term_t | operator() () const |
PrologTerm | operator& (const PrologTerm &other) const |
PrologTerm | operator| (const PrologTerm &other) const |
PrologTerm | operator~ () const |
void | setModule (std::string_view module) |
auto | module () const |
bool | putTriple (std::string_view functor, const Triple &triple) |
bool | putTerm (const TermPtr &kbTerm) |
bool | putTerm (const std::shared_ptr< GraphTerm > &kbTerm) |
bool | putFormula (const FormulaPtr &phi) |
bool | isGround () const |
auto & | vars () const |
qid_t | openQuery (int flags) const |
TermPtr | toKnowRobTerm () const |
FormulaPtr | toKnowRobFormula () const |
void | write (std::ostream &os) const override |
Public Member Functions inherited from knowrob::Printable | |
virtual | ~Printable ()=default |
virtual std::string | format () const |
virtual | ~Printable ()=default |
virtual std::string | format () const |
Static Public Member Functions | |
static const atom_t & | ATOM_fail () |
static const atom_t & | ATOM_false () |
static const atom_t & | ATOM_true () |
static const atom_t & | ATOM_comma () |
static const atom_t & | ATOM_semicolon () |
static const functor_t & | FUNCTOR_comma () |
static const functor_t & | FUNCTOR_semicolon () |
static const predicate_t & | PREDICATE_comma () |
static const predicate_t & | PREDICATE_semicolon () |
static bool | nextSolution (qid_t qid) |
static TermPtr | toKnowRobTerm (const term_t &t) |
static FormulaPtr | toKnowRobFormula (const TermPtr &t) |
static std::string | getVarName (term_t plTerm) |
static PrologTerm | nil () |
static bool | display (std::ostream &os, term_t t, const std::string &indent="") |
static const atom_t & | ATOM_fail () |
static const atom_t & | ATOM_false () |
static const atom_t & | ATOM_true () |
static const atom_t & | ATOM_comma () |
static const atom_t & | ATOM_semicolon () |
static const functor_t & | FUNCTOR_comma () |
static const functor_t & | FUNCTOR_semicolon () |
static const predicate_t & | PREDICATE_comma () |
static const predicate_t & | PREDICATE_semicolon () |
static bool | nextSolution (qid_t qid) |
static TermPtr | toKnowRobTerm (const term_t &t) |
static FormulaPtr | toKnowRobFormula (const TermPtr &t) |
static std::string | getVarName (term_t plTerm) |
static PrologTerm | nil () |
static bool | display (std::ostream &os, term_t t, const std::string &indent="") |
Protected Member Functions | |
bool | putFormula (const FormulaPtr &phi, term_t plTerm) |
bool | putFunction (Function *fn, term_t pl_term) |
bool | putList (ListTerm *list, term_t pl_term) |
bool | putTerm (const TermPtr &kbTerm, term_t plTerm) |
bool | putCompound (CompoundFormula *phi, term_t pl_term, const functor_t &pl_functor) |
bool | putCompoundTerm (term_t plTerm, std::string_view functor, const std::vector< PrologTerm > &args) |
bool | putTerm (const std::shared_ptr< GraphTerm > &term, term_t plTerm) |
bool | putTriplePattern (const TriplePattern &pattern, const char *functor, term_t plTerm) |
bool | putRDFAtomic (const std::shared_ptr< Atomic > &atomic, term_t pl_term) const |
bool | putBuiltin (const std::shared_ptr< GraphBuiltin > &builtin, term_t plTerm) |
void | unifyVars (const PrologTerm &other) |
template<typename ... Args> | |
std::vector< PrologTerm > | readArgs (Args &&... args) |
bool | putFormula (const FormulaPtr &phi, term_t plTerm) |
bool | putFunction (Function *fn, term_t pl_term) |
bool | putList (ListTerm *list, term_t pl_term) |
bool | putTerm (const TermPtr &kbTerm, term_t plTerm) |
bool | putCompound (CompoundFormula *phi, term_t pl_term, const functor_t &pl_functor) |
bool | putCompoundTerm (term_t plTerm, std::string_view functor, const std::vector< PrologTerm > &args) |
bool | putTerm (const std::shared_ptr< GraphTerm > &term, term_t plTerm) |
bool | putTriplePattern (const TriplePattern &pattern, const char *functor, term_t plTerm) |
bool | putRDFAtomic (const std::shared_ptr< Atomic > &atomic, term_t pl_term) const |
bool | putBuiltin (const std::shared_ptr< GraphBuiltin > &builtin, term_t plTerm) |
void | unifyVars (const PrologTerm &other) |
template<typename ... Args> | |
std::vector< PrologTerm > | readArgs (Args &&... args) |
Static Protected Member Functions | |
static bool | putNativeAtomic (const std::shared_ptr< Atomic > &atomic, term_t pl_term) |
static bool | putNativeAtomic (const std::shared_ptr< Atomic > &atomic, term_t pl_term) |
Protected Attributes | |
std::map< Variable, term_t, std::less<> > | vars_ |
std::optional< std::string_view > | module_ |
term_t | plTerm_ |
bool | isRDFTerm_ = false |
bool | isRDFFilter_ = false |
Friends | |
class | PrologList |
A Prolog term. It can be constructed from several KnowRob datatypes and can be used to query a Prolog engine in a worker thread.
Definition at line 29 of file PrologTerm.h.
PrologTerm::PrologTerm | ( | ) |
Generates an empty Prolog term.
Definition at line 49 of file PrologTerm.cpp.
|
explicit |
Generates a Prolog term holding a graph query.
query | a graph query |
Definition at line 65 of file PrologTerm.cpp.
|
explicit |
Generates a Prolog term holding a KnowRob term.
kbTerm | a KnowRob term |
Definition at line 60 of file PrologTerm.cpp.
|
explicit |
Generates a Prolog term holding a KnowRob term.
kbTerm | a KnowRob term |
Definition at line 85 of file PrologTerm.cpp.
|
explicit |
Generates a Prolog term holding a KnowRob formula.
kbFormula | a KnowRob formula |
Definition at line 80 of file PrologTerm.cpp.
|
explicit |
literal | an RDF literal |
triple_functor | the functor of the term |
Definition at line 70 of file PrologTerm.cpp.
PrologTerm::PrologTerm | ( | const Triple & | triple, |
std::string_view | functor | ||
) |
Generates a Prolog term holding a KnowRob triple.
functor | the functor of the term |
triple | a triple |
Definition at line 55 of file PrologTerm.cpp.
PrologTerm::PrologTerm | ( | const std::vector< PrologTerm > & | args, |
std::string_view | functor | ||
) |
Generates a Prolog term holding a list of terms.
args | the list of terms |
functor | the functor of the term |
Definition at line 75 of file PrologTerm.cpp.
|
inlineexplicit |
Generates a Prolog term holding a list of terms.
Args | anything that can be converted to a PrologTerm with a single-argument constructor. |
functor | the functor of the term |
args | the list of terms |
Definition at line 132 of file PrologTerm.h.
|
default |
Copies a term handle.
knowrob::PrologTerm::PrologTerm | ( | ) |
Generates an empty Prolog term.
|
explicit |
Generates a Prolog term holding a graph query.
query | a graph query |
|
explicit |
Generates a Prolog term holding a KnowRob term.
kbTerm | a KnowRob term |
|
explicit |
Generates a Prolog term holding a KnowRob term.
kbTerm | a KnowRob term |
|
explicit |
Generates a Prolog term holding a KnowRob formula.
kbFormula | a KnowRob formula |
|
explicit |
literal | an RDF literal |
triple_functor | the functor of the term |
knowrob::PrologTerm::PrologTerm | ( | const Triple & | triple, |
std::string_view | functor | ||
) |
Generates a Prolog term holding a KnowRob triple.
functor | the functor of the term |
triple | a triple |
knowrob::PrologTerm::PrologTerm | ( | const std::vector< PrologTerm > & | args, |
std::string_view | functor | ||
) |
Generates a Prolog term holding a list of terms.
args | the list of terms |
functor | the functor of the term |
|
inlineexplicit |
Generates a Prolog term holding a list of terms.
Args | anything that can be converted to a PrologTerm with a single-argument constructor. |
functor | the functor of the term |
args | the list of terms |
Definition at line 132 of file PrologTerm.h.
|
default |
Copies a term handle.
|
static |
Definition at line 886 of file PrologTerm.cpp.
|
static |
|
static |
Definition at line 871 of file PrologTerm.cpp.
|
static |
|
static |
Definition at line 876 of file PrologTerm.cpp.
|
static |
|
static |
Definition at line 891 of file PrologTerm.cpp.
|
static |
|
static |
Definition at line 881 of file PrologTerm.cpp.
|
static |
|
static |
os | an output stream |
t | a Prolog term |
indent | an indentation string |
Definition at line 916 of file PrologTerm.cpp.
|
static |
os | an output stream |
t | a Prolog term |
indent | an indentation string |
|
static |
|
static |
|
static |
Definition at line 901 of file PrologTerm.cpp.
|
static |
|
static |
plTerm | a Prolog variable term |
Definition at line 680 of file PrologTerm.cpp.
|
static |
plTerm | a Prolog variable term |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
If this call succeeds, then vars() should hold the instantiations of the variables.
qid | the query id |
Definition at line 163 of file PrologTerm.cpp.
|
static |
If this call succeeds, then vars() should hold the instantiations of the variables.
qid | the query id |
|
static |
Definition at line 90 of file PrologTerm.cpp.
|
static |
qid_t PrologTerm::openQuery | ( | int | flags | ) | const |
flags | the flags to open the query |
Definition at line 135 of file PrologTerm.cpp.
qid_t knowrob::PrologTerm::openQuery | ( | int | flags | ) | const |
flags | the flags to open the query |
PrologTerm PrologTerm::operator& | ( | const PrologTerm & | other | ) | const |
other | a term handle |
Definition at line 96 of file PrologTerm.cpp.
PrologTerm knowrob::PrologTerm::operator& | ( | const PrologTerm & | other | ) | const |
other | a term handle |
|
inline |
|
inline |
PrologTerm PrologTerm::operator| | ( | const PrologTerm & | other | ) | const |
other | a term handle |
Definition at line 107 of file PrologTerm.cpp.
PrologTerm knowrob::PrologTerm::operator| | ( | const PrologTerm & | other | ) | const |
other | a term handle |
PrologTerm PrologTerm::operator~ | ( | ) | const |
other | a term handle |
Definition at line 118 of file PrologTerm.cpp.
PrologTerm knowrob::PrologTerm::operator~ | ( | ) | const |
other | a term handle |
|
static |
Definition at line 906 of file PrologTerm.cpp.
|
static |
|
static |
Definition at line 911 of file PrologTerm.cpp.
|
static |
|
protected |
Definition at line 476 of file PrologTerm.cpp.
|
protected |
|
protected |
Definition at line 651 of file PrologTerm.cpp.
|
protected |
|
protected |
Definition at line 214 of file PrologTerm.cpp.
|
protected |
bool PrologTerm::putFormula | ( | const FormulaPtr & | phi | ) |
phi | a KnowRob formula |
Definition at line 286 of file PrologTerm.cpp.
bool knowrob::PrologTerm::putFormula | ( | const FormulaPtr & | phi | ) |
phi | a KnowRob formula |
|
protected |
Definition at line 292 of file PrologTerm.cpp.
|
protected |
|
protected |
Definition at line 340 of file PrologTerm.cpp.
|
protected |
|
protected |
Definition at line 365 of file PrologTerm.cpp.
|
protected |
|
staticprotected |
Definition at line 611 of file PrologTerm.cpp.
|
staticprotected |
|
protected |
Definition at line 596 of file PrologTerm.cpp.
|
protected |
bool PrologTerm::putTerm | ( | const std::shared_ptr< GraphTerm > & | kbTerm | ) |
kbTerm | a KnowRob term |
Definition at line 334 of file PrologTerm.cpp.
bool knowrob::PrologTerm::putTerm | ( | const std::shared_ptr< GraphTerm > & | kbTerm | ) |
kbTerm | a KnowRob term |
|
protected |
Definition at line 378 of file PrologTerm.cpp.
|
protected |
bool PrologTerm::putTerm | ( | const TermPtr & | kbTerm | ) |
kbTerm | a KnowRob term |
Definition at line 328 of file PrologTerm.cpp.
bool knowrob::PrologTerm::putTerm | ( | const TermPtr & | kbTerm | ) |
kbTerm | a KnowRob term |
|
protected |
Definition at line 556 of file PrologTerm.cpp.
|
protected |
bool PrologTerm::putTriple | ( | std::string_view | functor, |
const Triple & | triple | ||
) |
functor | the functor of the term |
triple | a triple |
Definition at line 237 of file PrologTerm.cpp.
bool knowrob::PrologTerm::putTriple | ( | std::string_view | functor, |
const Triple & | triple | ||
) |
functor | the functor of the term |
triple | a triple |
|
protected |
Definition at line 408 of file PrologTerm.cpp.
|
protected |
|
inlineprotected |
Definition at line 297 of file PrologTerm.h.
|
inlineprotected |
Definition at line 297 of file PrologTerm.h.
|
inline |
|
inline |
module | the module to query |
Definition at line 166 of file PrologTerm.h.
FormulaPtr PrologTerm::toKnowRobFormula | ( | ) | const |
Definition at line 836 of file PrologTerm.cpp.
FormulaPtr knowrob::PrologTerm::toKnowRobFormula | ( | ) | const |
|
static |
t | a Prolog term |
Definition at line 840 of file PrologTerm.cpp.
|
static |
t | a Prolog term |
TermPtr PrologTerm::toKnowRobTerm | ( | ) | const |
Definition at line 691 of file PrologTerm.cpp.
TermPtr knowrob::PrologTerm::toKnowRobTerm | ( | ) | const |
|
static |
t | a Prolog term |
Definition at line 740 of file PrologTerm.cpp.
|
static |
t | a Prolog term |
|
protected |
Definition at line 123 of file PrologTerm.cpp.
|
protected |
|
inline |
|
inline |
|
overridevirtual |
Print this object to a stream.
os | the stream to print to. |
Implements knowrob::Printable.
Definition at line 976 of file PrologTerm.cpp.
|
overridevirtual |
|
friend |
Definition at line 305 of file PrologTerm.h.
|
protected |
Definition at line 270 of file PrologTerm.h.
|
protected |
Definition at line 269 of file PrologTerm.h.
|
protected |
Definition at line 267 of file PrologTerm.h.
|
protected |
Definition at line 268 of file PrologTerm.h.
|
protected |
Definition at line 266 of file PrologTerm.h.