Debian Codegraph @

Source/Reasoner/Revision/CSPOntologyRevisionManager.h

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #ifndef KONCLUDE_REASONER_REVISION_CSPONTOLOGYREVISIONMANAGER_H
22 #define KONCLUDE_REASONER_REVISION_CSPONTOLOGYREVISIONMANAGER_H
23
24 // Libraries includes
25 #include <QString>
26 #include <QHash>
27 #include <QUuid>
28
29 // Namespace includes
30 #include "COntologyRevisionManager.h"
31
32 // Other includes
33 #include "Reasoner/Revision/Persistence/COntologyRevisionPersistencer.h"
34
35 #include "Reasoner/Classifier/CClassificationManager.h"
36
37 #include "Reasoner/Ontology/CConcreteOntology.h"
38 #include "Reasoner/Ontology/CMBox.h"
39
40 #include "Control/Command/Instructions/CCreateKnowledgeBaseCommand.h"
41 #include "Control/Command/Instructions/CCreateKnowledgeBaseRevisionUpdateCommand.h"
42 #include "Control/Command/Instructions/CInstallKnowledgeBaseRevisionUpdateCommand.h"
43 #include "Control/Command/Instructions/CGetCurrentKnowledgeBaseRevisionCommand.h"
44 #include "Control/Command/Instructions/CReleaseKnowledgeBaseCommand.h"
45 #include "Control/Command/Instructions/CGetKnowledgeBaseConfigCommand.h"
46 #include "Control/Command/Instructions/CSetKnowledgeBaseConfigCommand.h"
47 #include "Control/Command/Instructions/CGetKnowledgeBaseSettingsCommand.h"
48
49 #include "Control/Command/CCommandRecordRouter.h"
50 #include "Control/Command/CConfigManagerReader.h"
51
52
53 #include "Control/Command/Records/CStartProcessCommandRecord.h"
54 #include "Control/Command/Records/CStopProcessCommandRecord.h"
55 #include "Control/Command/Records/CFinishProcessCommandRecord.h"
56 #include "Control/Command/Records/CUnspecifiedMessageErrorRecord.h"
57
58 #include "Config/CConfigurationProvider.h"
59 #include "Config/CConfigDataReader.h"
60
61 #include "Reasoner/Generator/CConcreteOntologyBasementBuilder.h"
62 #include "Reasoner/Generator/CConcreteOntologyMergingBuilder.h"
63 #include "Reasoner/Generator/CConcreteOntologyMergingRebuildingBuilder.h"
64
65 #include "Reasoner/Preprocess/COntologyConfigDependedPreProcesser.h"
66
67 // Logger includes
68 #include "Logger/CLogger.h"
69 #include "Logger/CLogIdentifier.h"
70
71
72 namespace Konclude {
73
74 using namespace Logger;
75 using namespace Config;
76 using namespace Utilities;
77 using namespace Control::Command::Instructions;
78 using namespace Control::Command::Records;
79 using namespace Control::Command;
80
81 namespace Reasoner {
82
83 using namespace Ontology;
84 using namespace Classifier;
85 using namespace Generator;
86 using namespace Preprocess;
87
88 namespace Revision {
89
90 using namespace Persistence;
91
92 /*!
93 *
94 * \class CSPOntologyRevisionManager
95 * \author Andreas Steigmiller
96 * \version 0.1
97 * \brief TODO
98 *
99 */
100 class CSPOntologyRevisionManager : public COntologyRevisionManager, public CLogIdentifier {
101 // public methods
102 public:
103 //! Constructor
104 CSPOntologyRevisionManager(COntologyRevisionPersistencer* persistencer = nullptr);
105
106 //! Destructor
107 virtual ~CSPOntologyRevisionManager();
108
109 virtual COntologyRevisionManager *initializeManager(CConfigurationProvider *configurationProvider);
110
111 virtual qint64 getOntologyCount();
112
113 virtual CCommandDelegater *delegateCommand(CCommand *command);
114
115
116 // protected methods
117 protected:
118 CConcreteOntology* getBasementOntology(CCommandRecordRouter& commandRecordRouter);
119
120 COntologyRevision* createNewOntologyRevisionFromBasementOntology(const QString& ontologyName, CCommandRecordRouter& commandRecordRouter);
121
122 COntologyRevision* createNewOntologyRevision(const QString& ontologyName, bool forceCreation, bool reportError, CCommandRecordRouter& commandRecordRouter);
123 QString createNewOntology(const QString& ontologyName, QList<CNamePrefix*>* prefixList, CCommandRecordRouter& commandRecordRouter);
124
125 bool checkHasOntology(const QString& ontologyName);
126
127 // protected variables
128 protected:
129 qint64 nextOntologyID;
130 qint64 ontologyCount;
131 qint64 nextRevisionPathID;
132
133 QHash<qint64,COntologyRevision *> revisionHash;
134 QHash<QString,qint64> nameIDHash;
135
136 QSet<COntologyRevision *> onRevContainer;
137
138 qint64 nextUnamedOntologyNumber;
139
140 CConfigurationProvider *confProvider;
141
142 CClassificationManager *classificationMan;
143
144 CConcreteOntology* mBaseOnto;
145
146 QString mLastOntologyRevisionUpdateKBNameOrNewAnonymous;
147 QString mLastOntologyRevisionUpdateKBName;
148 QString mLastOntologyCreatedKBName;
149 QString mFirstOntologyRevisionUpdateKBName;
150 QString mFirstOntologyCreatedKBName;
151 bool mHasFirstCreatedOntology;
152 bool mHasFirstOntologyRevisionUpdate;
153
154
155 COntologyRevisionPersistencer* mOntoRevPersistencer;
156
157 // private methods
158 private:
159
160 // private variables
161 private:
162
163 };
164
165 }; // end namespace Revision
166
167 }; // end namespace Reasoner
168
169 }; // end namespace Konclude
170
171 #endif // KONCLUDE_REASONER_REVISION_CSPONTOLOGYREVISIONMANAGER_H