Debian Codegraph @

Source/Control/Interface/SPARQL/CSPARQLRecordResultStreamingInterpreter.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_CSPARQLRECORDRESULTSTREAMINGINTERPRETER_H
22 #define KONCLUDE_CONTROL_INTERFACE_OWLLINK_CSPARQLRECORDRESULTSTREAMINGINTERPRETER_H
23
24 // Libraries includes
25 #include <QString>
26 #include <QDomDocument>
27 #include <QHash>
28
29 // Namespace includes
30 #include "CSPARQLResultStreamingData.h"
31 #include "CSPARQLXMLAnswerStreamingSerializer.h"
32 #include "CSPARQLStreamingWriter.h"
33
34 // Other includes
35 #include "Control/Command/CCommandRecorder.h"
36 #include "Control/Command/CCommandDelegater.h"
37
38 #include "Control/Command/Records/CClosureProcessCommandRecord.h"
39
40 #include "Control/Command/Instructions/CKnowledgeBaseQueryCommand.h"
41
42 #include "Reasoner/Query/CVariableBindingsAnswersResult.h"
43 #include "Reasoner/Query/CQueryInconsitentOntologyError.h"
44
45 #include "Reasoner/Kernel/Process/CProcessingStatistics.h"
46
47 #include "Config/CConfiguration.h"
48 #include "Config/CConfigDataReader.h"
49
50
51 // Logger includes
52 #include "Logger/CLogger.h"
53
54 using namespace Konclude::Logger;
55
56
57 namespace Konclude {
58
59 using namespace Config;
60 using namespace Reasoner::Query;
61 using namespace Reasoner::Kernel::Process;
62
63 namespace Control {
64
65 using namespace Command;
66 using namespace Instructions;
67 using namespace Records;
68
69 namespace Interface {
70
71 namespace SPARQL {
72
73 /*!
74 *
75 * \class CSPARQLRecordResultStreamingInterpreter
76 * \author Andreas Steigmiller
77 * \version 0.1
78 * \brief TODO
79 *
80 */
81 class CSPARQLRecordResultStreamingInterpreter : public CCommandDelegater, public CCommandRecorder, public CSPARQLResultStreamingController {
82 // public methods
83 public:
84 //! Constructor
85 CSPARQLRecordResultStreamingInterpreter(CSPARQLStreamingWriter* resultStreamingWriter, CCommandDelegater *commandDelegater, CConfiguration* config);
86
87 //! Destructor
88 virtual ~CSPARQLRecordResultStreamingInterpreter();
89
90 virtual CCommandDelegater *delegateCommand(CCommand *command);
91 virtual CCommandRecorder *recordData(CCommandRecordData *recData);
92
93
94 virtual bool notifyWriteRequest(cint64 sequenceNumber);
95 virtual bool canWrite();
96
97
98 // protected methods
99 protected:
100 QString getErrorString(CCommandRecordData *recData, const QString &nodeString);
101 QString getErrorLevelString(double level);
102
103
104 bool writeStreamingData(CSPARQLResultStreamingData* seqData, bool lastData);
105
106
107 // protected variables
108 protected:
109 CSPARQLStreamingWriter* mResultStreamingWriter;
110 cint64 mConfBufferSize;
111
112 QHash<CCommand*, CSPARQLResultStreamingData*> mCommandSequenceDataHash;
113 QHash<cint64, CSPARQLResultStreamingData*> mSequenceDataHash;
114 CCommandDelegater* mDelegater;
115 qint64 mNextSeqNumber;
116 qint64 mCurrentProcessingSeqNumber;
117
118 QMutex mSeqSyncMutex;
119
120
121 CConfiguration* mConfig;
122 bool mConfExtendedErrorReporting;
123
124
125 // private methods
126 private:
127
128 // private variables
129 private:
130
131 };
132
133 }; // end namespace SPARQL
134
135 }; // end namespace Interface
136
137 }; // end namespace Control
138
139 }; // end namespace Konclude
140
141 #endif // KONCLUDE_CONTROL_INTERFACE_OWLLINK_CSPARQLRECORDRESULTSTREAMINGINTERPRETER_H