| 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 |
#ifdef KONCLUDE_REDLAND_INTEGRATION |
| 21 |
|
| 22 |
#ifndef KONCLUDE_REASONER_ANSWERER_COPTIMIZEDCOMPLEXCOMPOSITIONREDLANDRASQALANSWERINGHANDLER_H |
| 23 |
#define KONCLUDE_REASONER_ANSWERER_COPTIMIZEDCOMPLEXCOMPOSITIONREDLANDRASQALANSWERINGHANDLER_H |
| 24 |
|
| 25 |
// Libraries includes |
| 26 |
#include <QList> |
| 27 |
|
| 28 |
// Namespace includes |
| 29 |
#include "AnswererSettings.h" |
| 30 |
#include "CAnsweringHandler.h" |
| 31 |
#include "CAnsweringCalculationHandler.h" |
| 32 |
#include "CAnswererContext.h" |
| 33 |
#include "CAnsweringHandlingStatistics.h" |
| 34 |
#include "CAnsweringCalculationStatisticsCollectionStrings.h" |
| 35 |
#include "CAnsweringStatisticsCollectionStrings.h" |
| 36 |
#include "CAnsweringMessageDataCalculationCompleted.h" |
| 37 |
#include "CAnsweringMessageDataCalculationAdapter.h" |
| 38 |
#include "COptimizedComplexCompositionOntologyAnsweringItem.h" |
| 39 |
#include "CComplexQueryCompositionProcessingData.h" |
| 40 |
#include "COptimizedComplexCompositionAnsweringHandler.h" |
| 41 |
#include "CComplexQueryCompositionRedlandRasqalProcessingData.h" |
| 42 |
#include "CRedlandRasqalSubQueryProcessingData.h" |
| 43 |
#include "CRedlandRasqalModelSubQueryResolver.h" |
| 44 |
#include "CAnsweringMessageDataRequirementCompleted.h" |
| 45 |
#include "CAnsweringMessageDataRequirementCompletedSubQueryAnswering.h" |
| 46 |
|
| 47 |
|
| 48 |
// Other includes |
| 49 |
|
| 50 |
#include "Reasoner/Answerer/Conclusion/CVariableBindingsQueryResultWriter.h" |
| 51 |
|
| 52 |
|
| 53 |
#include "Context/CContextBase.h" |
| 54 |
|
| 55 |
#include "Reasoner/Revision/COntologyRevision.h" |
| 56 |
|
| 57 |
#include "Reasoner/Ontology/CConcreteOntology.h" |
| 58 |
|
| 59 |
#include "Reasoner/Query/CRedlandRasqalBGPsCompositionQuery.h" |
| 60 |
#include "Reasoner/Query/CComplexAnsweringCompositionQuery.h" |
| 61 |
#include "Reasoner/Query/CQueryUnspecifiedStringError.h" |
| 62 |
#include "Reasoner/Query/CVariableBindingsAnswersStreamingResult.h" |
| 63 |
#include "Reasoner/Query/CVariableBindingsAnswersListResult.h" |
| 64 |
|
| 65 |
#include "Reasoner/Generator/CSatisfiableCalculationJobGenerator.h" |
| 66 |
#include "Reasoner/Generator/CConcreteOntologyUpdateSeparateHashingCollectorBuilder.h" |
| 67 |
#include "Reasoner/Generator/CConcreteOntologyQueryExtendedBuilder.h" |
| 68 |
#include "Reasoner/Generator/CConcreteOntologyExtendibleQueryExtendedBuilder.h" |
| 69 |
|
| 70 |
|
| 71 |
#include "Parser/CSPARQLRedlandRasqalReasoningBGPQueryParser.h" |
| 72 |
|
| 73 |
|
| 74 |
#include "Config/CConfigDataReader.h" |
| 75 |
|
| 76 |
|
| 77 |
#include "KoncludeSettings.h" |
| 78 |
|
| 79 |
// Logger includes |
| 80 |
#include "Logger/CLogger.h" |
| 81 |
#include "Logger/CLogIdentifier.h" |
| 82 |
|
| 83 |
#include <iostream> |
| 84 |
|
| 85 |
using namespace std; |
| 86 |
|
| 87 |
|
| 88 |
namespace Konclude { |
| 89 |
|
| 90 |
using namespace Config; |
| 91 |
using namespace Context; |
| 92 |
using namespace Parser; |
| 93 |
|
| 94 |
namespace Reasoner { |
| 95 |
|
| 96 |
using namespace Revision; |
| 97 |
using namespace Ontology; |
| 98 |
using namespace Generator; |
| 99 |
using namespace Query; |
| 100 |
|
| 101 |
|
| 102 |
namespace Answerer { |
| 103 |
|
| 104 |
using namespace Conclusion; |
| 105 |
|
| 106 |
/*! |
| 107 |
* |
| 108 |
* \class COptimizedComplexCompositionRedlandRasqalAnsweringHandler |
| 109 |
* \author Andreas Steigmiller |
| 110 |
* \version 0.1 |
| 111 |
* \brief TODO |
| 112 |
* |
| 113 |
*/ |
| 114 |
class COptimizedComplexCompositionRedlandRasqalAnsweringHandler : public COptimizedComplexCompositionAnsweringHandler { |
| 115 |
// public methods |
| 116 |
public: |
| 117 |
//! Constructor |
| 118 |
COptimizedComplexCompositionRedlandRasqalAnsweringHandler(COptimizedComplexCompositionOntologyAnsweringItem* ontoAnsweringItem); |
| 119 |
|
| 120 |
//! Destructor |
| 121 |
virtual ~COptimizedComplexCompositionRedlandRasqalAnsweringHandler(); |
| 122 |
|
| 123 |
|
| 124 |
virtual bool addAnsweringComplexQuery(CComplexAnsweringQuery* complexAnsweringQuery, CCallbackData* callback = nullptr); |
| 125 |
virtual bool canAnsweringComplexQuery(CComplexAnsweringQuery* complexAnsweringQuery); |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
virtual bool continueCalculationCreation(CAnswererContext* answererContext); |
| 130 |
|
| 131 |
void processRasqal(CRedlandRasqalBGPsCompositionQuery* query, CComplexQueryCompositionRedlandRasqalProcessingData* redlandRasqalQueryProcData); |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
virtual bool processRequirementMessage(CAnsweringMessageData* message, CAnswererContext* answererContext); |
| 136 |
|
| 137 |
|
| 138 |
virtual bool isAnsweringFinished(CAnswererContext* answererContext); |
| 139 |
|
| 140 |
virtual CAnsweringProgress* getAnsweringProgress(); |
| 141 |
|
| 142 |
// protected methods |
| 143 |
protected: |
| 144 |
virtual COptimizedComplexCompositionRedlandRasqalAnsweringHandler* initializeQueryProcessing(CComplexQueryCompositionProcessingData* queryData, CAnswererContext* answererContext); |
| 145 |
|
| 146 |
bool generateSubQueries(CComplexQueryCompositionRedlandRasqalProcessingData* redlandRasqalQueryProcData, CAnswererContext* answererContext); |
| 147 |
|
| 148 |
bool processSubQuery(CAnswererContext* answererContext, CQuery* subQuery, CComplexQueryCompositionRedlandRasqalProcessingData* redlandRasqalQueryProcData, CAnsweringMessageDataRequirementCompleted* completedMessage); |
| 149 |
|
| 150 |
bool scheduleNextSubQueryProcessing(CComplexQueryCompositionRedlandRasqalProcessingData* redlandRasqalQueryProcData, CAnswererContext* answererContext); |
| 151 |
|
| 152 |
|
| 153 |
// protected variables |
| 154 |
protected: |
| 155 |
CComplexQueryCompositionRedlandRasqalProcessingData* mCurrentProcessingRedlandRasqalQueryProcData; |
| 156 |
|
| 157 |
|
| 158 |
// private methods |
| 159 |
private: |
| 160 |
|
| 161 |
// private variables |
| 162 |
private: |
| 163 |
|
| 164 |
}; |
| 165 |
|
| 166 |
}; // end namespace Answerer |
| 167 |
|
| 168 |
}; // end namespace Reasoner |
| 169 |
|
| 170 |
}; // end namespace Konclude |
| 171 |
|
| 172 |
#endif // KONCLUDE_REASONER_ANSWERER_COPTIMIZEDCOMPLEXCOMPOSITIONREDLANDRASQALANSWERINGHANDLER_H |
| 173 |
|
| 174 |
#endif // KONCLUDE_REDLAND_INTEGRATION |