Debian Codegraph @

Source/Control/Interface/OWLlink/COWLlinkProcessor.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_CONTROL_INTERFACE_OWLLINK_COWLLINKPROCESSOR_H
22 #define KONCLUDE_CONTROL_INTERFACE_OWLLINK_COWLLINKPROCESSOR_H
23
24 // Libraries includes
25 #include <QString>
26 #include <QRegExp>
27 #include <QTime>
28 #include <QTemporaryFile>
29 #include <QBuffer>
30
31 // Namespace includes
32
33
34 // Other includes
35 #include "Reasoner/Preprocess/CLexicalNormalisationPreProcess.h"
36 #include "Reasoner/Preprocess/CNegationTransformationPreProcess.h"
37 #include "Reasoner/Preprocess/CSubroleTransformationPreProcess.h"
38 #include "Reasoner/Preprocess/COntologyAssignmentTransformationPreProcess.h"
39 #include "Reasoner/Preprocess/COntologyConfigDependedPreProcesser.h"
40
41
42 #include "Concurrent/CThread.h"
43
44 #include "Utilities/CSingletonProvider.hpp"
45
46 #include "Control/Command/CCommanderManager.h"
47 #include "Control/Command/CCommanderManagerConfigType.h"
48 #include "Control/Command/CCommandDelegater.h"
49 #include "Control/Command/CPreconditionSynchronizer.h"
50 #include "Control/Command/CConfigManagerReader.h"
51
52 #include "Control/Command/Records/CUnspecifiedMessageErrorRecord.h"
53
54 #include "Control/Command/Events/CRealizeCommandEvent.h"
55 #include "Control/Command/Events/CCommandProcessedCallbackEvent.h"
56 #include "Control/Command/Events/CInitializeEvent.h"
57
58 #include "Control/Command/Instructions/CInitializeConfigurationCommand.h"
59 #include "Control/Command/Instructions/CInitializeReasonerCommand.h"
60
61 #include "Control/Command/Instructions/CCreateKnowledgeBaseRevisionUpdateCommand.h"
62 #include "Control/Command/Instructions/CParseOWL2XMLOntologyCommand.h"
63 #include "Control/Command/Instructions/CSAXParseOWL2XMLOntologyCommand.h"
64 #include "Control/Command/Instructions/CStreamParseOWL2XMLOntologyCommand.h"
65 #include "Control/Command/Instructions/CInstallKnowledgeBaseRevisionUpdateCommand.h"
66 #include "Control/Command/Instructions/CIsSatisfiableQueryOWL2XMLNodeCommand.h"
67 #include "Control/Command/Instructions/CParseOWL2XMLQueryCommand.h"
68 #include "Control/Command/Instructions/CCalculateQueryCommand.h"
69 #include "Control/Command/Instructions/CGetCurrentKnowledgeBaseRevisionCommand.h"
70 #include "Control/Command/Instructions/CParseTestsuiteCommandsCommand.h"
71 #include "Control/Command/Instructions/CParseTestsuiteXMLNodeCommand.h"
72 #include "Control/Command/Instructions/CTestTestsuiteCommand.h"
73 #include "Control/Command/Instructions/CInsertResponseCommentCommand.h"
74 #include "Control/Command/Instructions/CConstructSubClassHirarchyQueryCommand.h"
75 #include "Control/Command/Instructions/CGetSubClassHierarchyQueryOWL2XMLNodeCommand.h"
76 #include "Control/Command/Instructions/CReadTextCommand.h"
77 #include "Control/Command/Instructions/CReadXMLCommand.h"
78 #include "Control/Command/Instructions/CParseKRSSTestConceptOntologyCommand.h"
79 #include "Control/Command/Instructions/CWriteOWL2XMLOntologyCommand.h"
80 #include "Control/Command/Instructions/CExtractToldExpressionsOntologyCommand.h"
81 #include "Control/Command/Instructions/CWriteOWLlinkOWL2XMLSatisfiableTestCommand.h"
82 #include "Control/Command/Instructions/CSaveOWLlinkOWL2XMLSatisfiableTestExtractedKnowledgeBaseCommand.h"
83 #include "Control/Command/Instructions/CLoadKnowledgeBaseOWLXMLOntologyCommand.h"
84 #include "Control/Command/Instructions/CChooseParseInstallKnowledgeBaseOWLXMLOntologyCommand.h"
85 #include "Control/Command/Instructions/CPreprocessKnowledgeBaseRequirementsForQueryCommand.h"
86 #include "Control/Command/Instructions/CGenerateQueryCommand.h"
87 #include "Control/Command/Instructions/CPrepareKnowledgeBaseForRevisionCommand.h"
88 #include "Control/Command/Instructions/CConstructFlattenedTypesQueryCommand.h"
89 #include "Control/Command/Instructions/CGetFlattenedTypesOWL2XMLNodeCommand.h"
90 #include "Control/Command/Instructions/CProcessQueryOWL2XMLNodeCommand.h"
91 #include "Control/Command/Instructions/CEvaluateTestsuiteCommand.h"
92 #include "Control/Command/Instructions/CConstructWriteFunctionalSubClassHirarchyQueryCommand.h"
93 #include "Control/Command/Instructions/CWriteFunctionalSubClassHierarchyQueryCommand.h"
94 #include "Control/Command/Instructions/CConstructIsConsistentQueryCommand.h"
95 #include "Control/Command/Instructions/CIsConsistentQueryOWL2XMLNodeCommand.h"
96 #include "Control/Command/Instructions/CConstructClassSatisfiableQueryCommand.h"
97 #include "Control/Command/Instructions/CProcessClassNameSatisfiableQueryCommand.h"
98 #include "Control/Command/Instructions/CConstructClassifyQueryCommand.h"
99 #include "Control/Command/Instructions/CClassifyQueryCommand.h"
100 #include "Control/Command/Instructions/CConstructRealizeQueryCommand.h"
101 #include "Control/Command/Instructions/CRealizeQueryCommand.h"
102 #include "Control/Command/Instructions/CGetKnowledgeBaseEntitiesCommand.h"
103 #include "Control/Command/Instructions/CExtractKnowledgeBaseEntitiesCommand.h"
104 #include "Control/Command/Instructions/CGetKnowledgeBaseLanguageCommand.h"
105 #include "Control/Command/Instructions/CExtractKnowledgeBaseLanguageCommand.h"
106 #include "Control/Command/Instructions/CWriteXMLSubClassHierarchyQueryCommand.h"
107 #include "Control/Command/Instructions/CConstructWriteXMLSubClassHirarchyQueryCommand.h"
108 #include "Control/Command/Instructions/CWriteXMLIndividualTypesQueryCommand.h"
109 #include "Control/Command/Instructions/CConstructWriteXMLIndividualTypesQueryCommand.h"
110 #include "Control/Command/Instructions/CStreamParseOWL2FunctionalOntologyCommand.h"
111 #include "Control/Command/Instructions/CLoadKnowledgeBaseOWLFunctionalOntologyCommand.h"
112 #include "Control/Command/Instructions/CLoadKnowledgeBaseOWLAutoOntologyCommand.h"
113 #include "Control/Command/Instructions/CChooseParseInstallKnowledgeBaseOWLAutoOntologyCommand.h"
114 #include "Control/Command/Instructions/CLoadKnowledgeBaseStartDownloadCommand.h"
115 #include "Control/Command/Instructions/CLoadKnowledgeBaseFinishDownloadCommand.h"
116 #include "Control/Command/Instructions/CLoadKnowledgeBaseAllDownloadedContinuer.h"
117 #include "Control/Command/Instructions/CImportKnowledgeBaseOWLAutoOntologyCommand.h"
118 #include "Control/Command/Instructions/CWriteFunctionalIndividualTypesQueryCommand.h"
119 #include "Control/Command/Instructions/CConstructWriteFunctionalIndividualTypesQueryCommand.h"
120 #include "Control/Command/Instructions/CIsTriviallyConsistentQueryCommand.h"
121 #include "Control/Command/Instructions/CConstructIsTriviallyConsistentQueryCommand.h"
122 #include "Control/Command/Instructions/CConstructWriteCustomQueryCommand.h"
123 #include "Control/Command/Instructions/CWriteCustomQueryCommand.h"
124 #include "Control/Command/Instructions/CPrepareKnowledgeBaseForQueryCommand.h"
125 #include "Control/Command/Instructions/CParseProcessSPARQLTextCommand.h"
126 #include "Control/Command/Instructions/CParseSPARQLQueryCommand.h"
127 #include "Control/Command/Instructions/CCalculateQueriesCommand.h"
128 #include "Control/Command/Instructions/CParseProcessSPARQLUpdateTextCommand.h"
129 #include "Control/Command/Instructions/CParseProcessSPARQLManageTextCommand.h"
130 #include "Control/Command/Instructions/CGetQueryDependentKnowledgeBaseRevisionUpdatesCommand.h"
131 #include "Control/Command/Instructions/CInstallQueryDependentKnowledgeBaseRevisionUpdatesCommand.h"
132 #include "Control/Command/Instructions/CConnectKnowledgeBaseExternalTriplesDSNCommand.h"
133 #include "Control/Command/Instructions/CParseInstallKnowledgeBaseExternalTriplesDSNConnectionCommand.h"
134
135
136 #include "Reasoner/Query/CWriteOREFunctionalClassSubsumptionsHierarchyQuery.h"
137 #include "Reasoner/Query/CWriteSerializerClassSubsumptionsHierarchyQuery.h"
138 #include "Reasoner/Query/CWriteSerializerPropertySubsumptionsHierarchyQuery.h"
139 #include "Reasoner/Query/CWriteSerializerIndividualFlattenedTypesQuery.h"
140 #include "Reasoner/Query/CIsConsistentQuery.h"
141 #include "Reasoner/Query/CIsTriviallyConsistentQuery.h"
142 #include "Reasoner/Query/CRealizeQuery.h"
143 #include "Reasoner/Query/CClassifyQuery.h"
144
145 #include "Parser/COWLlinkQtXMLCommandParser.h"
146 #include "Parser/COWL2QtXMLOntologyParser.h"
147 #include "Parser/COWLlinkQueryParser.h"
148 #include "Parser/CXMLTestsuiteCommandParser.h"
149 #include "Parser/COWLlinkQueryExtensionParser.h"
150 #include "Parser/COWLlinkQtXMLComplexQueryParser.h"
151 #include "Parser/COWLlinkQtXMLSimpleQueryParser.h"
152 #include "Parser/CKRSSOntologyParser.h"
153 #include "Parser/COWL2QtXMLOntologySAXParser.h"
154 #include "Parser/COWL2QtXMLOntologyStreamParser.h"
155 #include "Parser/COWL2QtXMLOntologyStableStreamParser.h"
156 #include "Parser/CSPARQLSimpleQueryParser.h"
157 #include "Parser/CSPARQLKnowledgeBaseSplittingOperationParser.h"
158 #include "Parser/CSPARQLSimpleUpdateParser.h"
159 #include "Parser/CSPARQLSimpleManagementParser.h"
160 #include "Parser/COWL2RDFTurtleAssertionsSimpleParser.h"
161 #include "Parser/CRDFRedlandRaptorParser.h"
162 #include "Parser/CRDFRedlandRaptorSimpleConcurrentParser.h"
163 #include "Parser/CSPARQLRedlandRasqalQueryParser.h"
164 #include "Parser/CRDFRedlandExternalTriplesDSNConnectingParser.h"
165 #include "Parser/COntologyMultiAutoParsingLoader.h"
166
167 #include "Parser/FunctionalJAVACC/COWL2FunctionalJAVACCOntologyStreamParser.h"
168
169 #include "Renderer/CRenderWriteManager.h"
170 #include "Renderer/COntologyExtractionManager.h"
171
172 #include "Network/HTTP/CQtHttpTransactionManager.h"
173
174
175
176 #include "Reasoner/Generator/CConcreteOntologyUpdateBuilder.h"
177 #include "Reasoner/Generator/CConcreteOntologyUpdateCollectorBuilder.h"
178 #include "Reasoner/Generator/CConcreteOntologyQueryExtendedBuilder.h"
179 #include "Reasoner/Generator/CConcreteOntologyQuerySimpleBuilder.h"
180 #include "Reasoner/Generator/CConcreteOntologyUpdateSeparateHashingCollectorBuilder.h"
181
182 #ifdef KONCLUDE_REDLAND_INTEGRATION
183 #include "Reasoner/Generator/CConcreteOntologyRedlandTriplesDataExpressionMapper.h"
184 #endif // !KONCLUDE_REDLAND_INTEGRATION
185
186 #include "Test/CReasonerTestsuiteTester.h"
187
188 #include "Test/Evaluation/CReasonerEvaluationManagerThread.h"
189
190 #include "Config/CConfiguration.h"
191
192 // Logger includes
193 #include "Logger/CLogger.h"
194 #include "Logger/CLogIdentifier.h"
195
196
197 namespace Konclude {
198
199 using namespace Logger;
200 using namespace Concurrent;
201 using namespace Utilities;
202 using namespace Parser;
203 using namespace FunctionalJAVACC;
204 using namespace Reasoner;
205 using namespace Generator;
206 using namespace Preprocess;
207 using namespace Config;
208 using namespace Renderer;
209 using namespace Query;
210 using namespace Network;
211 using namespace HTTP;
212 //using namespace Test::Evaluation;
213
214 namespace Control {
215
216 using namespace Command;
217 using namespace Instructions;
218 using namespace Events;
219 using namespace Records;
220
221 namespace Interface {
222
223 namespace OWLlink {
224
225 /*!
226 *
227 * \class COWLlinkProcessor
228 * \author Andreas Steigmiller
229 * \version 0.1
230 * \brief TODO
231 *
232 */
233 class COWLlinkProcessor : public CThread, public CCommandDelegater, public CLogIdentifier {
234 // public methods
235 public:
236 //! Constructor
237 COWLlinkProcessor(bool immediatelyStartThread = true);
238
239 //! Destructor
240 virtual ~COWLlinkProcessor();
241
242 virtual COWLlinkProcessor *startProcessing();
243
244 virtual CCommandDelegater *delegateCommand(CCommand *command);
245
246
247
248 // protected methods
249 protected:
250 bool processCustomsEvents(QEvent::Type type, CCustomEvent *event);
251
252 virtual COWLlinkProcessor *initializeOWLlinkContent() = 0;
253 virtual COWLlinkProcessor *concludeOWLlinkContent() = 0;
254
255 virtual CConfiguration *getConfiguration() = 0;
256
257
258 CQtHttpTransactionManager* getNetworkTransactionManager();
259
260 bool createDownloadParseCommands(const QString& knowledgeBaseNameString, CCommand* parentCommand, CKnowledgeBaseRevisionCommandProvider* kbProviderCommand, const QMap<QString,QString>& ontoIRIMapping, const QStringList& ontoIRIStringList, CCommandRecordRouter& commandRecordRouter);
261
262 bool parseOntology(QIODevice* device, const QString& ontoIRI, const QString& resolvedIRI, CConcreteOntology *ont, COntologyConfigurationExtension *ontConfig, QList<QString>& importOntologiesList, QStringList& parserErrorList, CCommandRecordRouter& commandRecordRouter);
263
264
265
266 // protected variables
267 protected:
268 bool mConfLoadOntologiesSAXParsing;
269 bool mConfLoadOntologiesStreamParsing;
270 CPreconditionSynchronizer *preSynchronizer;
271
272 QByteArray fileContent;
273
274 CCommanderManager *reasonerCommander;
275
276 CCommandDelegater *defaultCommandDelegater;
277
278 bool mConfLogProcessingTimes;
279
280 CQtHttpTransactionManager* mNetworkManager;
281
282 cint64 mQueryNumber = 0;
283 QString mQueryPrefix = "Unknown";
284
285 // private methods
286 private:
287
288 // private variables
289 private:
290
291 };
292
293 }; // end namespace OWLlink
294
295 }; // end namespace Interface
296
297 }; // end namespace Control
298
299 }; // end namespace Konclude
300
301 #endif // KONCLUDE_CONTROL_INTERFACE_OWLLINK_COWLLINKPROCESSOR_H