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 void onInitComponent() override;
78 void onConnectComponent() override;
79
80 /**
81 * @see PropertyUser::createPropertyDefinitions()
82 */
89
90 void clear(const ::Ice::Current& = Ice::emptyCurrent) override;
91
93 getObjectAdapter() const override
94 {
95 return Component::getObjectAdapter();
96 }
97
98 // implementation of PriorKnowledgeInterface
99 PersistentObjectClassSegmentBasePrx
100 getObjectClassesSegment(const ::Ice::Current& = Ice::emptyCurrent) const override;
101
102 PersistentRelationSegmentBasePrx
103 getRelationsSegment(const ::Ice::Current& = Ice::emptyCurrent) const override;
104
105 GraphMemorySegmentBasePrx
106 getGraphSegment(const ::Ice::Current& c = Ice::emptyCurrent) const override;
107
108 CommonStorageInterfacePrx
109 getCommonStorage(const ::Ice::Current& = Ice::emptyCurrent) const override;
110
111 bool hasGraphSegment(const Ice::Current& c = Ice::emptyCurrent) const override;
112
113 bool isPriorCollection(const ::std::string& collNS,
114 const ::Ice::Current& = Ice::emptyCurrent) override;
115
116 protected:
117 CommonStorageInterfacePrx dataBasePrx;
118
122
123 void setSegmentReadCollections(const PersistentEntitySegmentBasePtr& segmentPrx,
124 const NameList& collNameList);
125
126 // MemoryInterface interface
127 public:
128 std::string getMemoryName(const Ice::Current&) const override;
129 AbstractMemorySegmentPrx addGenericSegment(const std::string& segmentName,
130 const Ice::Current&) override;
131 };
132
134
135} // 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