Debian Codegraph @

Source/Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheOntologyData.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_KERNEL_CACHE_CBACKENDREPRESENTATIVEMEMORYCACHEONTOLOGYDATA_H
22 #define KONCLUDE_REASONER_KERNEL_CACHE_CBACKENDREPRESENTATIVEMEMORYCACHEONTOLOGYDATA_H
23
24 // Libraries includes
25
26
27 // Namespace includes
28 #include "CacheSettings.h"
29 #include "CBackendRepresentativeMemoryCacheBaseContext.h"
30 #include "CBackendRepresentativeMemoryCacheOntologyContext.h"
31 #include "CBackendRepresentativeMemoryLabelCacheItem.h"
32 #include "CBackendRepresentativeMemoryCardinalityCacheItem.h"
33 #include "CBackendRepresentativeMemoryCachingFlags.h"
34 #include "CBackendRepresentativeMemoryCacheIndividualNeighbourRoleSetHash.h"
35 #include "CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray.h"
36 #include "CBackendRepresentativeMemoryCardinalitySignatureResolveCacheItem.h"
37 #include "CBackendRepresentativeMemoryCacheNominalIndividualIndirectConnectionData.h"
38 #include "CBackendRepresentativeMemoryCacheIndividualAssociationContext.h"
39 #include "CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker.h"
40
41
42 // Other includes
43 #include "Reasoner/Ontology/CIndividualBackendCachingData.h"
44
45 // Logger includes
46 #include "Logger/CLogger.h"
47
48
49 namespace Konclude {
50
51 namespace Reasoner {
52
53 using namespace Ontology;
54
55 namespace Kernel {
56
57 namespace Cache {
58
59 /*!
60 *
61 * \class CBackendRepresentativeMemoryCacheOntologyData
62 * \author Andreas Steigmiller
63 * \version 0.1
64 * \brief TODO
65 *
66 */
67 class CBackendRepresentativeMemoryCacheOntologyData {
68 // public methods
69 public:
70 //! Constructor
71 CBackendRepresentativeMemoryCacheOntologyData(CBackendRepresentativeMemoryCacheBaseContext* baseContext);
72
73 CBackendRepresentativeMemoryCacheOntologyData* initOntologyData(cint64 ontologyIdentifer, bool directIndexing);
74 CBackendRepresentativeMemoryCacheOntologyData* copyOntologyData(CBackendRepresentativeMemoryCacheOntologyData* data);
75
76 cint64 getOntologyIdentifer();
77 cint64 getUsageCount();
78 CBackendRepresentativeMemoryCacheOntologyData* incUsageCount(cint64 count = 1);
79 CBackendRepresentativeMemoryCacheOntologyData* decUsageCount(cint64 count = 1);
80
81 CBackendRepresentativeMemoryCacheOntologyData* setSignatureLabelItemHash(cint64 labelType, CCACHINGHASH<cint64, CBackendRepresentativeMemoryLabelSignatureResolveCacheItem>* sigItemHash);
82 CCACHINGHASH<cint64, CBackendRepresentativeMemoryLabelSignatureResolveCacheItem>* getSignatureLabelItemHash(cint64 labelType);
83 CCACHINGHASH<cint64, CBackendRepresentativeMemoryCacheNominalIndividualIndirectConnectionData* >* getNominaIIndividualdIndirectConnectionDataHash();
84
85 bool hasSameIndividualsMergings();
86 CBackendRepresentativeMemoryCacheOntologyData* setSameIndividualsMergings(bool sameIndisMergings);
87
88
89 CCACHINGHASH<cint64, CBackendRepresentativeMemoryCacheIndividualAssociationData*>* getIndividualIdAssociationDataHash();
90 CBackendRepresentativeMemoryCacheOntologyData* setIndividualIdAssociationDataHash(CCACHINGHASH<cint64, CBackendRepresentativeMemoryCacheIndividualAssociationData*>* indiIdAssoDataHash);
91 CBackendRepresentativeMemoryCacheOntologyData* setNominaIIndividualdIndirectConnectionDataHash(CCACHINGHASH<cint64, CBackendRepresentativeMemoryCacheNominalIndividualIndirectConnectionData* >* hash);
92
93 cint64 getIndividualIdAssoiationDataVectorSize();
94 CBackendRepresentativeMemoryCacheIndividualAssociationData** getIndividualIdAssoiationDataVector();
95 CBackendRepresentativeMemoryCacheOntologyData* setIndividualIdAssoiationDataVector(cint64 indiIdAssoDataVectorSize, CBackendRepresentativeMemoryCacheIndividualAssociationData** indiIdAssoDataVector);
96 CBackendRepresentativeMemoryCacheOntologyData* setIndividualIdAssoiationDataVectorSize(cint64 size);
97
98
99 cint64 getNextEntryID(bool moveNext = true);
100 CBackendRepresentativeMemoryCacheOntologyData* setNextEntryID(cint64 nextEntryID);
101
102 cint64 getMaxStoredIndvidualiId();
103 CBackendRepresentativeMemoryCacheOntologyData* updateMaxStoredIndvidualiId(cint64 id);
104
105
106 cint64 getLastMinIncompletelyHandledIndvidualiId();
107 CBackendRepresentativeMemoryCacheOntologyData* setLastMinIncompletelyHandledIndvidualiId(cint64 id);
108 CBackendRepresentativeMemoryCacheOntologyData* incLastMinIncompletelyHandledIndvidualiId(cint64 count = 1);
109
110 cint64 getIncompletelyHandledIndividualIdCount();
111 CBackendRepresentativeMemoryCacheOntologyData* setIncompletelyHandledIndividualIdCount(cint64 count);
112 CBackendRepresentativeMemoryCacheOntologyData* incIncompletelyHandledIndividualIdCount(cint64 count = 1);
113 CBackendRepresentativeMemoryCacheOntologyData* decIncompletelyHandledIndividualIdCount(cint64 count = 1);
114
115
116 cint64 getIndividualAssociationsCount();
117 CBackendRepresentativeMemoryCacheOntologyData* setIndividualAssociationsCount(cint64 count);
118 CBackendRepresentativeMemoryCacheOntologyData* incIndividualAssociationsCount(cint64 count = 1);
119
120
121 bool isAssociationCompleted();
122 CBackendRepresentativeMemoryCacheOntologyData* setAssociationCompleted(bool completed);
123
124
125 bool isFirstIncompletelyHandledIndividualsRetrieved();
126 CBackendRepresentativeMemoryCacheOntologyData* setFirstIncompletelyHandledIndividualsRetrieved(bool retrieved);
127
128
129 cint64 getMaxIndividualAssociationDataUpdateCount();
130 CBackendRepresentativeMemoryCacheOntologyData* setMaxIndividualAssociationDataUpdateCount(cint64 count);
131
132 CCACHINGSET<cint64>* getProblematicIncompletelyHandledIndividualSet();
133 CBackendRepresentativeMemoryCacheOntologyData* setProblematicIncompletelyHandledIndividualSet(CCACHINGSET<cint64>* indiSet);
134
135
136 CBackendRepresentativeMemoryCacheOntologyContext* getTemporaryContext();
137 CBackendRepresentativeMemoryCacheOntologyContext* getOntologyContext();
138 CBackendRepresentativeMemoryCacheOntologyData* setOntologyContext(CBackendRepresentativeMemoryCacheOntologyContext* ontContext);
139
140
141 CBackendRepresentativeMemoryLabelCacheItem* getPrioritizedPropagationMarkedNeighbourLabelItem();
142 CBackendRepresentativeMemoryCacheOntologyData* setPrioritizedPropagationMarkedNeighbourLabelItem(CBackendRepresentativeMemoryLabelCacheItem* labelItem);
143
144
145 bool isIndividualLabelAssociationIndexed();
146 CBackendRepresentativeMemoryCacheOntologyData* setIndividualLabelAssociationIndexed(bool indexed);
147 cint64 updateIndividualLabelAssociationIndexed(bool releaseWaiting, CMemoryPool* memoryPools);
148 CBackendRepresentativeMemoryCacheOntologyData* setIndividualLabelAssociationIndexingCount(cint64 count);
149
150 CBackendRepresentativeMemoryCacheOntologyData* waitIndividualLabelAssociationIndexed();
151
152
153 cint64 getNextSlotUpdateWaitingCount();
154 CBackendRepresentativeMemoryCacheOntologyData* setNextSlotUpdateWaitingCount(cint64 updateCount);
155 bool isSlotUpdateIntegrated();
156 CBackendRepresentativeMemoryCacheOntologyData* setSlotUpdateIntegrated(bool integrated);
157
158 bool isBasicPrecomputationMode();
159 CBackendRepresentativeMemoryCacheOntologyData* setBasicPrecomputationMode(bool basicPrecomputation);
160 CBackendRepresentativeMemoryCacheIndividualAssociationData** getBasicPrecomputationIndividualIdAssoiationDataVector();
161 CBackendRepresentativeMemoryCacheOntologyData* setBasicPrecomputationIndividualIdAssoiationDataVector(cint64 indiIdAssoDataVectorSize, CBackendRepresentativeMemoryCacheIndividualAssociationData** indiIdAssoDataVector);
162 cint64 getBasicPrecomputationIndividualIdAssoiationDataVectorSize();
163
164
165 cint64 getBasicPrecompuationRetrievalIndividualIdPosition();
166 CBackendRepresentativeMemoryCacheOntologyData* setBasicPrecompuationRetrievalIndividualIdPosition(cint64 indiPos);
167
168
169 bool hasBasicPrecomputationModeActivation();
170 CBackendRepresentativeMemoryCacheOntologyData* setBasicPrecomputationModeActivation(bool basicPrecomputationActivation);
171
172
173
174 cint64 getIndividualAssociationDataUpdateCount();
175 CBackendRepresentativeMemoryCacheOntologyData* incIndividualAssociationDataUpdateCount(cint64 count = 1);
176
177 cint64 getIndividualAssociationDataDirectUpdateCount();
178 CBackendRepresentativeMemoryCacheOntologyData* incIndividualAssociationDataDirectUpdateCount(cint64 count = 1);
179
180
181 cint64 getIndividualAssociationMergingCount();
182 CBackendRepresentativeMemoryCacheOntologyData* incIndividualAssociationMergingCount(cint64 count = 1);
183
184 cint64 getInvolvedIndividualCount();
185 bool hasInvolvedIndividuals();
186 CBackendRepresentativeMemoryCacheOntologyData* incInvolvedIndividualCount(cint64 count = 1);
187
188
189
190 cint64 getIncompletelyHandledIndividualsRetrievalCount();
191 CBackendRepresentativeMemoryCacheOntologyData* incIncompletelyHandledIndividualsRetrievalCount(cint64 count = 1);
192
193 cint64 getCacheDataUpdateWritingCount();
194 CBackendRepresentativeMemoryCacheOntologyData* incCacheDataUpdateWritingCount(cint64 count = 1);
195
196
197
198 CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker* getLastActiveRecomputationReferenceLinker();
199
200 CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker* getRecomputationReferenceLinker();
201 CBackendRepresentativeMemoryCacheOntologyData* setRecomputationReferenceLinker(CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker* linker);
202
203
204 cint64 getOntologyDataUpdateId();
205 cint64 getMinimumValidRecomputationId();
206 cint64 getNextUpdateMinimumValidRecomputationId();
207
208 CBackendRepresentativeMemoryCacheOntologyData* setMinimumValidRecomputationId(cint64 recomputationId);
209 CBackendRepresentativeMemoryCacheOntologyData* setNextUpdateMinimumValidRecomputationId(cint64 recomputationId);
210
211 CCACHINGMAP<cint64, CBackendRepresentativeMemoryCacheIndividualAssociationContext*>* getRecomputationIdReleasingIndividualAssociationContextMap();
212 CBackendRepresentativeMemoryCacheOntologyData* setRecomputationIdReleasingIndividualAssociationContextMap(CCACHINGMAP<cint64, CBackendRepresentativeMemoryCacheIndividualAssociationContext*>* map);
213 CBackendRepresentativeMemoryCacheIndividualAssociationContext* getReleaseQueuedIndividualAssociationContextLinker();
214 CBackendRepresentativeMemoryCacheOntologyData* setReleaseQueuedIndividualAssociationContextLinker(CBackendRepresentativeMemoryCacheIndividualAssociationContext* linker);
215 CBackendRepresentativeMemoryCacheOntologyData* addReleaseQueuedIndividualAssociationContextLinker(CBackendRepresentativeMemoryCacheIndividualAssociationContext* linker);
216
217 // protected methods
218 protected:
219
220 // protected variables
221 protected:
222 cint64 mOntologyIdentifer;
223 cint64 mUsageCount;
224
225
226 CCACHINGHASH<cint64, CBackendRepresentativeMemoryLabelSignatureResolveCacheItem>* mSigLabelItemHash[CBackendRepresentativeMemoryLabelCacheItem::LABEL_CACHE_ITEM_TYPE_COUNT];
227 cint64 mNextEntryID;
228
229 CCACHINGHASH<cint64, CBackendRepresentativeMemoryCacheIndividualAssociationData*>* mIndiIdAssoDataHash;
230 CCACHINGHASH<cint64, CBackendRepresentativeMemoryCacheNominalIndividualIndirectConnectionData* >* mNominalIndiIdIndirectConnectionDataHash;
231
232
233 cint64 mMaxStoredIndvidualiId;
234
235 cint64 mIndiIdAssoDataVectorSize;
236 CBackendRepresentativeMemoryCacheIndividualAssociationData** mIndiIdAssoDataVector;
237
238 cint64 mLastMinIncompletelyHandledIndiId;
239 cint64 mIncompletelyHandledIndiIdCount;
240 cint64 mIndividualAssociationsCount;
241 bool mAssociationCompleted;
242 bool mFirstIncompletelyHandledIndividualsRetrieved;
243
244 cint64 mMaxIndiAssocDataUpdateCount;
245
246 bool mSameMergedIndisInCache;
247
248
249 CBackendRepresentativeMemoryCacheOntologyContext mTemporaryContext;
250 CBackendRepresentativeMemoryCacheOntologyContext* mOntologyContext;
251
252 CCACHINGSET<cint64>* mProblematicIncompletelyHandledIndiSet;
253
254 CBackendRepresentativeMemoryLabelCacheItem* mPrioritizedPropagationMarkedNeighbourLabelItem;
255
256
257 bool mIndividualLabelAssociationIndexed;
258 QMutex mIndividualLabelAssociationIndexedWaitingMutex;
259 cint64 mIndividualLabelAssociationIndexedWaitingCount;
260 QAtomicInt mIndividualLabelAssociationIndexingCount;
261 QSemaphore mIndividualLabelAssociationIndexedWaitingSemaphore;
262
263 cint64 mNextSlotUpdateWaitingCount;
264 bool mSlotUpdateIntegrated;
265
266 bool mBasicPrecomputationMode;
267 CBackendRepresentativeMemoryCacheIndividualAssociationData** mBasicPrecompuationIndiIdAssoDataVector;
268 cint64 mBasicPrecompuationIndiIdAssoDataVectorSize;
269 cint64 mBasicPrecompuationRetrievalIndiIdPos;
270 bool mBasicPrecomputationModeActivation;
271
272
273 cint64 mInvolvedIndividualCount;
274
275 cint64 mIndividualAssociationDataUpdateCount;
276 cint64 mIndividualAssociationDataDirectUpdateCount;
277 cint64 mIndividualAssociationMergingCount;
278
279 cint64 mIncompletelyHandledIndividualsRetrievalCount;
280 cint64 mCacheDataUpdateWritingCount;
281
282
283 cint64 mMinimumValidRecomputationId;
284 cint64 mNextUpdateMinimumValidRecomputationId;
285
286 CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker* mRecomputationReferenceLinker;
287 CBackendRepresentativeMemoryCacheOntologyDataRecomputationReferenceLinker* mLastActiveRecomputationReferenceLinker;
288 cint64 mOntologyDataUpdateId;
289 CCACHINGMAP<cint64, CBackendRepresentativeMemoryCacheIndividualAssociationContext*>* mRecomputationIdReleasingIndividualAssociationMap;
290 CBackendRepresentativeMemoryCacheIndividualAssociationContext* mReleaseQueuedIndividualAssociationContextLinker;
291
292
293 // private methods
294 private:
295
296 // private variables
297 private:
298
299 };
300
301 }; // end namespace Cache
302
303 }; // end namespace Kernel
304
305 }; // end namespace Reasoner
306
307 }; // end namespace Konclude
308
309 #endif // KONCLUDE_REASONER_KERNEL_CACHE_CBACKENDREPRESENTATIVEMEMORYCACHEONTOLOGYDATA_H