Debian Codegraph @

Source/Reasoner/Answerer/CComplexQueryMaterializationData.cpp

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 #include "CComplexQueryMaterializationData.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Answerer {
29
30
31 CComplexQueryMaterializationData::CComplexQueryMaterializationData() {
32 mTemporaryMaterializationOntology = nullptr;
33 }
34
35
36 CComplexQueryMaterializationData::~CComplexQueryMaterializationData() {
37 }
38
39
40
41 CIndividual* CComplexQueryMaterializationData::getVariableIndividual(CExpressionVariable* variable) {
42 CIndividual*& indi = mVariableIndividualHash[variable];
43
44 if (!indi) {
45 CABox* tempMatAbox = mTemporaryMaterializationOntology->getABox();
46 CIndividualVector* indiVec = tempMatAbox->getIndividualVector(true);
47
48 CIndividual* tmpIndi = new CIndividual();
49 tmpIndi->initIndividual(tempMatAbox->getNextIndividualId(true));
50 indiVec->setData(tmpIndi->getIndividualID(), tmpIndi);
51 tmpIndi->setTemporaryFakeIndividual(true);
52
53 indi = tmpIndi;
54
55 mIndividualVariableHash.insert(indi, variable);
56 }
57
58 return indi;
59 }
60
61
62 CExpressionVariable* CComplexQueryMaterializationData::getVariable(CIndividual* indi) {
63 return mIndividualVariableHash.value(indi);
64 }
65
66
67
68 QList<CIndividual*> CComplexQueryMaterializationData::getVariableIndividualList() {
69 return mVariableIndividualHash.values();
70 }
71
72
73 QHash<CExpressionVariable*, CConcept*>* CComplexQueryMaterializationData::getVariableMaterializedConceptsHash() {
74 return &mVariableMaterializedConceptsHash;
75 }
76
77
78 CConcreteOntology* CComplexQueryMaterializationData::getTemporaryMaterializationOntology() {
79 return mTemporaryMaterializationOntology;
80 }
81
82 CComplexQueryMaterializationData* CComplexQueryMaterializationData::setTemporaryMaterializationOntology(CConcreteOntology* tmpOnto) {
83 mTemporaryMaterializationOntology = tmpOnto;
84 return this;
85 }
86
87
88 }; // end namespace Answerer
89
90 }; // end namespace Reasoner
91
92 }; // end namespace Konclude