Debian Codegraph @

Source/Reasoner/Generator/CConcreteOntologyRedlandTriplesDataExpressionMapper.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_CCONCRETEONTOLOGYREDLANDTRIPLESDATAEXPRESSIONMAPPER_H
23 #define KONCLUDE_REASONER_GENERATOR_CCONCRETEONTOLOGYREDLANDTRIPLESDATAEXPRESSIONMAPPER_H
24
25
26 // Libraries includes
27 #include <QHash>
28 #include <QStack>
29
30
31 // Namespace includes
32 #include "CConcreteOntologyTriplesExpressionMapper.h"
33
34
35 // Other includes
36 #include "Reasoner/Ontology/CConcreteOntology.h"
37
38 #include "Reasoner/Triples/CRedlandStoredTriplesData.h"
39 #include "Reasoner/Triples/CRedlandNodeHasher.h"
40
41 #include "Utilities/Container/CLinker.h"
42
43
44 // Logger includes
45 #include "Logger/CLogger.h"
46
47
48
49
50
51 namespace Konclude {
52
53 using namespace Utilities;
54 using namespace Utilities::Memory;
55 using namespace Utilities::Container;
56 using namespace Parser;
57
58 namespace Reasoner {
59
60 using namespace Ontology;
61 using namespace Triples;
62
63 namespace Generator {
64
65 /*!
66 *
67 * \class CConcreteOntologyRedlandTriplesDataExpressionMapper
68 * \author Andreas Steigmiller
69 * \version 0.1
70 * \brief TODO
71 *
72 */
73 class CConcreteOntologyRedlandTriplesDataExpressionMapper : public CConcreteOntologyTriplesExpressionMapper {
74 // public methods
75 public:
76 CConcreteOntologyRedlandTriplesDataExpressionMapper(COntologyBuilder* ontologyBuilder);
77 virtual ~CConcreteOntologyRedlandTriplesDataExpressionMapper();
78
79
80 virtual bool mapTriples(CConcreteOntology* updateConcreteOntology, COntologyTriplesData* ontologyTripleData);
81
82
83
84
85 // protected functions
86 protected:
87
88
89
90 class CRedlandNodeProcessingData {
91 public:
92 CRedlandNodeProcessingData(librdf_node* redlandNode, CBuildExpression* expression) {
93 mRedlandNode = redlandNode;
94 mExpression = expression;
95 mCurrentId = nextId++;
96 }
97
98 public:
99 librdf_node* mRedlandNode = nullptr;
100 CBuildExpression* mExpression = nullptr;
101 QList<CRedlandNodeProcessingData*>* mDependendRedlandNodeProcessingDataList = nullptr;
102 function<CBuildExpression*(const QList<CBuildExpression*>&)> mExpressionBuildFunc;
103 bool mBuilt = false;
104 bool mProcessed = false;
105 bool mStacked = false;
106 cint64 mCurrentId = 0;
107
108 static int nextId;
109 };
110
111
112
113 class CRedlandTripleStream : public CLinkerBase<CRedlandTripleStream*, CRedlandTripleStream> {
114 public:
115 CRedlandTripleStream* init(librdf_stream* stream) {
116 mStream = stream;
117 mCurrentStatement = nullptr;
118 return this;
119 }
120
121 CRedlandTripleStream* clear() {
122 librdf_free_stream(mStream);
123 mStream = nullptr;
124 mCurrentStatement = nullptr;
125 return this;
126 }
127
128 bool atEnd() {
129 return !mCurrentStatement && librdf_stream_end(mStream);
130 }
131
132 librdf_statement* getStatement() {
133 if (!mCurrentStatement) {
134 mCurrentStatement = librdf_stream_get_object(mStream);
135 }
136 return mCurrentStatement;
137 }
138
139 CRedlandTripleStream* moveNext() {
140 mCurrentStatement = nullptr;
141 librdf_stream_next(mStream);
142 return this;
143 }
144
145 CRedlandTripleStream* forEach(function<void(librdf_statement*)> func) {
146 while (!atEnd()) {
147 librdf_statement* statement = getStatement();
148 func(statement);
149 moveNext();
150 }
151 return this;
152 }
153
154 protected:
155 librdf_statement* mCurrentStatement;
156 librdf_stream* mStream;
157
158 };
159
160
161 class CRedlandNodeStream : public CLinkerBase<CRedlandNodeStream*, CRedlandNodeStream> {
162 public:
163 CRedlandNodeStream* init(CRedlandTripleStream* stream, int nodePos) {
164 mNodePos = nodePos;
165 mCurrentNode = nullptr;
166 mStreamWrapper = stream;
167 return this;
168 }
169
170 CRedlandNodeStream* clear(function<void(CRedlandTripleStream*)> streamFreeFunc) {
171 if (mStreamWrapper) {
172 streamFreeFunc(mStreamWrapper);
173 mStreamWrapper = nullptr;
174 }
175 mCurrentNode = nullptr;
176 mNodePos = 0;
177 return this;
178 }
179
180 librdf_node* getNode() {
181 librdf_statement* statement = mStreamWrapper->getStatement();
182 if (!mCurrentNode) {
183 if (mNodePos == 0) {
184 mCurrentNode = librdf_statement_get_subject(statement);
185 }
186 else if (mNodePos == 1) {
187 mCurrentNode = librdf_statement_get_predicate(statement);
188 }
189 else {
190 mCurrentNode = librdf_statement_get_object(statement);
191 }
192 return mCurrentNode;
193 }
194 return nullptr;
195 }
196
197 CRedlandNodeStream* moveNext() {
198 mCurrentNode = nullptr;
199 mStreamWrapper->moveNext();
200 return this;
201 }
202
203 bool atEnd() {
204 return !mCurrentNode && mStreamWrapper->atEnd();
205 }
206
207 CRedlandNodeStream* forEach(function<void(librdf_node*)> func) {
208 while (!atEnd()) {
209 librdf_node* node = getNode();
210 func(node);
211 moveNext();
212 }
213 return this;
214 }
215
216
217 protected:
218 CRedlandTripleStream* mStreamWrapper;
219 librdf_node* mCurrentNode;
220 int mNodePos;
221
222 };
223
224
225 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildComplexABoxAxioms();
226 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildSimpleABoxAxioms();
227 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectBetweenIndividualsBasedAxiomExpression(CRedlandNodeProcessingData* nextProcessingData, function<CAxiomExpression*(const QList<CBuildExpression*>&)> buildFunc, librdf_statement* filteringStatement, QList<CAxiomExpression*>& axiomList);
228 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectBetweenIndividualsBasedAxiomExpression(function<CAxiomExpression*(const QList<CBuildExpression*>&)> buildFunc, librdf_statement* filteringStatement, QList<CAxiomExpression*>& axiomList);
229
230
231 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectBuildExpressionsFromProcessingDataList(QList<CRedlandNodeProcessingData*>& processingDataList, QList<CBuildExpression*>& expressionList);
232
233 CConcreteOntologyRedlandTriplesDataExpressionMapper* loadExistingEntity(CBuildExpression* expression, const QString& entityUri, librdf_world* world, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CRedlandNodeProcessingData*>& nodeHandlingList);
234 CConcreteOntologyRedlandTriplesDataExpressionMapper* loadExistingEntities(COntologyBuildData* buildData, CRedlandStoredTriplesData* redlandTriplesData);
235 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildDeclarations();
236
237 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildDatatypeBasedAxioms();
238 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildClassBasedAxioms();
239 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildObjectPropertyBasedAxioms();
240 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildDataPropertyBasedAxioms();
241 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildAxioms(QList<CRedlandNodeProcessingData*>* nodeHandlingList, function<void(CRedlandNodeProcessingData*, QList<CAxiomExpression*>&)> dependenciesCollectionFunction);
242
243 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectDatatypeBasedAxiomExpressions(CRedlandNodeProcessingData* processingData, QList<CAxiomExpression*>& axiomExpressions);
244 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectDatatypeBasedAxiomExpressionsBySuccessorRetrieval(CRedlandNodeProcessingData* processingData, QList<CAxiomExpression*>& axiomExpressions);
245
246 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectClassBasedAxiomExpressions(CRedlandNodeProcessingData* processingData, QList<CAxiomExpression*>& axiomExpressions);
247 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectClassBasedAxiomExpressionsBySuccessorRetrieval(CRedlandNodeProcessingData* processingData, QList<CAxiomExpression*>& axiomExpressions);
248
249 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectObjectPropertyBasedAxiomExpressions(CRedlandNodeProcessingData* processingData, QList<CAxiomExpression*>& axiomExpressions);
250 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectObjectPropertyBasedAxiomExpressionsBySuccessorRetrieval(CRedlandNodeProcessingData* processingData, QList<CAxiomExpression*>& axiomExpressions);
251 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectObjectPropertyTypesAxiomExpressionsBySuccessorRetrieval(QList<CAxiomExpression*>& axiomExpressions);
252 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectObjectPropertyTypesAxiomExpressionsBySuccessorRetrieval(function<CRedlandNodeStream*()> nodeStreamFunc, function<CAxiomExpression*(const QList<CBuildExpression*>& expressions)> buildFunc, QList<CAxiomExpression*>& axiomExpressions);
253
254 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectDataPropertyBasedAxiomExpressions(CRedlandNodeProcessingData* processingData, QList<CAxiomExpression*>& axiomExpressions);
255 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectDataPropertyBasedAxiomExpressionsBySuccessorRetrieval(CRedlandNodeProcessingData* processingData, QList<CAxiomExpression*>& axiomExpressions);
256 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectDataPropertyTypesAxiomExpressionsBySuccessorRetrieval(QList<CAxiomExpression*>& axiomExpressions);
257
258 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildSeparateNodeBasedAxioms();
259 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildAxiomExpressionForMemberRDFNodeList(librdf_node* node, librdf_statement* partialFilteringStatementForOWLMembers, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, function<CAxiomExpression*(const QList<CBuildExpression*>&)> buildFunction, QList<CAxiomExpression*>& axiomExpressions);
260 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildAxiomExpressionForMemberRDFNodeListWithNewHandling(librdf_node* node, librdf_statement* partialFilteringStatementForOWLMembers, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, function<CRedlandNodeProcessingData*(librdf_node* node)> newHandlingFunc, function<CAxiomExpression*(const QList<CBuildExpression*>&)> buildFunction, QList<CAxiomExpression*>& axiomExpressions);
261 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildAxiomExpressionForObjectORDataPropertyMemberRDFNodeList(librdf_node* node, librdf_statement* partialFilteringStatementForOWLMembers, function<CAxiomExpression*(const QList<CBuildExpression*>&, bool hasDataProperties, bool hasObjectProperties)> buildFunction, QList<CAxiomExpression*>& axiomExpressions);
262
263 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildAxiomExpressionFromNode(librdf_node* node, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CBuildExpression*>& expressionList, function<CAxiomExpression*(const QList<CBuildExpression*>&)> buildFunction, QList<CAxiomExpression*>& axiomExpressions);
264 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildAxiomExpressionFromRDFNodeList(librdf_node* listNode, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CBuildExpression*>& expressionList, function<CAxiomExpression*(const QList<CBuildExpression*>&)> buildFunction, QList<CAxiomExpression*>& axiomExpressions);
265 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildAxiomExpressionFromRDFNodeListWithNewHandling(librdf_node* listNode, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, function<CRedlandNodeProcessingData*(librdf_node* node)> newHandlingFunc, QList<CBuildExpression*>& expressionList, function<CAxiomExpression*(const QList<CBuildExpression*>&)> buildFunction, QList<CAxiomExpression*>& axiomExpressions);
266
267
268 CConcreteOntologyRedlandTriplesDataExpressionMapper* addBaseNodeExpression(const char* uri, CBuildExpression* expr, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CRedlandNodeProcessingData*>& nodeHandlingList, CRedlandStoredTriplesData* redlandTriplesData);
269 CConcreteOntologyRedlandTriplesDataExpressionMapper* addBaseNodeExpression(librdf_node* node, CBuildExpression* expr, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CRedlandNodeProcessingData*>& nodeHandlingList);
270
271 CConcreteOntologyRedlandTriplesDataExpressionMapper* handleDeclaration(librdf_node* node, function<CBuildExpression*(const QString &uri)> buildEntityFunc, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CRedlandNodeProcessingData*>& nodeHandlingList);
272 CConcreteOntologyRedlandTriplesDataExpressionMapper* handleClassExpressionRestriction(librdf_node* node);
273
274 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectClassExpressionDependencies(CRedlandNodeProcessingData* processingData);
275 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectClassExpressionDependenciesBySuccessorRetrieval(CRedlandNodeProcessingData* processingData);
276 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectDataRangeExpressionDependencies(CRedlandNodeProcessingData* processingData);
277 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectDataRangeExpressionDependenciesBySuccessorRetrieval(CRedlandNodeProcessingData* processingData);
278
279 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectDataFacetExpressionBySuccessorRetrieval(CRedlandNodeProcessingData* processingData, librdf_node* node, librdf_node* facetNode, const char* facetUri);
280
281
282
283 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildExpressions(QList<CRedlandNodeProcessingData*>* nodeHandlingList, function<void(CRedlandNodeProcessingData*)> dependenciesCollectionFunction);
284 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildObjectPropertyExpressions();
285 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildDataRangeExpressions();
286 CConcreteOntologyRedlandTriplesDataExpressionMapper* buildClassExpressions();
287
288
289 CRedlandNodeProcessingData* createLiteralValueProcessingData(librdf_node* node);
290 CRedlandNodeProcessingData* createNamedIndividualProcessingData(librdf_node* node);
291
292 QList<librdf_node*>* getOWLListElementNodesList(librdf_node* listNode, QList<librdf_node*>* extendingList = nullptr);
293
294
295 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectBuildExpressionsFromNode(librdf_node* node, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CBuildExpression*>& existingList);
296 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectBuildExpressionsFromRDFNodeList(librdf_node* node, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CBuildExpression*>& existingList);
297 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectBuildExpressionsFromNodeStream(CRedlandNodeStream* nodeStream, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CBuildExpression*>& existingList);
298
299 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectBuildExpressionsFromNodeWithNewHandling(librdf_node* node, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, function<CRedlandNodeProcessingData*(librdf_node* node)> newHandlingFunc, QList<CBuildExpression*>& existingList);
300 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectBuildExpressionsFromNodeStreamWithNewHandling(CRedlandNodeStream* nodeStream, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, function<CRedlandNodeProcessingData*(librdf_node* node)> newHandlingFunc, QList<CBuildExpression*>& existingList);
301 CConcreteOntologyRedlandTriplesDataExpressionMapper* collectBuildExpressionsFromRDFNodeListWithNewHandling(librdf_node* listNode, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, function<CRedlandNodeProcessingData*(librdf_node* node)> newHandlingFunc, QList<CBuildExpression*>& existingList);
302
303
304 QList<CRedlandNodeProcessingData*>* getNodeProcessingDataListFromNode(librdf_node* node, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CRedlandNodeProcessingData*>* existingList = nullptr);
305 QList<CRedlandNodeProcessingData*>* getNodeProcessingDataListFromNode(librdf_node* node, function<CRedlandNodeProcessingData*(librdf_node*)> resolvingFunc, QList<CRedlandNodeProcessingData*>* existingList);
306 QList<CRedlandNodeProcessingData*>* getNodeProcessingDataListFromNodeWithNewHandling(librdf_node* node, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, function<CRedlandNodeProcessingData*(librdf_node* node)> newHandlingFunc, QList<CRedlandNodeProcessingData*>* existingList);
307
308 QList<CRedlandNodeProcessingData*>* getRDFListElementNodesAsProcessingDataList(librdf_node* listNode, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CRedlandNodeProcessingData*>* existingList = nullptr);
309 QList<CRedlandNodeProcessingData*>* getNodeProcessingDataListFromNodeStream(CRedlandNodeStream* nodeStream, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, QList<CRedlandNodeProcessingData*>* existingList = nullptr);
310
311 QList<CRedlandNodeProcessingData*>* getRDFListElementNodesAsProcessingDataListWithNewHandling(librdf_node* listNode, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, function<CRedlandNodeProcessingData*(librdf_node* node)> newHandlingFunc, QList<CRedlandNodeProcessingData*>* existingList = nullptr);
312 QList<CRedlandNodeProcessingData*>* getNodeProcessingDataListFromNodeStreamWithNewHandling(CRedlandNodeStream* nodeStream, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>& nodeIdentifierDataHash, function<CRedlandNodeProcessingData*(librdf_node* node)> newHandlingFunc, QList<CRedlandNodeProcessingData*>* existingList = nullptr);
313
314 QList<CRedlandNodeProcessingData*>* getNodeProcessingDataListFromNodeStream(CRedlandNodeStream* nodeStream, function<CRedlandNodeProcessingData*(librdf_node*)> resolvingFunc, QList<CRedlandNodeProcessingData*>* existingList = nullptr);
315
316 CRedlandNodeStream* getOWLObjectInverseOfPredecessorNodesStream(librdf_node* currentNode);
317
318
319 CRedlandNodeStream* getOWLIntersectionOfSuccessorNodesStream(librdf_node* currentNode);
320 CRedlandNodeStream* getOWLUnionOfSuccessorNodesStream(librdf_node* currentNode);
321 CRedlandNodeStream* getOWLComplementOfSuccessorNodesStream(librdf_node* currentNode);
322 CRedlandNodeStream* getOWLOneOfSuccessorNodesStream(librdf_node* currentNode);
323 CRedlandNodeStream* getOWLDatatypeComplementOfSuccessorNodesStream(librdf_node* currentNode);
324 CRedlandNodeStream* getOWLOnDatatypeSuccessorNodesStream(librdf_node* currentNode);
325 CRedlandNodeStream* getOWLWithRestrictionSuccessorNodesStream(librdf_node* currentNode);
326 CRedlandNodeStream* getOWLOnPropertySuccessorNodesStream(librdf_node* currentNode);
327
328 CRedlandNodeStream* getOWLSomeValuesFromSuccessorNodesStream(librdf_node* currentNode);
329 CRedlandNodeStream* getOWLAllValuesFromSuccessorNodesStream(librdf_node* currentNode);
330 CRedlandNodeStream* getOWLHasValueSuccessorNodesStream(librdf_node* currentNode);
331 CRedlandNodeStream* getOWLHasSelfSuccessorNodesStream(librdf_node* currentNode);
332 CRedlandNodeStream* getOWLMinCardinalitySuccessorNodesStream(librdf_node* currentNode);
333 CRedlandNodeStream* getOWLMaxCardinalitySuccessorNodesStream(librdf_node* currentNode);
334 CRedlandNodeStream* getOWLCardinalitySuccessorNodesStream(librdf_node* currentNode);
335 CRedlandNodeStream* getOWLMinQualifiedCardinalitySuccessorNodesStream(librdf_node* currentNode);
336 CRedlandNodeStream* getOWLMaxQualifiedCardinalitySuccessorNodesStream(librdf_node* currentNode);
337 CRedlandNodeStream* getOWLQualifiedCardinalitySuccessorNodesStream(librdf_node* currentNode);
338 CRedlandNodeStream* getOWLOnDataRangeSuccessorNodesStream(librdf_node* currentNode);
339 CRedlandNodeStream* getOWLOnClassSuccessorNodesStream(librdf_node* currentNode);
340
341
342
343
344
345 CRedlandNodeStream* getOWLClassInstanceNodesStream();
346 CRedlandNodeStream* getOWLObjectPropertyInstanceNodesStream();
347 CRedlandNodeStream* getOWLDatatypePropertyInstanceNodesStream();
348 CRedlandNodeStream* getRDFSDatatypeInstanceNodesStream();
349 CRedlandNodeStream* getOWLNamedIndividualInstanceNodesStream();
350 CRedlandNodeStream* getOWLRestrictionInstanceNodesStream();
351
352
353 CRedlandNodeStream* getOWLAllDisjointClassesInstanceNodesStream();
354 CRedlandNodeStream* getOWLAllDisjointPropertiesInstanceNodesStream();
355 CRedlandNodeStream* getOWLAllDifferentInstanceNodesStream();
356 CRedlandNodeStream* getOWLAllNegativePropertyAssertionInstanceNodesStream();
357
358
359 CRedlandNodeStream* getOWLFunctionalPropertyInstanceNodesStream();
360 CRedlandNodeStream* getOWLInverseFunctionalPropertyInstanceNodesStream();
361 CRedlandNodeStream* getOWLReflexivePropertyInstanceNodesStream();
362 CRedlandNodeStream* getOWLIrreflexivePropertyInstanceNodesStream();
363 CRedlandNodeStream* getOWLSymmetricPropertyInstanceNodesStream();
364 CRedlandNodeStream* getOWLAsymmetricPropertyInstanceNodesStream();
365 CRedlandNodeStream* getOWLTransetivePropertyInstanceNodesStream();
366
367
368
369 librdf_statement* getAdaptedPartialFilteringStatement(librdf_node* subjectFilterNode, librdf_node* predicateFilterNode, librdf_node* objectFilterNode, librdf_statement*& partialFilteringStatement);
370
371
372 CRedlandTripleStream* getPartialStatementFilteredTripleStream(librdf_statement* partialFilteringStatement);
373 librdf_statement* initPartialFilteringStatement(const char* subjectFilter, const char* predicateFilter, const char* objectFilter, librdf_statement*& partialFilteringStatement);
374 librdf_node* initPredicateIndexMapping(const char* predicateUri, cint64 predicateIndex, QHash<cint64, librdf_node*>* predicateIndexUriNodeHash, QHash<CRedlandNodeHasher, cint64>* predicateNodeIndexHash);
375
376 CConcreteOntologyRedlandTriplesDataExpressionMapper* initTripleDataProcessing(CRedlandStoredTriplesData* redlandTriplesData);
377
378 CRedlandTripleStream* createRedlandTripleStreamWrapper();
379 CConcreteOntologyRedlandTriplesDataExpressionMapper* releaseRedlandTripleStreamWrapper(CRedlandTripleStream* streamWrapper);
380
381 CRedlandNodeStream* createRedlandNodeStreamWrapper();
382 CConcreteOntologyRedlandTriplesDataExpressionMapper* releaseRedlandNodeStreamWrapper(CRedlandNodeStream* streamWrapper);
383
384 bool collectClassExpressionOnPropertyDependenciesReturnPresence(CRedlandNodeProcessingData* processingData, bool* dataPropertyFlag, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>** nodeDataHash = nullptr);
385 QList<CRedlandNodeProcessingData*>* getNodeProcessingDataListFromObjectORDataPropertyNode(librdf_node* node, bool* dataPropertyFlag = nullptr, QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*>** nodeDataHash = nullptr, QList<CRedlandNodeProcessingData*>* existingList = nullptr);
386
387 bool checkHasBooleanTrueLiteralValue(librdf_node* node);
388 cint64 getNonNegativeNumberFromLiteralValue(librdf_node* node);
389
390 CConcreteOntologyRedlandTriplesDataExpressionMapper* clearTripleDataProcessing();
391 CConcreteOntologyRedlandTriplesDataExpressionMapper* clearIndexUriHash(QHash<cint64, librdf_node*>& indexUriNodeHash);
392 CConcreteOntologyRedlandTriplesDataExpressionMapper* clearPartialFilteringStatement(librdf_statement*& partialFilteringStatement);
393
394 librdf_node* initDatatypeMapping(CRedlandStoredTriplesData* redlandTriplesData, const char* datatypeIri);
395
396
397 virtual CConcreteOntologyRedlandTriplesDataExpressionMapper* handleParsedOntologyAxiomExpression(CAxiomExpression* axiomExpression);
398
399
400 // protected variables
401 protected:
402 CRedlandTripleStream* mFreeTripleStreamWrappers = nullptr;
403 CRedlandNodeStream* mFreeNodeStreamWrappers = nullptr;
404
405 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfOwlClass = nullptr;
406 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfOwlRestriction = nullptr;
407 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfOwlObjectProperty = nullptr;
408 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfOwlDataProperty = nullptr;
409 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfRDFSDatatype = nullptr;
410 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfOwlNamedIndividual = nullptr;
411
412 librdf_statement* mPartialFilteringStatementForRDFFirstSuccessors = nullptr;
413 librdf_statement* mPartialFilteringStatementForRDFRestSuccessors = nullptr;
414
415 librdf_statement* mPartialFilteringStatementForOWLComplementOfSuccessors = nullptr;
416 librdf_statement* mPartialFilteringStatementForOWLOneOfSuccessors = nullptr;
417 librdf_statement* mPartialFilteringStatementForOWLDatatypeComplementOfSuccessors = nullptr;
418 librdf_statement* mPartialFilteringStatementForOWLOnDatatypeSuccessors = nullptr;
419 librdf_statement* mPartialFilteringStatementForOWLWithRestrictionSuccessors = nullptr;
420 librdf_statement* mPartialFilteringStatementForOWLFacets = nullptr;
421 librdf_statement* mPartialFilteringStatementForOWLFacetSuccessors = nullptr;
422 librdf_statement* mPartialFilteringStatementForOWLOnPropertySuccessors = nullptr;
423 librdf_statement* mPartialFilteringStatementForOWLSomeValuesFromSuccessors = nullptr;
424 librdf_statement* mPartialFilteringStatementForOWLAllValuesFromSuccessors = nullptr;
425 librdf_statement* mPartialFilteringStatementForOWLHasValueSuccessors = nullptr;
426 librdf_statement* mPartialFilteringStatementForOWLHasSelfSuccessors = nullptr;
427 librdf_statement* mPartialFilteringStatementForOWLMinCardinalitySuccessors = nullptr;
428 librdf_statement* mPartialFilteringStatementForOWLMaxCardinalitySuccessors = nullptr;
429 librdf_statement* mPartialFilteringStatementForOWLCardinalitySuccessors = nullptr;
430 librdf_statement* mPartialFilteringStatementForOWLMinQualifiedCardinalitySuccessors = nullptr;
431 librdf_statement* mPartialFilteringStatementForOWLMaxQualifiedCardinalitySuccessors = nullptr;
432 librdf_statement* mPartialFilteringStatementForOWLQualifiedCardinalitySuccessors = nullptr;
433 librdf_statement* mPartialFilteringStatementForOWLOnDataRangeSuccessors = nullptr;
434 librdf_statement* mPartialFilteringStatementForOWLOnClassSuccessors = nullptr;
435
436 librdf_statement* mPartialFilteringStatementForOWLObjectInverseOfPredecessors = nullptr;
437
438 librdf_statement* mPartialFilteringStatementForOWLIntersectionOfSuccessors = nullptr;
439 librdf_statement* mPartialFilteringStatementForOWLUnionOfSuccessors = nullptr;
440
441 librdf_statement* mPartialFilteringStatementForOWLDataRanges = nullptr;
442 librdf_statement* mPartialFilteringStatementForOWLClasses = nullptr;
443 librdf_statement* mPartialFilteringStatementForOWLAxioms = nullptr;
444
445
446
447 librdf_statement* mPartialFilteringStatementForOWLMembers = nullptr;
448 librdf_statement* mPartialFilteringStatementForOWLDistinctMembers = nullptr;
449 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfAllDisjointClasses = nullptr;
450 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfAllDisjointProperties = nullptr;
451 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfAllDifferent = nullptr;
452 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfNegativePropertyAssertion = nullptr;
453
454
455 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfFunctionalProperty = nullptr;
456 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfInverseFunctionalProperty = nullptr;
457 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfReflexiveProperty = nullptr;
458 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfIrreflexiveProperty = nullptr;
459 librdf_statement* mPartialFilteringStatementForAllRDFTypeOSymmetricProperty = nullptr;
460 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfAsymmetricProperty = nullptr;
461 librdf_statement* mPartialFilteringStatementForAllRDFTypeOfTransetiveProperty = nullptr;
462
463
464
465
466 librdf_statement* mPartialFilteringStatementForOWLSourceIndividualSuccessors = nullptr;
467 librdf_statement* mPartialFilteringStatementForOWLTargetIndividualSuccessors = nullptr;
468 librdf_statement* mPartialFilteringStatementForOWLTargetValueSuccessors = nullptr;
469 librdf_statement* mPartialFilteringStatementForOWLAssertionPropertySuccessors = nullptr;
470
471 librdf_statement* mPartialFilteringStatementForOWLAllRDFTypePredecessors = nullptr;
472
473 librdf_statement* mPartialFilteringStatementForOWLPropertyAssertions = nullptr;
474 librdf_statement* mPartialFilteringStatementForOWLDifferentIndividuals = nullptr;
475 librdf_statement* mPartialFilteringStatementForOWLSameIndividuals = nullptr;
476
477
478
479
480
481
482 librdf_statement* mPartialFilteringStatementForRDFSSubPropertySuccessors = nullptr;
483 librdf_statement* mPartialFilteringStatementForOWLPropertyChainAxiomSuccessors = nullptr;
484 librdf_statement* mPartialFilteringStatementForOWLEquivalentPropertySuccessors = nullptr;
485 librdf_statement* mPartialFilteringStatementForOWLPropertyDisjointWithSuccessors = nullptr;
486
487 librdf_statement* mPartialFilteringStatementForRDFSRangeSuccessors = nullptr;
488 librdf_statement* mPartialFilteringStatementForRDFSDomainSuccessors = nullptr;
489 librdf_statement* mPartialFilteringStatementForOWLInverseOfSuccessors = nullptr;
490
491
492 librdf_statement* mPartialFilteringStatementForRDFSSubClassOfSuccessors = nullptr;
493 librdf_statement* mPartialFilteringStatementForOWLEquivalentClassesSuccessors = nullptr;
494 librdf_statement* mPartialFilteringStatementForOWLDisjointClassesSuccessors = nullptr;
495 librdf_statement* mPartialFilteringStatementForOWLDisjointUnionSuccessors = nullptr;
496
497
498
499
500
501
502 librdf_node* mRDFNilNode = nullptr;
503 librdf_uri* mBooleanDatatypeUri = nullptr;
504
505
506 CRedlandStoredTriplesData* mRedlandTriplesData;
507
508 QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*> mClassNodeIdentifierDataHash;
509 QList<CRedlandNodeProcessingData*> mClassNodeHandlingList;
510
511 QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*> mObjectPropertyNodeIdentifierDataHash;
512 QList<CRedlandNodeProcessingData*> mObjectPropertyNodeHandlingList;
513
514 QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*> mDataPropertyNodeIdentifierDataHash;
515 QList<CRedlandNodeProcessingData*> mDataPropertyNodeHandlingList;
516
517 QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*> mDatatypeNodeIdentifierDataHash;
518 QList<CRedlandNodeProcessingData*> mDatatypeNodeHandlingList;
519
520 QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*> mNamedIndividualNodeIdentifierDataHash;
521 QList<CRedlandNodeProcessingData*> mNamedIndividualNodeHandlingList;
522
523 QHash<CRedlandNodeHasher, CRedlandNodeProcessingData*> mDataLiteralNodeIdentifierDataHash;
524 QList<CRedlandNodeProcessingData*> mDataFacetRestrictionHandlingContainerList;
525
526 QHash<CRedlandNodeHasher, cint64> mDataRangePredicateIndexHash;
527 QHash<cint64, librdf_node*> mDataRangePredicateIndexUriNodeHash;
528
529 QHash<CRedlandNodeHasher, cint64> mClassPredicateIndexHash;
530 QHash<cint64, librdf_node*> mClassPredicateIndexUriNodeHash;
531
532 QHash<CRedlandNodeHasher, cint64> mClassBasedAxiomPredicateIndexHash;
533 QHash<cint64, librdf_node*> mClassBasedAxiomPredicateIndexUriNodeHash;
534
535 QHash<CRedlandNodeHasher, cint64> mDatatypeBasedAxiomPredicateIndexHash;
536 QHash<cint64, librdf_node*> mDatatypeBasedAxiomPredicateIndexUriNodeHash;
537
538 QHash<CRedlandNodeHasher, cint64> mPropertyBasedAxiomPredicateIndexHash;
539 QHash<cint64, librdf_node*> mPropertyBasedAxiomPredicateIndexUriNodeHash;
540
541 QHash<CRedlandNodeHasher, cint64> mPropertyBasedAxiomObjectIndexHash;
542 QHash<cint64, librdf_node*> mPropertyBasedAxiomObjectIndexUriNodeHash;
543
544
545 QHash<const char*, librdf_node*> mFacetUriNodeHash;
546
547
548 static const cint64 mOWLIntersectionOfPredicateIndex = 0;
549 static const cint64 mOWLUnionOfPredicateIndex = 1;
550 static const cint64 mOWLDatatypeComplementOfPredicateIndex = 2;
551 static const cint64 mOWLOneOfPredicateIndex = 3;
552 static const cint64 mOWLOnDatatypePredicateIndex = 4;
553 static const cint64 mOWLWithRestrictionPredicateIndex = 5;
554
555 static const cint64 mOWLComplementOfPredicateIndex = 6;
556 static const cint64 mOWLOnPropertyPredicateIndex = 7;
557 static const cint64 mOWLSomeValuesFromPredicateIndex = 8;
558 static const cint64 mOWLAllValuesFromPredicateIndex = 9;
559 static const cint64 mOWLHasValuePredicateIndex = 10;
560 static const cint64 mOWLHasSelfPredicateIndex = 11;
561 static const cint64 mOWLOnClassPredicateIndex = 12;
562 static const cint64 mOWLMinQualifiedCardinalityPredicateIndex = 13;
563 static const cint64 mOWLMaxQualifiedCardinalityPredicateIndex = 14;
564 static const cint64 mOWLQualifiedCardinalityPredicateIndex = 15;
565
566 static const cint64 mOWLMinCardinalityPredicateIndex = 16;
567 static const cint64 mOWLMaxCardinalityPredicateIndex = 17;
568 static const cint64 mOWLCardinalityPredicateIndex = 18;
569 static const cint64 mOWLOnDataRangePredicateIndex = 19;
570
571
572
573 static const cint64 mOWLClassAxiomSubClassOfPredicateIndex = 1;
574 static const cint64 mOWLClassAxiomEquvialentClassPredicateIndex = 2;
575 static const cint64 mOWLClassAxiomDisjointWithPredicateIndex = 3;
576 static const cint64 mOWLClassAxiomDisjointUnionOfPredicateIndex = 4;
577
578 static const cint64 mOWLPredicateBasedAxiomSubPropertyOfPredicateIndex = 1;
579 static const cint64 mOWLPredicateBasedAxiomPropertyChainAxiomPredicateIndex = 2;
580 static const cint64 mOWLPredicateBasedAxiomEquivalentPropertyPredicateIndex = 3;
581 static const cint64 mOWLPredicateBasedAxiomPropertyDisjointWithPredicateIndex = 4;
582 static const cint64 mOWLPredicateBasedAxiomDomainPredicateIndex = 5;
583 static const cint64 mOWLPredicateBasedAxiomRangePredicateIndex = 6;
584 static const cint64 mOWLPredicateBasedAxiomInverseOfPredicateIndex = 7;
585 static const cint64 mRDFPredicateBasedAxiomTypeOfPredicateIndex = 8;
586
587 static const cint64 mOWLPredicateBasedAxiomTypeFunctionalPropertyObjectIndex = 1;
588 static const cint64 mOWLPredicateBasedAxiomTypeInverseFunctionalPropertyObjectIndex = 2;
589 static const cint64 mOWLPredicateBasedAxiomTypeReflexivePropertyObjectIndex = 3;
590 static const cint64 mOWLPredicateBasedAxiomTypeIrreflexivePropertyObjectIndex = 4;
591 static const cint64 mOWLPredicateBasedAxiomTypeSymmetricPropertyObjectIndex = 5;
592 static const cint64 mOWLPredicateBasedAxiomTypeAsymmetricPropertyObjectIndex = 6;
593 static const cint64 mOWLPredicateBasedAxiomTypeTransitivePropertyObjectIndex = 7;
594
595
596 static const cint64 mOWLPredicateMaxIndex = 20;
597 static const cint64 mOWLDataRangePredicateMaxIndex = 6;
598 static const cint64 mOWLClassPredicateMaxIndex = 20;
599
600
601
602 bool mConfSuccessorRetrieval = true;
603 bool mConfExtractSimpleABoxAssertions = false;
604
605
606 };
607
608
609
610
611
612
613
614 }; // end namespace Generator
615
616 }; // end namespace Reasoner
617
618 }; // end namespace Konclude
619
620 #endif // end KONCLUDE_REASONER_GENERATOR_CCONCRETEONTOLOGYREDLANDTRIPLESDATAEXPRESSIONMAPPER_H
621
622 #endif // !KONCLUDE_REDLAND_INTEGRATION