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 
28 #include <MemoryX/interface/components/PriorKnowledgeInterface.h>
29 #include <MemoryX/interface/components/CommonStorageInterface.h>
30 
34 
35 namespace memoryx
36 {
37 
40  {
41  public:
44  {
45  defineOptionalProperty<std::string>("TaskName", "ImportFiles", "Task to perform: ImportFiles, AddParents, ConvertFormat, AddRelations")
46  .setCaseInsensitive(true);
47  defineRequiredProperty<std::string>("FilesDirectory", "Name of directory to load files from")
48  .setCaseInsensitive(true);
49  defineRequiredProperty<std::string>("FilesDbName", "Name of snapshot Mongo database to load files into")
50  .setCaseInsensitive(true);
51  }
52  };
53 
54 
55  /**
56  * @brief The PriorKnowledgeImporter class is used to add object descriptions to the PriorKnowledge database.
57  */
59  virtual public armarx::Component
60  {
61  public:
62 
63  /**
64  * @see PropertyUser::createPropertyDefinitions()
65  */
67  {
70  getConfigIdentifier()));
71  }
72 
73  // inherited from Component
74  std::string getDefaultName() const override
75  {
76  return "PriorKnowledgeImporter";
77  }
78  void onInitComponent() override;
79  void onConnectComponent() override;
80 
81  void importObjectClass(const std::string& ivFile, const std::string& className);
82  private:
83  PriorKnowledgeInterfacePrx memoryPrx;
84  PersistentObjectClassSegmentBasePrx classesSegmentPrx;
85  CommonStorageInterfacePrx dataBasePrx;
86 
87  MongoSerializerPtr dbSerializer;
88  GridFileManagerPtr fileManager;
89 
90  std::string filesDBName;
91  std::string filesDir;
92 
93  void importFiles();
94  void addParents();
95  void convertToNewFormat();
96  void addRelations();
97  };
98 
99 }
100 
101 #endif
memoryx::PriorKnowledgeImporterPropertyDefinitions::PriorKnowledgeImporterPropertyDefinitions
PriorKnowledgeImporterPropertyDefinitions(std::string prefix)
Definition: PriorKnowledgeImporter.h:42
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
GridFileManager.h
MongoSerializer.h
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::PriorKnowledgeImporterPropertyDefinitions
Definition: PriorKnowledgeImporter.h:38
memoryx::PriorKnowledgeImporter::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PriorKnowledgeImporter.h:66
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:95
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
memoryx::GridFileManagerPtr
std::shared_ptr< GridFileManager > GridFileManagerPtr
Definition: AbstractEntityWrapper.h:32
IceUtil::Handle< class PropertyDefinitionContainer >
memoryx::PriorKnowledgeImporter::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: PriorKnowledgeImporter.h:74
armarx::ComponentPropertyDefinitions::ComponentPropertyDefinitions
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition: Component.cpp:37
memoryx::PriorKnowledgeImporter
The PriorKnowledgeImporter class is used to add object descriptions to the PriorKnowledge database.
Definition: PriorKnowledgeImporter.h:58
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
ImportExportComponent.h