Debian Codegraph @

Source/Reasoner/Preprocess/CPrecomputationPreProcess.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 "CPrecomputationPreProcess.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Preprocess {
29
30
31 CPrecomputationPreProcess::CPrecomputationPreProcess() {
32 }
33
34
35 CPrecomputationPreProcess::~CPrecomputationPreProcess() {
36 }
37
38
39 CConcreteOntology *CPrecomputationPreProcess::preprocess(CConcreteOntology *ontology, CPreProcessContext* context) {
40 CConfiguration* config = context->getConfiguration();
41 if (ontology && config) {
42 CReasonerManager* reasonerManager = CConfigManagerReader::readReasonerManagerConfig(config);
43 if (reasonerManager) {
44 CConfigurationBase* configBase = dynamic_cast<CConfigurationBase*>(config);
45 if (configBase) {
46 bool precomputed = false;
47 CPrecomputationManager* precomputationManager = reasonerManager->getPrecomputationManager();
48 CPrecomputator* precomputator = precomputationManager->getPrecomputator(ontology,configBase);
49 if (precomputator) {
50 precomputed = precomputator->precompute(ontology,configBase,QList<COntologyProcessingRequirement*>());
51 }
52
53 bool consistent = false;
54 CConsistence* consistence = ontology->getConsistence();
55 if (consistence) {
56 consistent = consistence->isOntologyConsistent();
57 QString consString("inconsistent");
58 if (consistent) {
59 consString = "consistent";
60 }
61 LOG(INFO,"::Konclude::Reasoner::Preprocess::OntologyConsistencyChecking",logTr("Ontology is %1.").arg(consString),this);
62 }
63 }
64 }
65 }
66 return ontology;
67 }
68
69
70 }; // end namespace Preprocess
71
72 }; // end namespace Reasoner
73
74 }; // end namespace Konclude