PriorKnowledge.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package MemoryX::PriorKnowledge
17 * @author Alexey Kozlov ( kozlov at kit dot edu)
18 * @date 2012
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
27 #include <MemoryX/interface/components/PriorKnowledgeInterface.h>
28 #include <MemoryX/interface/components/CommonStorageInterface.h>
29 
31 
32 
33 namespace memoryx
34 {
35 
38  {
39  public:
42  {
43  defineRequiredProperty<std::string>("ClassCollections", "Comma separated list of MongoDB collection (<db>.<collection>) which store known object classes. First collection will be used for writing.");
44  defineOptionalProperty<std::string>("RelationCollections", "", "Comma separated list of MongoDB collection (<db>.<collection>) which store known object classes relations. First collection will be used for writing.");
45  defineOptionalProperty<std::string>("GraphCollections", "", "Comma separated list of MongoDB collection (<db>.<collection>) which store graphs. First collection will be used for writing.");
46  }
47  };
48 
49 
50  using EntityMap = std::map<std::string, EntityBasePtr>;
51 
52  /*!
53  * \brief The PriorKnowledge class provides a database with common sense and/or prior knowldge.
54  *
55  * See \ref priorknowledge "memoryx::PriorKnowledge" - common sense knowledge database.
56  */
58  virtual public PriorKnowledgeInterface,
59  virtual public SegmentedMemory,
60  virtual public armarx::Component
61  {
62  public:
63  // inherited from Component
64  std::string getDefaultName() const override
65  {
66  return "PriorKnowledge";
67  }
68  void onInitComponent() override;
69  void onConnectComponent() override;
70 
71  /**
72  * @see PropertyUser::createPropertyDefinitions()
73  */
75  {
78  getConfigIdentifier()));
79  }
80 
81  void clear(const ::Ice::Current& = Ice::emptyCurrent) override;
83  {
84  return Component::getObjectAdapter();
85  }
86 
87  // implementation of PriorKnowledgeInterface
88  PersistentObjectClassSegmentBasePrx getObjectClassesSegment(const ::Ice::Current& = Ice::emptyCurrent) const override;
89 
90  PersistentRelationSegmentBasePrx getRelationsSegment(const ::Ice::Current& = Ice::emptyCurrent) const override;
91 
92  GraphMemorySegmentBasePrx getGraphSegment(const ::Ice::Current& c = Ice::emptyCurrent) const override;
93 
94  CommonStorageInterfacePrx getCommonStorage(const ::Ice::Current& = Ice::emptyCurrent) const override;
95 
96  bool hasGraphSegment(const Ice::Current& c = Ice::emptyCurrent) const override;
97 
98  bool isPriorCollection(const ::std::string& collNS, const ::Ice::Current& = Ice::emptyCurrent) override;
99 
100  protected:
101  CommonStorageInterfacePrx dataBasePrx;
102 
103  NameList classCollNames;
105  NameList graphCollNames;
106 
107  void setSegmentReadCollections(const PersistentEntitySegmentBasePtr& segmentPrx, const NameList& collNameList);
108 
109  // MemoryInterface interface
110  public:
111  std::string getMemoryName(const Ice::Current&) const override;
112  AbstractMemorySegmentPrx addGenericSegment(const std::string& segmentName, const Ice::Current&) override;
113  };
114 
116 
117 }
118 
memoryx::EntityMap
std::map< std::string, EntityBasePtr > EntityMap
Definition: PriorKnowledge.h:50
SegmentedMemory.h
memoryx::PriorKnowledge::relationCollNames
NameList relationCollNames
Definition: PriorKnowledge.h:104
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
memoryx::PriorKnowledge::getObjectAdapter
Ice::ObjectAdapterPtr getObjectAdapter() const override
Definition: PriorKnowledge.h:82
memoryx::SegmentedMemory
The SegmentedMemory class provides an interface for organizing memories with segmented data structure...
Definition: SegmentedMemory.h:45
IceInternal::Handle< ::Ice::ObjectAdapter >
memoryx::PriorKnowledge::dataBasePrx
CommonStorageInterfacePrx dataBasePrx
Definition: PriorKnowledge.h:101
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
memoryx::PriorKnowledgePropertyDefinitions::PriorKnowledgePropertyDefinitions
PriorKnowledgePropertyDefinitions(std::string prefix)
Definition: PriorKnowledge.h:40
memoryx::PriorKnowledge
The PriorKnowledge class provides a database with common sense and/or prior knowldge.
Definition: PriorKnowledge.h:57
memoryx::PriorKnowledge::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: PriorKnowledge.h:64
memoryx::PriorKnowledge::classCollNames
NameList classCollNames
Definition: PriorKnowledge.h:103
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
memoryx::PriorKnowledge::graphCollNames
NameList graphCollNames
Definition: PriorKnowledge.h:105
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::ComponentPropertyDefinitions::ComponentPropertyDefinitions
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition: Component.cpp:37
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
memoryx::PriorKnowledge::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PriorKnowledge.h:74
memoryx::PriorKnowledgePropertyDefinitions
Definition: PriorKnowledge.h:36
ImportExportComponent.h