Debian Codegraph @

Source/Reasoner/Triples/CRedlandStoredTriplesIndividualAssertionConvertionQtConcurrentIndexer.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 #ifdef KONCLUDE_REDLAND_INTEGRATION
21
22 #ifndef KONCLUDE_REASONER_GENERATOR_CRedlandStoredTriplesIndividualAssertionConvertionQtConcurrentIndexer_H
23 #define KONCLUDE_REASONER_GENERATOR_CRedlandStoredTriplesIndividualAssertionConvertionQtConcurrentIndexer_H
24
25
26 // Libraries includes
27 #include <QHash>
28 #include <QCache>
29 #include <QtConcurrent>
30
31
32 // Namespace includes
33 #include "TriplesSettings.h"
34 #include "CRedlandStoredTriplesIndividualAssertionConvertionIndexer.h"
35 #include "CRedlandStoredTriplesIndexingBaseBatchLinkerVectorData.h"
36 #include "CRedlandStoredTriplesIndexingBaseBatchLinkerVector.h"
37 #include "CRedlandStoredTriplesIndexingBaseBatchLinker.h"
38 #include "CRedlandStoredTriplesIndexingBaseResolvingLinker.h"
39 #include "CRedlandStoredTriplesIndividualResolvingHashMemoryManaged.h"
40
41
42 // Other includes
43 #include "Reasoner/Ontology/CConcreteOntology.h"
44 #include "Reasoner/Ontology/CIndividualProcessData.h"
45
46 #include "Reasoner/Preprocess/CDataLiteralNormalizerPreProcess.h"
47 #include "Reasoner/Preprocess/CPreProcessContextBase.h"
48 #include "Reasoner/Preprocess/CPreProcessContext.h"
49
50 #include "Utilities/Container/CLinker.h"
51
52
53 // Logger includes
54 #include "Logger/CLogger.h"
55
56
57
58
59
60 namespace Konclude {
61
62 using namespace Utilities;
63 using namespace Utilities::Memory;
64 using namespace Utilities::Container;
65
66 namespace Reasoner {
67
68 using namespace Ontology;
69 using namespace Preprocess;
70
71 namespace Triples {
72
73
74 /*!
75 *
76 * \class CRedlandStoredTriplesIndividualAssertionConvertionQtConcurrentIndexer
77 * \author Andreas Steigmiller
78 * \version 0.1
79 * \brief TODO
80 *
81 */
82 class CRedlandStoredTriplesIndividualAssertionConvertionQtConcurrentIndexer : public CRedlandStoredTriplesIndividualAssertionConvertionIndexer {
83 // public methods
84 public:
85 CRedlandStoredTriplesIndividualAssertionConvertionQtConcurrentIndexer();
86 virtual ~CRedlandStoredTriplesIndividualAssertionConvertionQtConcurrentIndexer();
87
88
89
90 virtual bool indexABoxIndividuals(CConcreteOntology* updateConcreteOntology, COntologyTriplesData* ontologyTripleData);
91
92
93 // protected functions
94 protected:
95 void procssIndividualIndexing(CRedlandStoredTriplesIndexingBaseBatchLinkerVector<CRedlandStoredTriplesIndexingBaseResolvingLinker>& mappedIndi2HashKeyVec, CRedlandStoredTriplesData* redlandTriplesData, CConcreteOntology* updateConcreteOntology);
96
97 virtual void indexTriples(CRedlandStoredTriplesData* redlandTriplesData, librdf_node* rdfTypePredicate, librdf_node* namedIndividualObject, CConcreteOntology* updateConcreteOntology);
98
99 void indexHashExistingIndividuals(CConcreteOntology* updateConcreteOntology);
100
101 void handleStatementMapping(librdf_statement* statement, CRedlandStoredTriplesIndexingBaseBatchLinkerVector<CRedlandStoredTriplesIndexingBaseResolvingLinker> &keyMappedVec, librdf_node* rdfTypePredicate, librdf_node* namedIndividualObject);
102
103 void indexTripleData(QList<CTriplesData*>* triplesDataList, CConcreteOntology* updateConcreteOntology);
104
105 cint64 getCStringHashValue(const char* p);
106 cint64 getNodeHashValue(librdf_node* redlandNode);
107 CIndividual* getIndividual(librdf_node* redlandNode, CRedlandStoredTriplesIndividualResolvingHashMemoryManaged* indiResolveHash, CRedlandStoredTriplesIndexingBaseBatchLinkerVector<CRedlandStoredTriplesIndexingBaseResolvingLinker>* keyMappedVec);
108
109 void clearMemoryPools(CMemoryPool* memPools);
110
111 // protected variables
112 protected:
113 bool mExistingEntitiesInitialized = false;
114 bool mExistingIndividualsHashed = false;
115 cint64 mIndiResolvingKeyCount = 211;
116 QVector<CRedlandStoredTriplesIndividualResolvingHashMemoryManaged*> mIndiResolvingHashVec;
117
118 function<void(CRedlandStoredTriplesIndexingBaseBatchLinkerVector<CRedlandStoredTriplesIndexingBaseResolvingLinker>& vec, const CRedlandStoredTriplesIndexingBaseBatchLinkerVector<CRedlandStoredTriplesIndexingBaseResolvingLinker>& reduceVec)> mIndiKeyReduceFunc;
119 function<void(CRedlandStoredTriplesData*& redlandTriplesData)> mTripleDeleteMapFunc;
120 function<void(CMemoryPool* memPools)> mClearMemoryPoolsFunc;
121
122
123 };
124
125
126
127
128
129 }; // end namespace Triples
130
131 }; // end namespace Reasoner
132
133 }; // end namespace Konclude
134
135 #endif // end KONCLUDE_REASONER_GENERATOR_CRedlandStoredTriplesIndividualAssertionConvertionQtConcurrentIndexer_H
136
137 #endif // !KONCLUDE_REDLAND_INTEGRATION