Debian Codegraph @

Source/Control/Interface/SPARQL/CSPARQLXMLAnswerSerializer.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_CSPARQLXMLANSWERSERIALIZER_H
22 #define KONCLUDE_CONTROL_INTERFACE_OWLLINK_CSPARQLXMLANSWERSERIALIZER_H
23
24 // Libraries includes
25 #include <QString>
26 #include <QDomDocument>
27 #include <QMap>
28 #include <QVector>
29
30 // Namespace includes
31
32
33 #include "Reasoner/Query/CVariableBindingsAnswersResult.h"
34 #include "Reasoner/Query/CBooleanQueryResult.h"
35 #include "Reasoner/Query/CQueryStatistics.h"
36
37 #include "Reasoner/Kernel/Process/CProcessingStatistics.h"
38
39
40 // Other includes
41
42
43 // Logger includes
44 #include "Logger/CLogger.h"
45
46 using namespace Konclude::Logger;
47
48
49 namespace Konclude {
50
51 using namespace Reasoner::Query;
52 using namespace Reasoner::Kernel::Process;
53
54 namespace Control {
55
56 namespace Interface {
57
58 namespace SPARQL {
59
60 /*!
61 *
62 * \class CSPARQLXMLAnswerSerializer
63 * \author Andreas Steigmiller
64 * \version 0.1
65 * \brief TODO
66 *
67 */
68 class CSPARQLXMLAnswerSerializer {
69 // public methods
70 public:
71 //! Constructor
72 CSPARQLXMLAnswerSerializer();
73
74 //! Destructor
75 virtual ~CSPARQLXMLAnswerSerializer();
76
77
78 QByteArray serializeResult(const QStringList& varList, CVariableBindingsAnswersResult* variableBindingsAnswersResult);
79 QByteArray serializeResult(CBooleanQueryResult* booleanResult);
80
81 CSPARQLXMLAnswerSerializer* addResultSerialization(CBooleanQueryResult* booleanResult, cint64 pos);
82 CSPARQLXMLAnswerSerializer* addResultSerialization(const QStringList& varList, CVariableBindingsAnswersResult* variableBindingsAnswersResult, cint64 pos);
83 CSPARQLXMLAnswerSerializer* addResultStatistics(CQueryStatistics* queryStats, cint64 pos);
84
85 QByteArray getCombinedResultSerialization();
86
87 CSPARQLXMLAnswerSerializer* addResultError(const QString& errorString, const QString &nodeString, cint64 pos);
88
89
90 // protected methods
91 protected:
92 QList<QDomElement> getResultElements(CBooleanQueryResult* booleanResult, QDomDocument& document);
93 QList<QDomElement> getResultElements(const QStringList& varList, CVariableBindingsAnswersResult* variableBindingsAnswersResult, QDomDocument& document);
94
95 CSPARQLXMLAnswerSerializer* initializeCombinedDocument();
96
97 // protected variables
98 protected:
99 QString mAnonymousExtension;
100 QString sparqlNS;
101 QString owlNS;
102
103 QMap<cint64, QList<QDomElement> > mPosSerializedResultHash;
104 QDomDocument mCombinedDocument;
105 bool mCombinedDocumentInitialized = false;
106
107 // private methods
108 private:
109
110 // private variables
111 private:
112
113 };
114
115 }; // end namespace SPARQL
116
117 }; // end namespace Interface
118
119 }; // end namespace Control
120
121 }; // end namespace Konclude
122
123 #endif // KONCLUDE_CONTROL_INTERFACE_OWLLINK_CSPARQLXMLANSWERSERIALIZER_H