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
29#include <MemoryX/interface/components/CommonStorageInterface.h>
30#include <MemoryX/interface/components/PriorKnowledgeInterface.h>
31
32namespace memoryx
33{
34
36 {
37 public:
39 {
41 "ClassCollections",
42 "Comma separated list of MongoDB collection (<db>.<collection>) which store known "
43 "object classes. First collection will be used for writing.");
45 "RelationCollections",
46 "",
47 "Comma separated list of MongoDB collection (<db>.<collection>) which store known "
48 "object classes relations. First collection will be used for writing.");
50 "GraphCollections",
51 "",
52 "Comma separated list of MongoDB collection (<db>.<collection>) which store "
53 "graphs. First collection will be used for writing.");
54 }
55 };
56
57 using EntityMap = std::map<std::string, EntityBasePtr>;
58
59 /*!
60 * \brief The PriorKnowledge class provides a database with common sense and/or prior knowldge.
61 *
62 * See \ref priorknowledge "memoryx::PriorKnowledge" - common sense knowledge database.
63 */
65 virtual public PriorKnowledgeInterface,
66 virtual public SegmentedMemory,
67 virtual public armarx::Component
68 {
69 public:
70 // inherited from Component
71 std::string
72 getDefaultName() const override
73 {
74 return "PriorKnowledge";
75 }
76
77 static std::string GetDefaultName();
78
79 void onInitComponent() override;
80 void onConnectComponent() override;
81
82 /**
83 * @see PropertyUser::createPropertyDefinitions()
84 */
91
92 void clear(const ::Ice::Current& = Ice::emptyCurrent) override;
93
95 getObjectAdapter() const override
96 {
97 return Component::getObjectAdapter();
98 }
99
100 // implementation of PriorKnowledgeInterface
101 PersistentObjectClassSegmentBasePrx
102 getObjectClassesSegment(const ::Ice::Current& = Ice::emptyCurrent) const override;
103
104 PersistentRelationSegmentBasePrx
105 getRelationsSegment(const ::Ice::Current& = Ice::emptyCurrent) const override;
106
107 GraphMemorySegmentBasePrx
108 getGraphSegment(const ::Ice::Current& c = Ice::emptyCurrent) const override;
109
110 CommonStorageInterfacePrx
111 getCommonStorage(const ::Ice::Current& = Ice::emptyCurrent) const override;
112
113 bool hasGraphSegment(const Ice::Current& c = Ice::emptyCurrent) const override;
114
115 bool isPriorCollection(const ::std::string& collNS,
116 const ::Ice::Current& = Ice::emptyCurrent) override;
117
118 protected:
119 CommonStorageInterfacePrx dataBasePrx;
120
124
125 void setSegmentReadCollections(const PersistentEntitySegmentBasePtr& segmentPrx,
126 const NameList& collNameList);
127
128 // MemoryInterface interface
129 public:
130 std::string getMemoryName(const Ice::Current&) const override;
131 AbstractMemorySegmentPrx addGenericSegment(const std::string& segmentName,
132 const Ice::Current&) override;
133 };
134
136
137} // namespace memoryx
#define ARMARXCOMPONENT_IMPORT_EXPORT
constexpr T c
Default component property definition container.
Definition Component.h:70
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
PropertyDefinition< PropertyType > & defineRequiredProperty(const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
PriorKnowledgePropertyDefinitions(std::string prefix)
The PriorKnowledge class provides a database with common sense and/or prior knowldge.
CommonStorageInterfacePrx dataBasePrx
AbstractMemorySegmentPrx addGenericSegment(const std::string &segmentName, const Ice::Current &) override
void setSegmentReadCollections(const PersistentEntitySegmentBasePtr &segmentPrx, const NameList &collNameList)
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Ice::ObjectAdapterPtr getObjectAdapter() const override
std::string getMemoryName(const Ice::Current &) const override
std::string getDefaultName() const override
Retrieve default name of component.
::IceInternal::Handle<::Ice::ObjectAdapter > ObjectAdapterPtr
Definition IceManager.h:52
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
VirtualRobot headers.
IceUtil::Handle< PriorKnowledge > PriorKnowledgePtr
std::map< std::string, EntityBasePtr > EntityMap