Debian Codegraph @

Source/Control/Loader/COREBatchProcessingLoader.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_LOADER_COREBATCHPROCESSINGLOADER_H
22 #define KONCLUDE_CONTROL_LOADER_COREBATCHPROCESSINGLOADER_H
23
24 // Libraries includes
25 #include <QString>
26 #include <QRegExp>
27 #include <QTime>
28 #include <QDir>
29
30 // Namespace includes
31 #include "LoaderSettings.h"
32 #include "CLoader.h"
33 #include "CLoaderFactory.h"
34
35 // Other includes
36 #include "Control/Interface/OWLlink/COWLlinkProcessor.h"
37 #include "Control/Interface/OWLlink/COWLLinkRecordInterpreter.h"
38
39 #include "Control/Command/CConfigManagerReader.h"
40
41 #include "Reasoner/Query/CWriteQueryFileOWL2XMLSerializer.h"
42 #include "Reasoner/Query/CWriteQueryFileOWL2FunctionalSerializer.h"
43
44 // Logger includes
45 #include "Logger/CLogger.h"
46 #include "Logger/CLogIdentifier.h"
47 #include "Logger/COREConsolePrintLogObserver.h"
48 #include "Logger/COREFilePrintLogObserver.h"
49
50
51 #include <stdio.h>
52 #include <iostream>
53
54
55 namespace Konclude {
56
57 using namespace Logger;
58
59 namespace Control {
60
61 using namespace Interface::OWLlink;
62 using namespace Command;
63
64 namespace Loader {
65
66 /*!
67 *
68 * \class COREBatchProcessingLoader
69 * \author Andreas Steigmiller
70 * \version 0.1
71 * \brief TODO
72 *
73 */
74 class COREBatchProcessingLoader : public CLoader, public COWLlinkProcessor, public CCommandRecorder {
75 // public methods
76 public:
77 //! Constructor
78 COREBatchProcessingLoader();
79
80 //! Destructor
81 virtual ~COREBatchProcessingLoader();
82
83
84 virtual CLoader *init(CLoaderFactory *loaderFactory = 0, CConfiguration *config = 0);
85 virtual CLoader *load();
86 virtual CLoader *exit();
87
88 virtual CCommandRecorder *recordData(CCommandRecordData *recData);
89
90
91 // protected methods
92 protected:
93
94 class CCommandProcessData {
95 public:
96 CCommandProcessData(CCommand* command){
97 mCommand = command;
98 mMeasureTime = false;
99 mWriteSatisfiableOutput = false;
100 }
101 CCommandProcessData(CCommand* command, bool measureTime, const QString& measuredOutputString) {
102 mCommand = command;
103 mMeasureTime = measureTime;
104 mMeasuredOutputString = measuredOutputString;
105 mWriteSatisfiableOutput = false;
106 }
107 CCommandProcessData(CCommand* command, bool measureTime, const QString& measuredOutputString, bool writeSatisfiabilityOutput, const QString& outputFileName) {
108 mCommand = command;
109 mMeasureTime = measureTime;
110 mMeasuredOutputString = measuredOutputString;
111 mWriteSatisfiableOutput = writeSatisfiabilityOutput;
112 mWriteOutputFile = outputFileName;
113 }
114 public:
115 CCommand* mCommand;
116 bool mMeasureTime;
117 QString mMeasuredOutputString;
118 bool mWriteSatisfiableOutput;
119 QString mWriteOutputFile;
120 };
121
122 virtual COWLlinkProcessor* initializeOWLlinkContent();
123 virtual COWLlinkProcessor* concludeOWLlinkContent();
124
125 virtual CConfiguration* getConfiguration();
126
127
128 void createClassificationTestingCommands();
129 void createConsistencyTestingCommands();
130 void createRealisationTestingCommands();
131 void createSatisfiabilityTesingCommands();
132
133 void addProcessingCommand(CCommand* command);
134 void addProcessingCommand(CCommand* command, bool measureTime, const QString& measuredOutputString);
135 void addProcessingCommand(CCommand* command, bool measureTime, const QString& measuredOutputString, bool writeSatisfiabilityOutput, const QString& outputFileName);
136
137 bool hasMoreProcessingCommands();
138 void terminateProcessing();
139 void processNextCommand();
140 void finishCommandProcessing();
141
142 void logOutputNotice(const QString& outputString);
143 void logOutputMessage(const QString& outputString);
144 void logOutputError(const QString& errorString);
145
146 void writeSatisfiabilityResult(const QString& outputFileName, CCommand* processedCommand);
147 void forcedPathCreated(const QString& filePath);
148
149 // protected variables
150 protected:
151 QString mOperationTaskString;
152 QString mIRINameString;
153
154 QString mOntologyFileString;
155 QString mResponseFileString;
156
157 QString mWriteSatisfiabilityPrefixString;
158
159 CLogIdentifier mORELogIdentifier;
160
161 QList<CCommandProcessData*> mProcessCommandList;
162 CCommandProcessData* mProcessingCommandData;
163
164
165 bool mCloseAfterOutput;
166 bool mOutputMeasuredTimeInSeconds;
167 bool mBlockUntilProcessed;
168 QTime mMeasurementTime;
169 QSemaphore mBlockingSemaphore;
170 COWLLinkRecordInterpreter* mOWLLinkInterpreter;
171
172 bool mReportParsingTimeForConsistency;
173 bool mReportParsingTimeForClassification;
174 bool mReportParsingTimeForRealisation;
175 bool mReportParsingTimeForSatisfiability;
176
177 bool mReportAllTime;
178
179
180 CConfiguration* mLoaderConfig;
181
182
183 QString mOperationTimeOutputString;
184
185
186 QString mProcessingOperationString;
187 QString mSatOperationString;
188 QString mSatisfiabilityOperationString;
189 QString mQueryOperationString;
190 QString mClassificationOperationString;
191 QString mConsistencyOperationString;
192 QString mRealisationOperationString;
193 QString mRealizationOperationString;
194
195
196 COREConsolePrintLogObserver* mInfoConsoleObserver;
197 COREFilePrintLogObserver* mErrorFileObserver;
198
199
200 CIsConsistentQueryCommand* mConsistencyKBCommand;
201 CIsTriviallyConsistentQueryCommand* mTriviallyConsistencyKBCommand;
202 cint64 mAdditionalCheckingTime;
203
204 // private methods
205 private:
206
207 // private variables
208 private:
209
210 };
211
212 }; // end namespace Loader
213
214 }; // end namespace Control
215
216 }; // end namespace Konclude
217
218 #endif // KONCLUDE_CONTROL_LOADER_COREBATCHPROCESSINGLOADER_H