PriorKnowledgeImporter.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::PriorKnowledgeEditor
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#ifndef ARMARX_COMPONENT_PriorKnowledgeImporter_PriorKnowledgeImporter_H
24
27
31#include <MemoryX/interface/components/CommonStorageInterface.h>
32#include <MemoryX/interface/components/PriorKnowledgeInterface.h>
33
34namespace memoryx
35{
36
38 {
39 public:
42 {
44 "TaskName",
45 "ImportFiles",
46 "Task to perform: ImportFiles, AddParents, ConvertFormat, AddRelations")
47 .setCaseInsensitive(true);
49 "Name of directory to load files from")
50 .setCaseInsensitive(true);
52 "FilesDbName", "Name of snapshot Mongo database to load files into")
53 .setCaseInsensitive(true);
54 }
55 };
56
57 /**
58 * @brief The PriorKnowledgeImporter class is used to add object descriptions to the PriorKnowledge database.
59 */
61 {
62 public:
63 /**
64 * @see PropertyUser::createPropertyDefinitions()
65 */
72
73 // inherited from Component
74 std::string
75 getDefaultName() const override
76 {
77 return "PriorKnowledgeImporter";
78 }
79
80 void onInitComponent() override;
81 void onConnectComponent() override;
82
83 void importObjectClass(const std::string& ivFile, const std::string& className);
84
85 private:
86 PriorKnowledgeInterfacePrx memoryPrx;
87 PersistentObjectClassSegmentBasePrx classesSegmentPrx;
88 CommonStorageInterfacePrx dataBasePrx;
89
90 MongoSerializerPtr dbSerializer;
91 GridFileManagerPtr fileManager;
92
93 std::string filesDBName;
94 std::string filesDir;
95
96 void importFiles();
97 void addParents();
98 void convertToNewFormat();
99 void addRelations();
100 };
101
102} // namespace memoryx
103
104#endif
#define ARMARXCOMPONENT_IMPORT_EXPORT
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)
The PriorKnowledgeImporter class is used to add object descriptions to the PriorKnowledge database.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
std::string getDefaultName() const override
Retrieve default name of component.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
VirtualRobot headers.
IceUtil::Handle< MongoSerializer > MongoSerializerPtr
Definition EntityRef.h:41
std::shared_ptr< GridFileManager > GridFileManagerPtr