knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
ReifiedQuery.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_REIFIED_QUERY_H
7 #define KNOWROB_REIFIED_QUERY_H
8 
9 #include "knowrob/semweb/GraphQuery.h"
10 #include "knowrob/semweb/Vocabulary.h"
11 #include "knowrob/semweb/GraphPattern.h"
12 #include "knowrob/semweb/GraphUnion.h"
13 #include "knowrob/semweb/GraphSequence.h"
14 
15 namespace knowrob {
17  IncludeOriginal = 1 << 0,
18  IncludeReified = 1 << 1,
19  };
20 
25  class ReifiedQuery : public GraphQuery {
26  public:
32  explicit ReifiedQuery(const std::shared_ptr<GraphQuery> &nonReified, VocabularyPtr vocabulary, bool withFullFrame = false);
33 
39  explicit ReifiedQuery(const TriplePattern &nonReified, VocabularyPtr vocabulary, bool withFullFrame = false);
40 
44  static bool hasReifiablePattern(const std::shared_ptr<GraphQuery> &nonReified);
45 
50  static int getReificationFlags(const TriplePattern &q);
51 
52  protected:
54  uint32_t varCounter_;
55  bool withFullFrame_;
56 
57  void setNonReified(const std::shared_ptr<GraphTerm> &nonReified);
58 
59  std::shared_ptr<GraphTerm> reifiedPatternSequence(const TriplePattern &pattern);
60 
61  std::shared_ptr<GraphTerm> reifyPattern(const std::shared_ptr<GraphPattern> &nonReified);
62 
63  std::shared_ptr<GraphUnion> reifyUnion(const std::shared_ptr<GraphUnion> &graphUnion);
64 
65  std::shared_ptr<GraphSequence> reifySequence(const std::shared_ptr<GraphSequence> &graphSequence);
66 
67  void reifyConnective(const std::shared_ptr<GraphConnective> &reifiedConnective, const std::shared_ptr<GraphConnective> &originalConnective);
68 
69  static bool hasReifiablePattern(const GraphTerm *term);
70  };
71 
72 } // knowrob
73 
74 #endif //KNOWROB_REIFIED_QUERY_H
auto term() const
Definition: GraphQuery.h:48
void reifyConnective(const std::shared_ptr< GraphConnective > &reifiedConnective, const std::shared_ptr< GraphConnective > &originalConnective)
ReifiedQuery(const TriplePattern &nonReified, VocabularyPtr vocabulary, bool withFullFrame=false)
std::shared_ptr< GraphTerm > reifiedPatternSequence(const TriplePattern &pattern)
static int getReificationFlags(const TriplePattern &q)
std::shared_ptr< GraphTerm > reifyPattern(const std::shared_ptr< GraphPattern > &nonReified)
VocabularyPtr vocabulary_
Definition: ReifiedQuery.h:53
ReifiedQuery(const std::shared_ptr< GraphQuery > &nonReified, VocabularyPtr vocabulary, bool withFullFrame=false)
static bool hasReifiablePattern(const std::shared_ptr< GraphQuery > &nonReified)
static bool hasReifiablePattern(const GraphTerm *term)
std::shared_ptr< GraphUnion > reifyUnion(const std::shared_ptr< GraphUnion > &graphUnion)
void setNonReified(const std::shared_ptr< GraphTerm > &nonReified)
std::shared_ptr< GraphSequence > reifySequence(const std::shared_ptr< GraphSequence > &graphSequence)
GraphTermRule & pattern()
Definition: graph.cpp:23
@ IncludeReified
Definition: ReifiedQuery.h:18
@ IncludeOriginal
Definition: ReifiedQuery.h:17
std::shared_ptr< Vocabulary > VocabularyPtr
Definition: Vocabulary.h:233