Debian Codegraph @

Source/Reasoner/Query/CRealizeQuery.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 "CRealizeQuery.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Query {
29
30
31 CRealizeQuery::CRealizeQuery(CConcreteOntology* ontology, CConfigurationBase* configuration, const QString& queryName)
32 : CRealizationPremisingQuery(ontology,configuration) {
33 mQueryName = queryName;
34 queryString = QString("Realize Knowledgebase");
35
36 mRealizationCalcError = false;
37 mQueryConstructError = false;
38
39 mRequiresConceptRealisation = CConfigDataReader::readConfigBoolean(configuration,"Konclude.Calculation.Realization.RealizePrecomputation.ConceptInstances",true);
40 mRequiresSameIndividualRealisation = CConfigDataReader::readConfigBoolean(configuration,"Konclude.Calculation.Realization.RealizePrecomputation.SameIndividuals",true);
41 mRequiresRoleRealisation = CConfigDataReader::readConfigBoolean(configuration,"Konclude.Calculation.Realization.RealizePrecomputation.RoleInstances",false);
42
43
44 mResult = nullptr;
45 }
46
47 CRealizeQuery::~CRealizeQuery() {
48 delete mResult;
49 }
50
51
52 CQueryResult* CRealizeQuery::getQueryResult() {
53 return mResult;
54 }
55
56
57 CQueryResult *CRealizeQuery::constructResult(CRealization* realization) {
58 if (realization) {
59 mResult = new CSucceedQueryResult();
60 } else {
61 mQueryConstructError = true;
62 }
63 return mResult;
64 }
65
66 QString CRealizeQuery::getQueryName() {
67 return mQueryName;
68 }
69
70 QString CRealizeQuery::getQueryString() {
71 return queryString;
72 }
73
74 bool CRealizeQuery::hasAnswer() {
75 return mResult != nullptr;
76 }
77
78 QString CRealizeQuery::getAnswerString() {
79 if (mResult) {
80 return QString("Knowledgebase realized");
81 } else {
82 return QString("Knowledgebase not realized");
83 }
84 }
85
86 bool CRealizeQuery::hasError() {
87 return mRealizationCalcError || mQueryConstructError || CQuery::hasError();
88 }
89
90 }; // end namespace Query
91
92 }; // end namespace Reasoner
93
94 }; // end namespace Konclude