Debian Codegraph @

Source/Control/Loader/CSPARQLBatchFileLoader.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_CSPARQLBatchFileLoader_H
22 #define KONCLUDE_Control_LOADER_CSPARQLBatchFileLoader_H
23
24 // Libraries includes
25 #include <QString>
26 #include <QRegExp>
27 #include <QTime>
28 //#include <QTest>
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/SPARQL/CSPARQLRecordResultStreamingInterpreter.h"
38 #include "Control/Interface/SPARQL/CSPARQLStreamingWriter.h"
39
40 #include "Control/Interface/SPARQL/Events/CResultStreamingWriteEvent.h"
41
42 #include "Control/Command/CConfigManagerReader.h"
43
44 // Logger includes
45 #include "Logger/CLogger.h"
46 #include "Logger/CLogIdentifier.h"
47
48
49 #include <stdio.h>
50 #include <iostream>
51
52
53 namespace Konclude {
54
55 using namespace Logger;
56
57 namespace Control {
58
59 using namespace Interface::OWLlink;
60 using namespace Interface::SPARQL;
61 using namespace Interface::SPARQL::Events;
62 using namespace Command;
63
64 namespace Loader {
65
66 /*!
67 *
68 * \class CSPARQLBatchFileLoader
69 * \author Andreas Steigmiller
70 * \version 0.1
71 * \brief TODO
72 *
73 */
74 class CSPARQLBatchFileLoader : public CLoader, public COWLlinkProcessor, public CSPARQLStreamingWriter {
75 // public methods
76 public:
77 //! Constructor
78 CSPARQLBatchFileLoader();
79
80 //! Destructor
81 virtual ~CSPARQLBatchFileLoader();
82
83
84 virtual CLoader *init(CLoaderFactory *loaderFactory = 0, CConfiguration *config = 0);
85 virtual CLoader *load();
86 virtual CLoader *exit();
87
88
89
90 // protected methods
91 protected:
92 virtual COWLlinkProcessor *initializeOWLlinkContent();
93 virtual COWLlinkProcessor *concludeOWLlinkContent();
94
95 virtual CConfiguration *getConfiguration();
96
97 virtual bool writeStreamData(const QList<CSPARQLResultBufferWriteData>& bufferList, bool last);
98 CSPARQLStreamingWriter* writeStreamDataToFile(QList<CSPARQLResultBufferWriteData>* bufferList, bool last);
99
100 bool processCustomsEvents(QEvent::Type type, CCustomEvent *event);
101
102 // protected variables
103 protected:
104 QString reqFileString;
105 QString resFileString;
106
107 bool mConfDirectConsoleOutput;
108 bool mConfDirectErrorOutput;
109 bool mConfCloseAfterOutput;
110 bool mBlockUntilProcessed;
111 QTime mResponseTime;
112 QSemaphore mBlockingSem;
113 CSPARQLRecordResultStreamingInterpreter* mSPARQLInterpreter;
114
115 CConfiguration *mLoaderConfig;
116
117 QFile* mResponseFile;
118 bool mWritingAppendingMode;
119 bool mWritingStarted;
120 bool mWritingFailed;
121 cint64 mChunkPart;
122
123 QByteArray mStreamSPARQLHeader;
124 QByteArray mStreamSPARQLFooter;
125
126 QSemaphore* mWriteLimitSemaphore;
127 bool mBlockingWarned;
128
129
130 // private methods
131 private:
132
133 // private variables
134 private:
135
136 };
137
138 }; // end namespace Loader
139
140 }; // end namespace Control
141
142 }; // end namespace Konclude
143
144 #endif // KONCLUDE_Control_LOADER_CSPARQLBatchFileLoader_H