Debian Codegraph @

Source/Reasoner/Ontology/COntologyBuildData.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_ONTOLOGY_CONTOLOGYBUILDDATA_H
22 #define KONCLUDE_REASONER_ONTOLOGY_CONTOLOGYBUILDDATA_H
23
24 // Libraries includes
25
26
27 // Namespace includes
28 #include "OntologySettings.h"
29 #include "COntologyContext.h"
30 #include "CConcept.h"
31 #include "CRole.h"
32 #include "CIndividual.h"
33 #include "COntologyImportData.h"
34 #include "COntologyBuildExpressionCounter.h"
35
36
37 // Other includes
38 #include "Parser/Expressions/CAxiomExpression.h"
39 #include "Parser/Expressions/CClassAxiomExpression.h"
40 #include "Parser/Expressions/CClassTermExpression.h"
41 #include "Parser/Expressions/CClassExpression.h"
42 #include "Parser/Expressions/CObjectPropertyExpression.h"
43 #include "Parser/Expressions/CObjectPropertyExpression.h"
44 #include "Parser/Expressions/CIndividualTermExpression.h"
45 #include "Parser/Expressions/CNamedIndividualExpression.h"
46 #include "Parser/Expressions/CAnonymousIndividualExpression.h"
47 #include "Parser/Expressions/CObjectPropertyAxiomExpression.h"
48 #include "Parser/Expressions/CDeclarationAxiomExpression.h"
49 #include "Parser/Expressions/CAssertionAxiomExpression.h"
50 #include "Parser/Expressions/CObjectIndividualVariableExpression.h"
51 #include "Parser/Expressions/CDataPropertyTermExpression.h"
52 #include "Parser/Expressions/CDataRangeTermExpression.h"
53 #include "Parser/Expressions/CDatatypeExpression.h"
54 #include "Parser/Expressions/CDataLexicalValueExpression.h"
55 #include "Parser/Expressions/CDataPropertyExpression.h"
56 #include "Parser/Expressions/CDataFacetExpression.h"
57 #include "Parser/Expressions/CNamedIndividualVariableExpression.h"
58 #include "Parser/Expressions/CAnonymousIndividualVariableExpression.h"
59 #include "Parser/Expressions/CDataValueVariableExpression.h"
60 #include "Parser/Expressions/CDataLiteralVariableExpression.h"
61 #include "Parser/Expressions/CDataPropertyVariableExpression.h"
62 #include "Parser/Expressions/CObjectPropertyVariableExpression.h"
63 #include "Parser/Expressions/CClassVariableExpression.h"
64
65 #include "Reasoner/Generator/CExpressionHasher.h"
66
67 #include "Reasoner/Generator/CStringRefStringHasher.h"
68
69 // Logger includes
70 #include "Logger/CLogger.h"
71
72
73 namespace Konclude {
74
75 using namespace Parser::Expression;
76
77 namespace Reasoner {
78
79 using namespace Generator;
80
81 namespace Ontology {
82
83 /*!
84 *
85 * \class COntologyBuildData
86 * \author Andreas Steigmiller
87 * \version 0.1
88 * \brief TODO
89 *
90 */
91 class COntologyBuildData {
92 // public methods
93 public:
94 //! Constructor
95 COntologyBuildData(COntologyContext* ontoContext = nullptr);
96
97 //! Destructor
98 virtual ~COntologyBuildData();
99
100 COntologyBuildData* referenceBuildData(COntologyBuildData* buildData);
101
102
103 CONTOLOGYAXIOMSET<CAxiomExpression*>* getTellAxiomSet();
104 CONTOLOGYAXIOMSET<CAxiomExpression*>* getRetractAxiomSet();
105
106 CONTOLOGYAXIOMSET<CAxiomExpression*>* getUpdatedTellAxiomSet();
107 CONTOLOGYAXIOMSET<CAxiomExpression*>* getUpdatedRetractAxiomSet();
108
109
110 CONTOLOGYAXIOMLIST< QPair<CAxiomExpression*,bool> >* getChangeAxiomList();
111 CONTOLOGYAXIOMLIST< QPair<CAxiomExpression*,bool> >* getUpdatedChangeAxiomList();
112
113
114 CClassTermExpression* getTopClassExpression();
115 CClassTermExpression* getBottomClassExpression();
116
117 CDataRangeTermExpression* getTopDataRangeExpression();
118 CDataRangeTermExpression* getBottomDataRangeExpression();
119
120
121 CBUILDSET<CDeclarationAxiomExpression*>* getDeclarationAxiomSet();
122
123
124 CObjectPropertyTermExpression* getTopObjectPropertyExpression();
125 CObjectPropertyTermExpression* getBottomObjectPropertyExpression();
126
127 CDataPropertyTermExpression* getTopDataPropertyExpression();
128 CDataPropertyTermExpression* getBottomDataPropertyExpression();
129
130 COntologyBuildData* setTopClassExpression(CClassTermExpression* topClassExp);
131 COntologyBuildData* setBottomClassExpression(CClassTermExpression* bottomClassExp);
132
133 COntologyBuildData* setTopDataRangeExpression(CDataRangeTermExpression* dataRangeExp);
134 COntologyBuildData* setBottomDataRangeExpression(CDataRangeTermExpression* dataRangeExp);
135
136 COntologyBuildData* setTopObjectPropertyExpression(CObjectPropertyTermExpression* topObjectPropertyExp);
137 COntologyBuildData* setBottomObjectPropertyExpression(CObjectPropertyTermExpression* bottomObjectPropertyExp);
138
139 COntologyBuildData* setTopDataPropertyExpression(CDataPropertyTermExpression* dataPropertyExp);
140 COntologyBuildData* setBottomDataPropertyExpression(CDataPropertyTermExpression* dataPropertyExp);
141
142
143 CBUILDHASH<CExpressionHasher,CBuildExpression*>* getStructuralExpressionBuildHash();
144 CBUILDLIST<CBuildExpression*>* getExpressionBuildListContainer();
145
146
147 CBUILDHASH<CStringRefStringHasher,CClassExpression*>* getClassEntityBuildHash();
148 CBUILDHASH<CStringRefStringHasher,CObjectPropertyExpression*>* getObjectPropertyEntityBuildHash();
149 CBUILDHASH<CStringRefStringHasher,CNamedIndividualExpression*>* getIndividualEntityBuildHash();
150 CBUILDHASH<QPair<CStringRefStringHasher,CStringRefStringHasher>,CAnonymousIndividualExpression*>* getAnonymousIndividualBuildHash();
151 CBUILDHASH<QPair<CStringRefStringHasher,cint64>,CObjectIndividualVariableExpression*>* getNominalIndividualVariableBuildHash();
152
153
154 CBUILDHASH<CStringRefStringHasher, CIndividualVariableExpression*>* getNamedIndividualVariableBuildHash();
155 CBUILDHASH<CStringRefStringHasher, CIndividualVariableExpression*>* getAnonymousIndividualVariableBuildHash();
156
157
158 CBUILDHASH<CStringRefStringHasher, CClassVariableExpression*>* getClassVariableBuildHash();
159 CBUILDHASH<CStringRefStringHasher, CObjectPropertyVariableExpression*>* getObjectPropertyVariableBuildHash();
160 CBUILDHASH<CStringRefStringHasher, CDataPropertyVariableExpression*>* getDataPropertyVariableBuildHash();
161
162
163
164 CBUILDHASH<CStringRefStringHasher,CDatatypeExpression*>* getDatatypeIRIBuildHash();
165 CBUILDHASH<CStringRefStringHasher,CDataFacetExpression*>* getFacetIRIBuildHash();
166 CBUILDHASH<CStringRefStringHasher,CDataPropertyExpression*>* getDataPropertyEntityBuildHash();
167 CBUILDHASH<CStringRefStringHasher,CDataLexicalValueExpression*>* getDataLexicalValueBuildHash();
168
169 CBUILDHASH<CStringRefStringHasher, CDataValueVariableExpression*>* getDataValueVariableBuildHash();
170 CBUILDHASH<CStringRefStringHasher, CDataLiteralVariableExpression*>* getDataLiteralVariableBuildHash();
171
172
173 CBUILDHASH<CObjectPropertyTermExpression*,CObjectPropertyTermExpression*>* getInverseObjectPropertyHash();
174 CBUILDLIST< QPair<CObjectPropertyTermExpression*,CObjectPropertyTermExpression*> >* getInverseObjectPropertyList();
175
176
177 CBUILDHASH<CObjectIndividualVariableExpression*,cint64>* getIndividualVariableIDHash();
178
179
180 CBUILDSET<CClassTermExpression*>* getBuildConceptSet();
181 CBUILDSET<CObjectPropertyTermExpression*>* getBuildObjectRoleSet();
182 CBUILDSET<CIndividualTermExpression*>* getBuildIndividualSet();
183 CBUILDSET<CDataPropertyTermExpression*>* getBuildDataRoleSet();
184 CBUILDSET<CDataRangeTermExpression*>* getBuildDataRangeSet();
185 CBUILDSET<CDatatypeExpression*>* getBuildDatatypeSet();
186
187
188 CBUILDLIST<CClassTermExpression*>* getBuildConceptList();
189 CBUILDLIST<CObjectPropertyTermExpression*>* getBuildObjectRoleList();
190 CBUILDLIST<CDataPropertyTermExpression*>* getBuildDataRoleList();
191 CBUILDLIST<CIndividualTermExpression*>* getBuildIndividualList();
192 CBUILDLIST<CDataRangeTermExpression*>* getBuildDataRangeList();
193 CBUILDLIST<CDatatypeExpression*>* getBuildDatatypeList();
194
195 cint64 getNextAxiomNumber(bool moveNext = false);
196 COntologyBuildData* setNextAxiomNumber(cint64 axiomNumber);
197
198 cint64 getNextEntityNumber(bool moveNext = false);
199 COntologyBuildData* setNextEntityNumber(cint64 entityNumber);
200
201
202
203 CBUILDHASH<CStringRefStringHasher,COntologyImportData*>* getImportDataHash();
204
205 COntologyBuildExpressionCounter* getBuildExpressionCounter();
206
207
208 // protected methods
209 protected:
210
211 // protected variables
212 protected:
213 COntologyContext* mOntoContext;
214
215
216 COntologyBuildExpressionCounter mExpressionCounter;
217
218 // contains also previous ontology data
219 CONTOLOGYAXIOMSET<CAxiomExpression*>* mTellAxiomSet;
220 CONTOLOGYAXIOMSET<CAxiomExpression*>* mRetractAxiomSet;
221
222 CONTOLOGYAXIOMLIST< QPair<CAxiomExpression*,bool> >* mChangeAxiomList;
223
224
225 // contains only updated data
226 CONTOLOGYAXIOMSET<CAxiomExpression*>* mTellUpdatedAxiomSet;
227 CONTOLOGYAXIOMSET<CAxiomExpression*>* mRetractUpdatedAxiomSet;
228
229
230 CONTOLOGYAXIOMLIST< QPair<CAxiomExpression*,bool> >* mChangeUpdatedAxiomList;
231
232 cint64 mAxiomNumber;
233 cint64 mEntityNumber;
234
235
236 CBUILDSET<CDeclarationAxiomExpression*>* mDeclarationAxiomSet;
237
238 CBUILDHASH<CObjectIndividualVariableExpression*,cint64>* mIndividualVariableIDHash;
239
240
241 // contains also previous ontology data,
242 // exact build expression identification
243 CClassTermExpression* mTopClassExpression;
244 CClassTermExpression* mBottomClassExpression;
245
246 CObjectPropertyTermExpression* mTopObjPropExpression;
247 CObjectPropertyTermExpression* mBottomObjPropExpression;
248
249 CDataRangeTermExpression* mTopDataRangeExpression;
250 CDataRangeTermExpression* mBottomDataRangeExpression;
251
252 CDataPropertyTermExpression* mTopDataPropExpression;
253 CDataPropertyTermExpression* mBottomDataPropExpression;
254
255 CBUILDHASH<CExpressionHasher,CBuildExpression*>* mExpressionBuildHash;
256
257 CBUILDHASH<CStringRefStringHasher,CClassExpression*>* mClassBuildHash;
258 CBUILDHASH<CStringRefStringHasher,CObjectPropertyExpression*>* mObjectPropertyBuildHash;
259 CBUILDHASH<CStringRefStringHasher,CNamedIndividualExpression*>* mIndividualBuildHash;
260 CBUILDHASH<QPair<CStringRefStringHasher,CStringRefStringHasher>,CAnonymousIndividualExpression*>* mAnoIndividualBuildHash;
261 CBUILDHASH<QPair<CStringRefStringHasher,cint64>,CObjectIndividualVariableExpression*>* mNominalIndividualVariableBuildHash;
262 CBUILDHASH<CStringRefStringHasher, CIndividualVariableExpression*>* mNamedIndividualVariableBuildHash;
263 CBUILDHASH<CStringRefStringHasher, CIndividualVariableExpression*>* mAnonymousIndividualVariableBuildHash;
264
265 CBUILDHASH<CStringRefStringHasher, CClassVariableExpression*>* mClassVariableBuildHash;
266 CBUILDHASH<CStringRefStringHasher, CObjectPropertyVariableExpression*>* mObjectPropertyVariableBuildHash;
267 CBUILDHASH<CStringRefStringHasher, CDataPropertyVariableExpression*>* mDataPropertyVariableBuildHash;
268
269
270 CBUILDHASH<CStringRefStringHasher, CDatatypeExpression*>* mDatatypeIRIDatatypeBuildHash;
271 CBUILDHASH<CStringRefStringHasher,CDataPropertyExpression*>* mDataPropertyBuildHash;
272 CBUILDHASH<CStringRefStringHasher,CDataLexicalValueExpression*>* mDataLexicalValueBuildHash;
273 CBUILDHASH<CStringRefStringHasher,CDataFacetExpression*>* mFacetIRIFacetBuildHash;
274 CBUILDHASH<CStringRefStringHasher, CDataValueVariableExpression*>* mDataValueVariableBuildHash;
275 CBUILDHASH<CStringRefStringHasher, CDataLiteralVariableExpression*>* mDataLiteralVariableBuildHash;
276
277
278
279 CBUILDHASH<CStringRefStringHasher,COntologyImportData*>* mImportDataHash;
280
281 // mapping hashes and container
282 CBUILDLIST<CBuildExpression*>* mExpressionBuildListContainer;
283
284
285 CBUILDHASH<CObjectPropertyTermExpression*,CObjectPropertyTermExpression*>* mInverseObjectPropertyHash;
286 CBUILDLIST< QPair<CObjectPropertyTermExpression*,CObjectPropertyTermExpression*> >* mInverseObjectPropertyList;
287
288
289 CBUILDSET<CClassTermExpression*>* mBuildConceptSet;
290 CBUILDSET<CObjectPropertyTermExpression*>* mBuildObjectRoleSet;
291 CBUILDSET<CDataPropertyTermExpression*>* mBuildDataRoleSet;
292 CBUILDSET<CIndividualTermExpression*>* mBuildIndividualSet;
293 CBUILDSET<CDatatypeExpression*>* mBuildDatatypeSet;
294 CBUILDSET<CDataRangeTermExpression*>* mBuildDataRangesSet;
295
296 CBUILDLIST<CIndividualTermExpression*>* mBuildIndividualList;
297 CBUILDLIST<CObjectPropertyTermExpression*>* mBuildObjectRoleList;
298 CBUILDLIST<CDataPropertyTermExpression*>* mBuildDataRoleList;
299 CBUILDLIST<CClassTermExpression*>* mBuildConceptList;
300 CBUILDLIST<CDatatypeExpression*>* mBuildDatatypeList;
301 CBUILDLIST<CDataRangeTermExpression*>* mBuildDataRangesList;
302
303 // private methods
304 private:
305
306 // private variables
307 private:
308
309 };
310
311 }; // end namespace Ontology
312
313 }; // end namespace Reasoner
314
315 }; // end namespace Konclude
316
317 #endif // KONCLUDE_REASONER_ONTOLOGY_CONTOLOGYBUILDDATA_H