Debian Codegraph @

Source/Parser/COWLlinkQtXMLCommandParser.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_PARSER_COWLLINKQTXMLCOMMANDPARSER_H
22 #define KONCLUDE_PARSER_COWLLINKQTXMLCOMMANDPARSER_H
23
24 // Libraries includes
25 #include <QDomDocument>
26 #include <QDomElement>
27
28 // Namespace includes
29 #include "CCommandParser.h"
30 #include "CStringPrimitiveConverter.h"
31 #include "COWLlinkQtXMLResultParser.h"
32
33
34 // Other includes
35 #include "Control/Command/Instructions/CGetDescriptionCommand.h"
36 #include "Control/Command/Instructions/CParseOWLlinkCommandsCommand.h"
37 #include "Control/Command/Instructions/CTellKnowledgeBaseOWL2XMLNodeCommand.h"
38 #include "Control/Command/Instructions/CCreateKnowledgeBaseCommand.h"
39 #include "Control/Command/Instructions/CIsSatisfiableQueryOWL2XMLNodeCommand.h"
40 #include "Control/Command/Instructions/CAreClassesEquivalentQueryOWL2XMLNodeCommand.h"
41 #include "Control/Command/Instructions/CSkipUnsupportedCommandCommand.h"
42 #include "Control/Command/Instructions/CReleaseKnowledgeBaseCommand.h"
43 #include "Control/Command/Instructions/CAreClassesDisjointQueryOWL2XMLNodeCommand.h"
44 #include "Control/Command/Instructions/CIsClassSubsumedByQueryOWL2XMLNodeCommand.h"
45 #include "Control/Command/Instructions/CIsInstanceOfQueryOWL2XMLNodeCommand.h"
46 #include "Control/Command/Instructions/CGetFlattenedTypesOWL2XMLNodeCommand.h"
47 #include "Control/Command/Instructions/CTestExtendedCalculateQueryCommand.h"
48 #include "Control/Command/Instructions/CParseTestsuiteXMLNodeCommand.h"
49 #include "Control/Command/Instructions/CInsertResponseCommentCommand.h"
50 #include "Control/Command/Instructions/CSetKnowledgeBaseConfigCommand.h"
51 #include "Control/Command/Instructions/CGetKnowledgeBaseConfigCommand.h"
52 #include "Control/Command/Instructions/CGetKnowledgeBaseSettingsCommand.h"
53 #include "Control/Command/Instructions/CGetSubClassHierarchyQueryOWL2XMLNodeCommand.h"
54 #include "Control/Command/Instructions/CLoadKnowledgeBaseKRSSTestConceptCommand.h"
55 #include "Control/Command/Instructions/CSaveOWL2XMLExtractedKnowledgeBaseCommand.h"
56 #include "Control/Command/Instructions/CSaveOWLlinkOWL2XMLSatisfiableTestExtractedKnowledgeBaseCommand.h"
57 #include "Control/Command/Instructions/CLoadKnowledgeBaseOWLXMLOntologyCommand.h"
58 #include "Control/Command/Instructions/CProcessQueryOWL2XMLNodeCommand.h"
59 #include "Control/Command/Instructions/CKnowledgeBaseClassifyCommand.h"
60 #include "Control/Command/Instructions/CKnowledgeBaseRealizeCommand.h"
61 #include "Control/Command/Instructions/CEvaluateTestsuiteCommand.h"
62 #include "Control/Command/Instructions/CIsConsistentQueryOWL2XMLNodeCommand.h"
63 #include "Control/Command/Instructions/CClassifyQueryCommand.h"
64 #include "Control/Command/Instructions/CRealizeQueryCommand.h"
65 #include "Control/Command/Instructions/CGetKnowledgeBaseClassEntitiesCommand.h"
66 #include "Control/Command/Instructions/CGetKnowledgeBaseObjectPropertyEntitiesCommand.h"
67 #include "Control/Command/Instructions/CGetKnowledgeBaseNamedIndividualEntitiesCommand.h"
68 #include "Control/Command/Instructions/CGetKnowledgeBaseLanguageCommand.h"
69 #include "Control/Command/Instructions/CLoadKnowledgeBaseOWLAutoOntologyCommand.h"
70
71 #include "Control/Command/Records/CFinishProcessCommandRecord.h"
72 #include "Control/Command/Records/CStartProcessCommandRecord.h"
73 #include "Control/Command/Records/CStopProcessCommandRecord.h"
74 #include "Control/Command/Records/CNotSupportedNodeErrorRecord.h"
75
76 #include "Control/Command/CCommandDelegater.h"
77 #include "Control/Command/CCommandProcessedPrecondition.h"
78
79 #include "Reasoner/Query/CBooleanQueryResult.h"
80 #include "Reasoner/Query/CQueryResult.h"
81
82
83 #include "Logger/CLogIdentifier.h"
84
85 #include "Config/CConfiguration.h"
86 #include "Config/CConfigDataReader.h"
87
88
89 // Logger includes
90 #include "Logger/CLogger.h"
91
92 using namespace Konclude::Logger;
93
94 using namespace std;
95
96
97 namespace Konclude {
98
99 using namespace Reasoner::Query;
100 using namespace Control::Command;
101 using namespace Instructions;
102 using namespace Records;
103 using namespace Config;
104
105 namespace Parser {
106
107
108
109
110 /*!
111 *
112 * \class COWLlinkQtXMLCommandParser
113 * \author Andreas Steigmiller
114 * \version 0.1
115 * \brief Parser for OWL/XML Files
116 *
117 */
118 class COWLlinkQtXMLCommandParser : public CCommandParser, public CLogIdentifier {
119 // public methods
120 public:
121 //! Constructor
122 COWLlinkQtXMLCommandParser(CConfiguration* config = nullptr);
123
124 //! Destructor
125 virtual ~COWLlinkQtXMLCommandParser();
126
127 virtual bool realizeCommand(CParseOWLlinkCommandsCommand *command, CCommandDelegater *commandDelegater);
128
129 virtual bool parse(const QByteArray &content);
130 virtual bool parse(QDomElement *node);
131
132 // protected methods
133 protected:
134
135 void parseOWLlinkRequestNode(QDomElement *requestNode);
136
137
138 CGetDescriptionCommand *parseGetDescriptionNode(QDomElement *descriptionNode);
139 CCreateKnowledgeBaseCommand *parseCreateKnowledgeBaseNode(QDomElement *createKBNode);
140 CTellKnowledgeBaseOWL2XMLNodeCommand *parseTellKnowledgeBaseNode(QDomElement *node);
141 CTellKnowledgeBaseOWL2XMLNodeCommand *parseRectractKnowledgeBaseNode(QDomElement *node);
142
143 CLoadKnowledgeBaseKRSSTestConceptCommand* parseLoadKnowledgeBaseKRSSTestConceptNode(QDomElement *node);
144 CLoadKnowledgeBaseOWLAutoOntologyCommand* parseLoadKnowledgeBaseOntologyNode(QDomElement *node);
145 CSaveOWL2XMLExtractedKnowledgeBaseCommand* parseSaveExtractedKnowledgeBaseNode(QDomElement *node);
146 CSaveOWLlinkOWL2XMLSatisfiableTestExtractedKnowledgeBaseCommand* parseSaveExtractedOWLlinkTestCaseKnowledgeBaseNode(QDomElement *node);
147
148
149 CProcessQueryOWL2XMLNodeCommand *parseProcessQueryNode(QDomElement *node);
150
151 CGetSubClassHierarchyQueryOWL2XMLNodeCommand *parseGetSubClassHierarchyNode(QDomElement *node);
152 CIsConsistentQueryOWL2XMLNodeCommand *parseIsConsistentNode(QDomElement *node);
153
154 CClassifyQueryCommand* parseKnowledgeBaseClassifyNode(QDomElement *node);
155 CRealizeQueryCommand* parseKnowledgeBaseRealizeNode(QDomElement *node);
156 CReleaseKnowledgeBaseCommand *parseReleaseKnowledgeBaseNode(QDomElement *node);
157 CParseTestsuiteXMLNodeCommand *parseTestTestsuiteNode(QDomElement *node);
158 CEvaluateTestsuiteCommand* parseEvaluateTestsuiteNode(QDomElement* node);
159 CInsertResponseCommentCommand *parseInsertResponseCommentNode(QDomElement *node);
160
161 CGetKnowledgeBaseLanguageCommand *parseGetKnowledgeBaseLanguageNode(QDomElement *node);
162 CGetKnowledgeBaseClassEntitiesCommand *parseGetKnowledgeBaseClassEntitiesNode(QDomElement *node);
163 CGetKnowledgeBaseObjectPropertyEntitiesCommand *parseGetKnowledgeBaseObjectPropertyEntitiesNode(QDomElement *node);
164 CGetKnowledgeBaseNamedIndividualEntitiesCommand *parseGetKnowledgeBaseIndividualEntitiesNode(QDomElement *node);
165
166 CGetConfigCommand *parseGetSettingNode(QDomElement *node);
167 CSetConfigCommand *parseSetSettingNode(QDomElement *node);
168
169 CGetSettingsCommand *parseGetSettingsNode(QDomElement *node);
170
171 void parseQueryExtensions(QDomElement *node, CKnowledgeBaseQueryCommand *queryCommand, bool inversePropDirectSupport);
172 void parseQueryExpectedResult(QDomElement *node, CKnowledgeBaseQueryCommand *queryCommand);
173
174 CQueryResult *parseQueryResult(QDomElement *node);
175
176
177 QString getOWLLinkMappedConfigString(const QString &keyName);
178
179
180 bool requiresComplexQuery(QDomElement *node, bool inversePropDirectSupport);
181
182 // protected variables
183 protected:
184 CParseOWLlinkCommandsCommand *command;
185 CCommandRecorder *recorder;
186 CCommandDelegater *delegater;
187
188 bool mConfInversePropDirectSupport;
189
190 // private methods
191 private:
192
193
194 // private variables
195 private:
196
197
198
199 };
200
201 }; // end namespace Parser
202
203 }; // end namespace Konclude
204
205 #endif // KONCLUDE_PARSER_COWLLINKQTXMLCOMMANDPARSER_H