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 
34 namespace memoryx
35 {
36 
38  {
39  public:
42  {
43  defineOptionalProperty<std::string>(
44  "TaskName",
45  "ImportFiles",
46  "Task to perform: ImportFiles, AddParents, ConvertFormat, AddRelations")
47  .setCaseInsensitive(true);
48  defineRequiredProperty<std::string>("FilesDirectory",
49  "Name of directory to load files from")
50  .setCaseInsensitive(true);
51  defineRequiredProperty<std::string>(
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  */
68  {
70  new PriorKnowledgeImporterPropertyDefinitions(getConfigIdentifier()));
71  }
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
memoryx::PriorKnowledgeImporterPropertyDefinitions::PriorKnowledgeImporterPropertyDefinitions
PriorKnowledgeImporterPropertyDefinitions(std::string prefix)
Definition: PriorKnowledgeImporter.h:40
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
GridFileManager.h
MongoSerializer.h
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::PriorKnowledgeImporterPropertyDefinitions
Definition: PriorKnowledgeImporter.h:37
memoryx::PriorKnowledgeImporter::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PriorKnowledgeImporter.h:67
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
EntityAttribute.h
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
memoryx::GridFileManagerPtr
std::shared_ptr< GridFileManager > GridFileManagerPtr
Definition: AbstractEntityWrapper.h:33
IceUtil::Handle< class PropertyDefinitionContainer >
memoryx::PriorKnowledgeImporter::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: PriorKnowledgeImporter.h:75
armarx::ComponentPropertyDefinitions::ComponentPropertyDefinitions
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition: Component.cpp:35
memoryx::PriorKnowledgeImporter
The PriorKnowledgeImporter class is used to add object descriptions to the PriorKnowledge database.
Definition: PriorKnowledgeImporter.h:60
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
ImportExportComponent.h