knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
GraphTerm.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_GRAPH_TERM_H
7 #define KNOWROB_GRAPH_TERM_H
8 
9 #include <iostream>
10 #include <knowrob/terms/Bindings.h>
11 
12 namespace knowrob {
16  enum class GraphTermType {
17  Sequence,
18  Union,
19  Pattern,
20  Builtin
21  };
22 
26  class GraphTerm : public Printable {
27  public:
28  virtual ~GraphTerm() = default;
29 
33  bool isPattern() const { return termType_ == GraphTermType::Pattern; }
34 
38  bool isBuiltin() const { return termType_ == GraphTermType::Builtin; }
39 
43  auto termType() const { return termType_; }
44 
45  virtual void write(std::ostream &os) const = 0;
46 
47  protected:
49 
51 
52  friend class GraphQuery;
53  };
54 
55 } // knowrob
56 
57 namespace knowrob {
58  std::shared_ptr<GraphTerm> applyBindings(const std::shared_ptr<GraphTerm> &term, const Bindings &bindings);
59 
60  std::shared_ptr<GraphTerm> operator&(const std::shared_ptr<GraphTerm> &a, const std::shared_ptr<GraphTerm> &b);
61 
62  std::shared_ptr<GraphTerm> operator|(const std::shared_ptr<GraphTerm> &a, const std::shared_ptr<GraphTerm> &b);
63 }
64 
65 #endif //v
GraphTerm(GraphTermType termType)
Definition: GraphTerm.h:50
bool isPattern() const
Definition: GraphTerm.h:33
virtual void write(std::ostream &os) const =0
bool isBuiltin() const
Definition: GraphTerm.h:38
virtual ~GraphTerm()=default
auto termType() const
Definition: GraphTerm.h:43
GraphTermType termType_
Definition: GraphTerm.h:48
TermRule & term()
Definition: terms.cpp:136
FormulaPtr operator|(const FormulaPtr &phi, const FormulaPtr &psi)
Definition: Disjunction.cpp:55
FirstOrderLiteralPtr applyBindings(const FirstOrderLiteralPtr &lit, const Bindings &bindings)
GraphTermType
Definition: GraphTerm.h:16
FormulaPtr operator&(const FormulaPtr &phi, const FormulaPtr &psi)
Definition: Conjunction.cpp:34