knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
knowrob::ConjunctiveQuery Class Reference

#include <ConjunctiveQuery.h>

Inheritance diagram for knowrob::ConjunctiveQuery:
Collaboration diagram for knowrob::ConjunctiveQuery:

Public Member Functions

 ConjunctiveQuery (const std::vector< FirstOrderLiteralPtr > &query, const QueryContextPtr &ctx=DefaultQueryContext())
 
 ConjunctiveQuery (const FirstOrderLiteralPtr &query, const QueryContextPtr &ctx)
 
auto & formula () const
 
auto & literals () const
 
void write (std::ostream &os) const override
 
 ConjunctiveQuery (const std::vector< FirstOrderLiteralPtr > &query, const QueryContextPtr &ctx=DefaultQueryContext())
 
 ConjunctiveQuery (const FirstOrderLiteralPtr &query, const QueryContextPtr &ctx)
 
auto & formula () const
 
auto & literals () const
 
void write (std::ostream &os) const override
 
- Public Member Functions inherited from knowrob::Query
 Query (QueryContextPtr ctx=DefaultQueryContext())
 
virtual ~Query ()=default
 
auto & ctx () const
 
void setContext (QueryContextPtr ctx)
 
 Query (QueryContextPtr ctx=DefaultQueryContext())
 
virtual ~Query ()=default
 
auto & ctx () const
 
void setContext (QueryContextPtr ctx)
 
- Public Member Functions inherited from knowrob::Printable
virtual ~Printable ()=default
 
virtual std::string format () const
 
virtual ~Printable ()=default
 
virtual std::string format () const
 

Protected Member Functions

 ConjunctiveQuery (const QueryContextPtr &ctx=DefaultQueryContext())
 
 ConjunctiveQuery (const QueryContextPtr &ctx=DefaultQueryContext())
 

Protected Attributes

SimpleConjunctionPtr formula_
 
- Protected Attributes inherited from knowrob::Query
QueryContextPtr ctx_
 

Detailed Description

A Query that is constructed from a sequence of literals which are considered to be in a conjunction. The literals are part of a dependency group, meaning that they are connected through free variables.

Definition at line 19 of file ConjunctiveQuery.h.

Constructor & Destructor Documentation

◆ ConjunctiveQuery() [1/6]

ConjunctiveQuery::ConjunctiveQuery ( const std::vector< FirstOrderLiteralPtr > &  query,
const QueryContextPtr ctx = DefaultQueryContext() 
)
explicit
Parameters
queryan ordered sequence of triple patterns.
ctxthe query context.

Definition at line 18 of file ConjunctiveQuery.cpp.

19  : Query(ctx),
20  formula_(std::make_shared<SimpleConjunction>(query)) {
21 }
SimpleConjunctionPtr formula_
auto & ctx() const
Definition: Query.h:41
Query(QueryContextPtr ctx=DefaultQueryContext())
Definition: Query.h:34

◆ ConjunctiveQuery() [2/6]

ConjunctiveQuery::ConjunctiveQuery ( const FirstOrderLiteralPtr query,
const QueryContextPtr ctx 
)
explicit
Parameters
querya single triple pattern.
ctxthe query context.

Definition at line 13 of file ConjunctiveQuery.cpp.

14  : Query(ctx),
15  formula_(std::make_shared<SimpleConjunction>(query)) {
16 }

◆ ConjunctiveQuery() [3/6]

knowrob::ConjunctiveQuery::ConjunctiveQuery ( const QueryContextPtr ctx = DefaultQueryContext())
inlineexplicitprotected

Definition at line 50 of file ConjunctiveQuery.h.

50 : Query(ctx) {}

◆ ConjunctiveQuery() [4/6]

knowrob::ConjunctiveQuery::ConjunctiveQuery ( const std::vector< FirstOrderLiteralPtr > &  query,
const QueryContextPtr ctx = DefaultQueryContext() 
)
explicit
Parameters
queryan ordered sequence of triple patterns.
ctxthe query context.

◆ ConjunctiveQuery() [5/6]

knowrob::ConjunctiveQuery::ConjunctiveQuery ( const FirstOrderLiteralPtr query,
const QueryContextPtr ctx 
)
explicit
Parameters
querya single triple pattern.
ctxthe query context.

◆ ConjunctiveQuery() [6/6]

knowrob::ConjunctiveQuery::ConjunctiveQuery ( const QueryContextPtr ctx = DefaultQueryContext())
inlineexplicitprotected

Definition at line 50 of file ConjunctiveQuery.h.

50 : Query(ctx) {}

Member Function Documentation

◆ formula() [1/2]

auto& knowrob::ConjunctiveQuery::formula ( ) const
inline
Returns
the formula of the query.

Definition at line 37 of file ConjunctiveQuery.h.

37 { return formula_; }

◆ formula() [2/2]

auto& knowrob::ConjunctiveQuery::formula ( ) const
inline
Returns
the formula of the query.

Definition at line 37 of file ConjunctiveQuery.h.

37 { return formula_; }

◆ literals() [1/2]

auto& knowrob::ConjunctiveQuery::literals ( ) const
inline
Returns
the literals of the formula.

Definition at line 42 of file ConjunctiveQuery.h.

42 { return formula_->literals(); }

◆ literals() [2/2]

auto& knowrob::ConjunctiveQuery::literals ( ) const
inline
Returns
the literals of the formula.

Definition at line 42 of file ConjunctiveQuery.h.

42 { return formula_->literals(); }

◆ write() [1/2]

void ConjunctiveQuery::write ( std::ostream &  os) const
overridevirtual

Print this object to a stream.

Parameters
osthe stream to print to.

Implements knowrob::Printable.

Definition at line 23 of file ConjunctiveQuery.cpp.

23  {
24  os << *formula_;
25 }

◆ write() [2/2]

void knowrob::ConjunctiveQuery::write ( std::ostream &  os) const
overridevirtual

Print this object to a stream.

Parameters
osthe stream to print to.

Implements knowrob::Printable.

Member Data Documentation

◆ formula_

SimpleConjunctionPtr knowrob::ConjunctiveQuery::formula_
protected

Definition at line 48 of file ConjunctiveQuery.h.


The documentation for this class was generated from the following files: