Debian Codegraph @

Source/Reasoner/Answerer/COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData.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_REASONER_ANSWERER_COPTIMIZEDCOMPLEXVARIABLEABSORPTIONBASEDHANDLINGQUERYPARTDATA_H
22 #define KONCLUDE_REASONER_ANSWERER_COPTIMIZEDCOMPLEXVARIABLEABSORPTIONBASEDHANDLINGQUERYPARTDATA_H
23
24 // Libraries includes
25 #include <QPair>
26
27 // Namespace includes
28 #include "AnswererSettings.h"
29
30
31 // Other includes
32 #include "Parser/Expressions/CExpressionVariable.h"
33 #include "Parser/Expressions/CIndividualVariableExpression.h"
34 #include "Parser/Expressions/CObjectPropertyTermExpression.h"
35 #include "Parser/Expressions/CObjectPropertyAssertionExpression.h"
36
37
38 #include "Reasoner/Ontology/CConcept.h"
39
40
41 // Logger includes
42 #include "Logger/CLogger.h"
43
44
45 namespace Konclude {
46
47 using namespace Parser::Expression;
48
49 namespace Reasoner {
50
51 using namespace Ontology;
52
53 namespace Answerer {
54
55
56 /*!
57 *
58 * \class COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData
59 * \author Andreas Steigmiller
60 * \version 0.1
61 * \brief TODO
62 *
63 */
64 class COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData {
65 // public methods
66 public:
67 //! Constructor
68 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData(const QSet<CExpressionVariable*>& anonymousVariableSet, const QSet<CExpressionVariable*>& restrictedAbsorptionVariableSet);
69
70
71
72 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* addVariableClassExpressions(CExpressionVariable* variable, QList<CBuildExpression*>& classExpressions);
73 QList<CBuildExpression*> getVariableClassExpressions(CExpressionVariable* variable);
74
75 QHash<CExpressionVariable*, CBuildExpression*>* getVariableBuiltExpressionsHash();
76
77
78 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* addVariableNeighbouringPropertyAssertion(CObjectPropertyAssertionExpression* propertyAssertion);
79 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* addVariableSelfPropertyAssertion(CObjectPropertyAssertionExpression* propertyAssertion);
80
81
82 bool isVariableHandled(CExpressionVariable* variable);
83 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setVariableHandled(CExpressionVariable* variable);
84
85 QSet<CExpressionVariable*>* getRestrictedAbsorptionVariableSet();
86
87 QSet<CExpressionVariable*>* getAbsorptionVariableSet();
88 QSet<CExpressionVariable*>* getIndividualVariableSet();
89 QSet<CExpressionVariable*>* getAnonymousVariableSet();
90
91 // preparation variables differ from individual variables in the form that they have not been used in the absorption for generating a binder concept
92 QSet<CExpressionVariable*>* getPrepareVariableSet();
93 QSet<CExpressionVariable*>* getBindingsVariableSet();
94 QSet<CExpressionVariable*>* getIndividualBindingsVariableSet();
95
96
97 QList<CObjectPropertyAssertionExpression*> getNeighbouringPropertyAssertions(CExpressionVariable* variable, bool removeAbsorbed = true);
98 QList<CObjectPropertyAssertionExpression*> getSelfPropertyAssertions(CExpressionVariable* variable);
99
100 bool isPropertyNeighbouringRemovalDisconnecting(CExpressionVariable* variable, CObjectPropertyAssertionExpression* propAss);
101
102 CExpressionVariable* getOtherVariableExpression(CExpressionVariable* varEpx, CObjectPropertyAssertionExpression* propAss);
103
104
105 QHash<CExpressionVariable*, CConcept*>* getVariableLastTriggerConceptHash();
106 CConcept* getVariableLastTriggerConcept(CExpressionVariable* varEpx);
107 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setVariableLastTriggerConcept(CExpressionVariable* varEpx, CConcept* lastTriggerConcept);
108
109
110 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* removePropertyAssertion(CObjectPropertyAssertionExpression* propertyAssertion);
111
112
113
114
115 QHash<CExpressionVariable*, CConcept*>* getVariableBindingConceptHash();
116 CConcept* getVariableBindingConcept(CExpressionVariable* varEpx);
117 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setVariableBindingConcept(CExpressionVariable* varEpx, CConcept* bindingConcept);
118
119
120 QHash<CExpressionVariable*, CVariable*>* getVariableExpressionVariableHash();
121 QHash<CVariable*, CExpressionVariable*>* getExpressionVariableVariableHash();
122
123
124 CConcept* getInitializerConcept();
125 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setInitializerConcept(CConcept* concept);
126
127 CConcept* getLastTriggerConcept();
128 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setLastTriggerConcept(CConcept* concept);
129
130 CExpressionVariable* getLastTriggerVariable();
131 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setLastTriggerVariable(CExpressionVariable* variable);
132
133
134 CConcept* getPropagationFinalizationConcept();
135 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setPropagationFinalizationConcept(CConcept* concept);
136
137
138 CExpressionVariable* getInitializerVariableExpression();
139 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setInitializerVariableExpression(CExpressionVariable* variable);
140
141 CExpressionVariable* getBindingPropagationStartVariableExpression();
142 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setBindingPropagationStartVariableExpression(CExpressionVariable* variable);
143
144
145 QHash<CConcept*, QSet<CExpressionVariable*> >* getConceptPropagatedVariableSetHash();
146 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* addConceptPropagatedVariable(CConcept* concept, CExpressionVariable* propagatedVariable);
147 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* propagateConceptPropagatedVariables(CConcept* concept, CConcept* propagationConcept);
148
149
150 bool hasPreparationVariables();
151
152 bool hasIndividualVariables();
153 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setHasIndividualVariables(bool indiVariables);
154
155 bool isTopObjectPropertyUsed();
156 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setTopObjectPropertyUsage(bool topObjectPropertyUsed);
157
158 bool isTopObjectPropertyAbsorptionPropagation();
159 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setTopObjectPropertyAbsorptionPropagation(bool topObjectPropertyAbsorptionPropagation);
160
161 bool isTopObjectPropertyInitializationPropagation();
162 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setTopObjectPropertyInitializationPropagation(bool topObjectPropertyInitializationPropagation);
163
164
165 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* resetAbsorption();
166
167
168
169
170 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setInitialObjectPropertyPropagatedTriggerConcept(CObjectPropertyTermExpression* objectPropertyExp, bool inversion, CConcept* propagatedTriggerConcept);
171 CConcept* getInitialObjectPropertyPropagatedTriggerConcept(CObjectPropertyTermExpression* objectPropertyExp, bool inversion);
172
173
174 QSet<CObjectPropertyAssertionExpression*>* getPropertyAssertionSet();
175
176
177 bool hasNonTrivialAbsorptionPropagation();
178 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setNonTrivialAbsorptionPropagation(bool prop);
179
180
181 CConcept* getRestrictedTopPropagationConcept();
182 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setRestrictedTopPropagationConcept(CConcept* concept);
183
184
185 bool hasRestrictedTopPropagationConceptChecked();
186 COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* setRestrictedTopPropagationConceptChecked(bool checked);
187
188
189 // protected methods
190 protected:
191
192 // protected variables
193 protected:
194 QSet<CObjectPropertyAssertionExpression*> mAxiomAssertionSet;
195
196 QHash<CExpressionVariable*, CBuildExpression*> mVariableBuiltExpressionsHash;
197 QHash<CExpressionVariable*, CObjectPropertyAssertionExpression*> mVarPropNeighbouringAssHash;
198 QHash<CExpressionVariable*, CObjectPropertyAssertionExpression*> mVarPropSelfAssHash;
199
200 QSet< QPair<CExpressionVariable*, CObjectPropertyAssertionExpression*> > mVarPropAssSet;
201
202 QSet<CExpressionVariable*> mHandledVariableSet;
203 QSet<CExpressionVariable*> mAnonymousVariableSet;
204 QSet<CExpressionVariable*> mPrepareIndiVariableSet;
205 QSet<CExpressionVariable*> mIndividualVariableSet;
206 QSet<CExpressionVariable*> mBindingsVariableSet;
207 QSet<CExpressionVariable*> mIndividualBindingsVariableSet;
208
209 QSet<CExpressionVariable*> mRestrictedAbsorptionVariableSet;
210
211
212 QSet<CExpressionVariable*> mVariableAbsorptionSet;
213
214
215 QSet<CObjectPropertyAssertionExpression*> mRemovedPropAssSet;
216
217
218 QHash<CExpressionVariable*, CConcept*> mVariableLastTriggerConceptHash;
219 QHash<CExpressionVariable*, CConcept*> mVariableBindingConceptHash;
220
221
222 QHash<CConcept*, QSet<CExpressionVariable*> > mConceptPropagatedVariableSetHash;
223
224
225
226 QHash<CExpressionVariable*, CVariable*> mVariableExpressionVariableHash;
227 QHash<CVariable*, CExpressionVariable*> mExpressionVariableVariableHash;
228
229 CExpressionVariable* mInitializerVariableExpression;
230 CExpressionVariable* mBindingPropagationStartVariableExpression;
231 CConcept* mInitializerConcept;
232 CConcept* mLastTriggerConcept;
233 CConcept* mPropagationFinalizationConcept;
234 CExpressionVariable* mLastTriggerVariable;
235
236
237 bool mIndiVariables;
238
239 bool mTopObjectPropertyUsed;
240 bool mTopObjectPropertyAbsorptionPropagation;
241 bool mTopObjectPropertyInitializationPropagation;
242
243 bool mNonTrivialAbsorptionPropagation;
244
245 bool mRestrictedTopPropagationConceptChecked;
246 CConcept* mRestrictedTopPropagationConcept;
247
248 QHash<QPair<CObjectPropertyTermExpression*, bool>, CConcept*> mInitialObjectPropertyPropagatedTriggerConceptHash;
249
250 // private methods
251 private:
252
253 // private variables
254 private:
255
256 };
257
258 }; // end namespace Answerer
259
260 }; // end namespace Reasoner
261
262 }; // end namespace Konclude
263
264 #endif // KONCLUDE_REASONER_ANSWERER_COPTIMIZEDCOMPLEXVARIABLEABSORPTIONBASEDHANDLINGQUERYPARTDATA_H