Debian Codegraph @

Source/Reasoner/Kernel/Algorithm/CIndividualNodeBackendCacheHandler.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_ALGORITHM_CINDIVIDUALNODEBACKENDCACHEHANDLER_H
22 #define KONCLUDE_REASONER_KERNEL_ALGORITHM_CINDIVIDUALNODEBACKENDCACHEHANDLER_H
23
24 // Libraries includes
25
26
27 // Namespace includes
28 #include "AlgorithmSettings.h"
29 #include "CCalculationAlgorithmContext.h"
30 #include "CBackendAssociationCacheHandler.h"
31
32 // Other includes
33 #include "Reasoner/Kernel/Process/CIndividualProcessNodeLinker.h"
34 #include "Reasoner/Kernel/Process/CIndividualNodeRepresentativeMemoryBackendCacheSynchronisationData.h"
35
36 #include "Reasoner/Kernel/Process/Dependency/CROLEASSERTIONDependencyNode.h"
37 #include "Reasoner/Kernel/Process/Dependency/CVALUEDependencyNode.h"
38 #include "Reasoner/Kernel/Process/Dependency/CMERGEDLINKDependencyNode.h"
39
40 #include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheReader.h"
41 #include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheWriter.h"
42 #include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryLabelCacheItem.h"
43 #include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheLabelAssociationWriteData.h"
44 #include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker.h"
45 #include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheTemporaryLabelWriteDataLinker.h"
46 #include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheUtilities.h"
47 #include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheTemporaryNominalIndirectConnectionDataLinker.h"
48 #include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheTemporaryInvolvedIndividualDataLinker.h"
49 #include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheTemporaryPropagationCutDataLinker.h"
50
51
52 #include "Reasoner/Kernel/Task/CSatisfiableTaskRepresentativeBackendUpdatingAdapter.h"
53
54
55 #include "Context/CContextBase.h"
56
57 // Logger includes
58 #include "Logger/CLogger.h"
59
60
61
62 namespace Konclude {
63
64 using namespace Context;
65
66 namespace Reasoner {
67
68 using namespace Ontology;
69
70 namespace Kernel {
71
72 using namespace Process;
73 using namespace Dependency;
74 using namespace Cache;
75 using namespace Task;
76
77 namespace Algorithm {
78
79 /*!
80 *
81 * \class CIndividualNodeBackendCacheHandler
82 * \author Andreas Steigmiller
83 * \version 0.1
84 * \brief TODO
85 *
86 */
87 class CIndividualNodeBackendCacheHandler : public CBackendAssociationCacheHandler {
88 // public methods
89 public:
90 //! Constructor
91 CIndividualNodeBackendCacheHandler(CBackendRepresentativeMemoryCacheReader* backAssCacheReader, CBackendRepresentativeMemoryCacheWriter* backAssCacheWriter);
92
93
94
95 bool tryAssociateNodesWithBackendCache(CXLinker<CIndividualProcessNode*>* indiNodeLinker, CSatisfiableTaskRepresentativeBackendUpdatingAdapter* repbackUpdAdapter, CCalculationAlgorithmContext* calcAlgContext);
96
97
98 // protected methods
99 protected:
100
101 CIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher getIndividualRepresentativeBackendCacheConceptSetLabelProcessingHasher(CIndividualProcessNode* indiNode, CCalculationAlgorithmContext* calcAlgContext);
102
103
104 bool determineSameIndividualSetLabelAssociationBackendItem(CIndividualProcessNode* indiNode, cint64 labelType, CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* tmpAssWriteDataLinker, bool* integratedAllMergingsFlag, CCalculationAlgorithmContext* calcAlgContext);
105 bool determineDifferentIndividualSetLabelAssociationBackendItem(CIndividualProcessNode* indiNode, cint64 labelType, CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* tmpAssWriteDataLinker, bool* integratedAllDifferentFlag, CCalculationAlgorithmContext* calcAlgContext);
106
107
108
109 bool determineConceptSetLabelAssociationBackendItem(CIndividualProcessNode* indiNode, cint64 labelType, CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* tmpAssWriteDataLinker, CCalculationAlgorithmContext* calcAlgContext);
110 bool determineAssociationBackendCardinality(CIndividualProcessNode* indiNode, CPROCESSHASH<CRole*, cint64>* roleUsedCardHash, CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* tmpAssWriteDataLinker, CCalculationAlgorithmContext* calcAlgContext);
111
112
113 bool determineRoleInstantiatedSetLabelAssociationBackendItems(CIndividualProcessNode* extractionIndiNode, CIndividualProcessNode* indiNode, bool onlyNondeterministic, CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* tmpAssWriteDataLinker, CPROCESSSET<cint64>** existentialIndirectlyConnectedNominalIndividualSet, CPROCESSHASH<CRole*, cint64>* roleUsedCardHash, QSet<cint64>* propCutIndiSet, CCalculationAlgorithmContext* calcAlgContext);
114
115
116 void collectRoleSuccessorData(CIndividualLinkEdge* link, bool inversed, cint64 maxDetBranchTag, bool isNominalNeighbour, bool isDataNeighbour, CPROCESSSET<TRoleInversionPair>* combinedNeighbourDetRoleInstantiatedSet, CSortedNegLinker<CRole *>*& combinedNeighbourDetRoleInstantiatedLinker,
117 CPROCESSSET<TRoleInversionPair>* combinedNeighbourNonDetRoleInstantiatedSet, CSortedNegLinker<CRole *>*& combinedNeighbourNonDetRoleInstantiatedLinker, CPROCESSSET<TRoleInversionPair>* combinedExistentialDetRoleInstantiatedSet, CSortedNegLinker<CRole *>*& combinedExistentialDetRoleInstantiatedLinker,
118 CPROCESSSET<TRoleInversionPair>* combinedExistentialNonDetRoleInstantiatedSet, CSortedNegLinker<CRole *>*& combinedExistentialNonDetRoleInstantiatedLinker, CPROCESSSET<TRoleInversionPair>* combinedDataDetRoleInstantiatedSet, CSortedNegLinker<CRole *>*& combinedDataDetRoleInstantiatedLinker,
119 CPROCESSSET<TRoleInversionPair>* combinedDataNonDetRoleInstantiatedSet, CSortedNegLinker<CRole *>*& combinedDataNonDetRoleInstantiatedLinker, CRole* role, CCalculationAlgorithmContext* calcAlgContext, bool &collected, CIndividualProcessNode* indiNode, CIndividualProcessNode* connIndiNode,
120 cint64 connIndiMergedNominalId, bool connIndiNominalDeterministicallyMerged, CBackendRepresentativeMemoryCacheRoleAssertionLinker* &roleAssertionLinke, CPROCESSSET<cint64>** existentialIndirectlyConnectedNominalIndividualSet, CPROCESSHASH<CRole*, cint64>* roleUsedCardHash,
121 CBackendRepresentativeMemoryLabelCacheItem* prevNeighbourRoleSetLabelRef);
122
123
124 CIndividualProcessNode* getSuccessorIndividual(CIndividualProcessNode*& indi, CIndividualLinkEdge* link, CCalculationAlgorithmContext* calcAlgContext);
125 CIndividualProcessNode* getMergedIntoIndividualNode(CIndividualProcessNode* indi, bool onlyDeterministic, CCalculationAlgorithmContext* calcAlgContext);
126 CBackendRepresentativeMemoryCacheIndividualAssociationData* getIndividualAssociationDataFromIndividualNode(CIndividualProcessNode* indiNode, CCalculationAlgorithmContext* calcAlgContext);
127
128
129 bool determineNondeterministicConceptSetLabelAssociationBackendItemWithExcludedConceptsFromDeterministicLabel(CIndividualProcessNode* extractionIndiNode, CIndividualProcessNode* indiNode, CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* tmpAssWriteDataLinker, CCalculationAlgorithmContext* calcAlgContext);
130
131
132 bool determineFullConceptSetLabelAssociationBackendItemWithSeparatedDeterministicNode(CIndividualProcessNode* extractionIndiNode, CIndividualProcessNode* deterministicConSetNode, CIndividualProcessNode* indiNode, CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* tmpAssWriteDataLinker, CCalculationAlgorithmContext* calcAlgContext);
133
134
135 bool visitMergedIndividualNodesAssociationData(CIndividualProcessNode* baseIndiNode, CBackendRepresentativeMemoryCacheIndividualAssociationData* excludeIndiAssData, CBackendRepresentativeMemoryLabelCacheItem* excludeIndiSetLabel, bool visitBaseIndiAssoData, cint64 maxDetBranchTag, function<bool(cint64 mergedIndiId, CBackendRepresentativeMemoryCacheIndividualAssociationData* mergedIndiAssData, bool deterministicallyMerged)> visitFunc, CCalculationAlgorithmContext* calcAlgContext);
136
137
138 CBackendRepresentativeMemoryCacheTemporaryInvolvedIndividualDataLinker* getInvolvedIndividualData(CCalculationAlgorithmContext* calcAlgContext);
139 CBackendRepresentativeMemoryCacheTemporaryPropagationCutDataLinker* getPropagationCutIndividualData(QSet<cint64>*& propCutIndiSet, CSatisfiableTaskRepresentativeBackendUpdatingAdapter* repbackUpdAdapter, CCalculationAlgorithmContext* calcAlgContext);
140
141
142 // protected variables
143 protected:
144 CPROCESSHASH< cint64, CBackendRepresentativeMemoryCacheTemporaryLabelWriteDataLinker* >* mSignatureTmpDetConSetRefLabelHash;
145 CPROCESSHASH< cint64, CBackendRepresentativeMemoryCacheTemporaryLabelWriteDataLinker* >* mSignatureTmpNonDetConSetRefLabelHash;
146
147 CPROCESSHASH< cint64, CBackendRepresentativeMemoryCacheTemporaryLabelWriteDataLinker* >* mSignatureTmpDetSameIndiSetRefLabelHash;
148 CPROCESSHASH< cint64, CBackendRepresentativeMemoryCacheTemporaryLabelWriteDataLinker* >* mSignatureTmpNonDetSameIndiSetRefLabelHash;
149
150
151 CPROCESSHASH< cint64, CBackendRepresentativeMemoryCacheTemporaryLabelWriteDataLinker* >* mSignatureTmpDetDiffIndiSetRefLabelHash;
152 CPROCESSHASH< cint64, CBackendRepresentativeMemoryCacheTemporaryLabelWriteDataLinker* >* mSignatureTmpNonDetDiffIndiSetRefLabelHash;
153
154
155
156 // private methods
157 private:
158
159 // private variables
160 private:
161
162 };
163
164 }; // end namespace Algorithm
165
166 }; // end namespace Kernel
167
168 }; // end namespace Reasoner
169
170 }; // end namespace Konclude
171
172 #endif // KONCLUDE_REASONER_KERNEL_ALGORITHM_CINDIVIDUALNODEBACKENDCACHEHANDLER_H