knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
AnswerYes.h
Go to the documentation of this file.
1 /*
2  * This file is part of KnowRob, please consult
3  * https://github.com/knowrob/knowrob for license details.
4  */
5 
6 #ifndef KNOWROB_POSITIVE_ANSWER_H
7 #define KNOWROB_POSITIVE_ANSWER_H
8 
9 #include "Answer.h"
10 #include "knowrob/formulas/FirstOrderLiteral.h"
11 #include "knowrob/formulas/FramedPredicate.h"
12 
13 namespace knowrob {
18  class AnswerYes : public Answer {
19  public:
24 
26 
31  AnswerYes(const AnswerYes &other);
32 
37  bool isRicherThan(const AnswerYes &other) const;
38 
42  bool isGenericYes() const;
43 
50  auto &substitution() const { return substitution_; }
51 
56  bool hasGrounding(const Variable &var) const { return substitution_->contains(var.name()); }
57 
65  bool addGrounding(const std::shared_ptr<Predicate> &predicate,
66  bool isNegated = false,
68 
74  auto &positiveGroundings() const { return positiveGroundings_; }
75 
81  auto &negativeGroundings() const { return negativeGroundings_; }
82 
89  bool mergeWith(const AnswerYes &other, bool ignoreInconsistencies = false);
90 
95 
100 
101  protected:
102  std::vector<FramedPredicate> positiveGroundings_;
103  std::vector<FramedPredicate> negativeGroundings_;
105  };
106 
107  // alias
108  using AnswerYesPtr = std::shared_ptr<const AnswerYes>;
109 
113  const std::shared_ptr<const AnswerYes> &GenericYes();
114 
115  AnswerPtr mergePositiveAnswers(const AnswerYesPtr &a, const AnswerYesPtr &b, bool ignoreInconsistencies);
116 
117 } // knowrob
118 
119 #endif //KNOWROB_POSITIVE_ANSWER_H
auto & frame() const
Definition: Answer.h:35
std::string humanReadableFormOfYes() const
std::vector< FramedPredicate > positiveGroundings_
Definition: AnswerYes.h:102
auto & positiveGroundings() const
Definition: AnswerYes.h:74
BindingsPtr substitution_
Definition: AnswerYes.h:104
std::string stringFormOfYes() const
auto & negativeGroundings() const
Definition: AnswerYes.h:81
bool mergeWith(const AnswerYes &other, bool ignoreInconsistencies=false)
std::vector< FramedPredicate > negativeGroundings_
Definition: AnswerYes.h:103
bool isGenericYes() const
AnswerYes(BindingsPtr substitution)
auto & substitution() const
Definition: AnswerYes.h:50
AnswerYes(const AnswerYes &other)
bool isRicherThan(const AnswerYes &other) const
bool hasGrounding(const Variable &var) const
Definition: AnswerYes.h:56
bool addGrounding(const std::shared_ptr< Predicate > &predicate, bool isNegated=false, const GraphSelectorPtr &frame=DefaultGraphSelector())
PredicateRule & predicate()
Definition: formula.cpp:221
VariableRule & var()
Definition: terms.cpp:91
TermRule & string()
Definition: terms.cpp:63
GraphSelectorPtr DefaultGraphSelector()
std::shared_ptr< const Bindings > BindingsPtr
Definition: Bindings.h:151
const std::shared_ptr< const AnswerYes > & GenericYes()
Definition: AnswerYes.cpp:161
std::shared_ptr< const GraphSelector > GraphSelectorPtr
Definition: GraphSelector.h:76
AnswerPtr mergePositiveAnswers(const AnswerYesPtr &a, const AnswerYesPtr &b, bool ignoreInconsistencies)
Definition: AnswerYes.cpp:166
std::shared_ptr< const Answer > AnswerPtr
Definition: Answer.h:129
std::shared_ptr< const AnswerYes > AnswerYesPtr
Definition: AnswerYes.h:108