| 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_COWLLINKRECORDINTERPRETER_H |
| 22 |
#define KONCLUDE_Control_Interface_OWLLINK_COWLLINKRECORDINTERPRETER_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
#include <QString> |
| 26 |
#include <QDomDocument> |
| 27 |
#include <QHash> |
| 28 |
|
| 29 |
// Namespace includes |
| 30 |
#include "Control/Command/CCommandRecorder.h" |
| 31 |
#include "Control/Command/CCommandDelegater.h" |
| 32 |
|
| 33 |
#include "Control/Command/Records/CClosureProcessCommandRecord.h" |
| 34 |
|
| 35 |
#include "Control/Command/Instructions/CGetDescriptionCommand.h" |
| 36 |
#include "Control/Command/Instructions/CTellKnowledgeBaseOWL2XMLNodeCommand.h" |
| 37 |
#include "Control/Command/Instructions/CCreateKnowledgeBaseCommand.h" |
| 38 |
#include "Control/Command/Instructions/CIsSatisfiableQueryOWL2XMLNodeCommand.h" |
| 39 |
#include "Control/Command/Instructions/CSkipUnsupportedCommandCommand.h" |
| 40 |
#include "Control/Command/Instructions/CReleaseKnowledgeBaseCommand.h" |
| 41 |
#include "Control/Command/Instructions/CTestExtendedCalculateQueryCommand.h" |
| 42 |
#include "Control/Command/Instructions/CParseTestsuiteXMLNodeCommand.h" |
| 43 |
#include "Control/Command/Instructions/CTestTestsuiteCommand.h" |
| 44 |
#include "Control/Command/Instructions/CInsertResponseCommentCommand.h" |
| 45 |
#include "Control/Command/Instructions/CSetConfigCommand.h" |
| 46 |
#include "Control/Command/Instructions/CGetConfigCommand.h" |
| 47 |
#include "Control/Command/Instructions/CGetSettingsCommand.h" |
| 48 |
#include "Control/Command/Instructions/CLoadKnowledgeBaseKRSSTestConceptCommand.h" |
| 49 |
#include "Control/Command/Instructions/CKnowledgeBaseProcessCommand.h" |
| 50 |
#include "Control/Command/Instructions/CGetKnowledgeBaseClassEntitiesCommand.h" |
| 51 |
#include "Control/Command/Instructions/CGetKnowledgeBaseObjectPropertyEntitiesCommand.h" |
| 52 |
#include "Control/Command/Instructions/CGetKnowledgeBaseNamedIndividualEntitiesCommand.h" |
| 53 |
#include "Control/Command/Instructions/CGetKnowledgeBaseLanguageCommand.h" |
| 54 |
|
| 55 |
#include "Reasoner/Query/CClassHierarchyResult.h" |
| 56 |
#include "Reasoner/Query/CClassesResult.h" |
| 57 |
#include "Reasoner/Query/CIndividualsResult.h" |
| 58 |
#include "Reasoner/Query/CClassSynsetsResult.h" |
| 59 |
#include "Reasoner/Query/CIndividualSynsetsResult.h" |
| 60 |
#include "Reasoner/Query/CQueryInconsitentOntologyError.h" |
| 61 |
#include "Reasoner/Query/CSucceedQueryResult.h" |
| 62 |
#include "Reasoner/Query/CClassSetResult.h" |
| 63 |
#include "Reasoner/Query/CIndividualClassAssertionsResult.h" |
| 64 |
#include "Reasoner/Query/CIndividualSynonymsResult.h" |
| 65 |
#include "Reasoner/Query/CPropertyHierarchyResult.h" |
| 66 |
#include "Reasoner/Query/CObjectDataPropertyClassificationPremisingQuery.h" |
| 67 |
#include "Reasoner/Query/CPropertySetResult.h" |
| 68 |
#include "Reasoner/Query/CPropertySynsetsResult.h" |
| 69 |
|
| 70 |
#include "Reasoner/Kernel/Process/CProcessingStatistics.h" |
| 71 |
|
| 72 |
#include "Config/CConfiguration.h" |
| 73 |
#include "Config/CConfigDataReader.h" |
| 74 |
|
| 75 |
// Other includes |
| 76 |
|
| 77 |
|
| 78 |
// Logger includes |
| 79 |
#include "Logger/CLogger.h" |
| 80 |
|
| 81 |
using namespace Konclude::Logger; |
| 82 |
|
| 83 |
|
| 84 |
namespace Konclude { |
| 85 |
|
| 86 |
using namespace Config; |
| 87 |
using namespace Reasoner::Query; |
| 88 |
using namespace Reasoner::Kernel::Process; |
| 89 |
|
| 90 |
namespace Control { |
| 91 |
|
| 92 |
using namespace Command; |
| 93 |
using namespace Instructions; |
| 94 |
using namespace Records; |
| 95 |
|
| 96 |
namespace Interface { |
| 97 |
|
| 98 |
namespace OWLlink { |
| 99 |
|
| 100 |
/*! |
| 101 |
* |
| 102 |
* \class COWLLinkRecordInterpreter |
| 103 |
* \author Andreas Steigmiller |
| 104 |
* \version 0.1 |
| 105 |
* \brief TODO |
| 106 |
* |
| 107 |
*/ |
| 108 |
class COWLLinkRecordInterpreter : public CCommandDelegater, public CCommandRecorder { |
| 109 |
// public methods |
| 110 |
public: |
| 111 |
//! Constructor |
| 112 |
COWLLinkRecordInterpreter(CCommandDelegater *commandDelegater, CConfiguration* config); |
| 113 |
|
| 114 |
//! Destructor |
| 115 |
virtual ~COWLLinkRecordInterpreter(); |
| 116 |
|
| 117 |
virtual CCommandDelegater *delegateCommand(CCommand *command); |
| 118 |
virtual CCommandRecorder *recordData(CCommandRecordData *recData); |
| 119 |
|
| 120 |
virtual QByteArray getByteArray(); |
| 121 |
|
| 122 |
virtual QDomElement getErrorNode(CCommandRecordData *recData, const QString &nodeString = "Error"); |
| 123 |
virtual QDomElement getErrorNode(const QString &errorText, const QString &nodeString = "Error"); |
| 124 |
virtual QString getErrorString(CCommandRecordData *recData, const QString &nodeString); |
| 125 |
QString getErrorLevelString(double level); |
| 126 |
|
| 127 |
virtual QDomElement getOneOfStringConfigNode(const QString &keyString, const QString &oneOfOptions, const QString &defaultOption, const QString &nodeString = "Property"); |
| 128 |
virtual QDomElement getBooleanConfigNode(const QString &keyString, const QString &defaultValue, const QString &nodeString = "Property"); |
| 129 |
virtual QDomElement getStringConfigNode(const QString &keyString, const QString &defaultValue, const QString &nodeString = "Property"); |
| 130 |
virtual QDomElement getIntegerConfigNode(const QString &keyString, qint64 defaultValue, const QString &nodeString = "Property"); |
| 131 |
|
| 132 |
virtual QString getOWLLinkMappedConfigString(const QString &keyName); |
| 133 |
|
| 134 |
virtual bool hasReasonerCalculatedWrongResult(); |
| 135 |
|
| 136 |
|
| 137 |
virtual QDomElement getEntitiesSetNode(const QString &nodeString, const QString &entityString, CExtractedKnowledgeBaseEntitiesContainer* entityContainer); |
| 138 |
|
| 139 |
// protected methods |
| 140 |
protected: |
| 141 |
|
| 142 |
// protected variables |
| 143 |
protected: |
| 144 |
QHash<CCommand *,qint64> commandSequenceHash; |
| 145 |
CCommandDelegater *delegater; |
| 146 |
qint64 nextSeqNumber; |
| 147 |
qint64 recNextSeqNumber; |
| 148 |
|
| 149 |
QHash<qint64,QDomNode> seqNodeHash; |
| 150 |
|
| 151 |
QMutex seqSyncMutex; |
| 152 |
|
| 153 |
QDomDocument document; |
| 154 |
QDomElement rootNode; |
| 155 |
|
| 156 |
QString owllinkNS; |
| 157 |
QString owlNS; |
| 158 |
|
| 159 |
bool mConfFileAppendSimpleStats; |
| 160 |
QString mStatFileString; |
| 161 |
QString mStatKBString; |
| 162 |
QString mStatLoadString; |
| 163 |
QString mStatQueryString; |
| 164 |
QStringList mStatStringList; |
| 165 |
QVector<cint64> mStatVector; |
| 166 |
|
| 167 |
bool mCalculatedWrongResult; |
| 168 |
bool mRespondQueryStatistics; |
| 169 |
|
| 170 |
CConfiguration* mConfig; |
| 171 |
bool mConfExtendedErrorReporting; |
| 172 |
|
| 173 |
// private methods |
| 174 |
private: |
| 175 |
|
| 176 |
// private variables |
| 177 |
private: |
| 178 |
|
| 179 |
}; |
| 180 |
|
| 181 |
}; // end namespace OWLlink |
| 182 |
|
| 183 |
}; // end namespace Interface |
| 184 |
|
| 185 |
}; // end namespace Control |
| 186 |
|
| 187 |
}; // end namespace Konclude |
| 188 |
|
| 189 |
#endif // KONCLUDE_Control_Interface_OWLLINK_COWLLINKRECORDINTERPRETER_H |