Debian Codegraph @

Source/Reasoner/Classifier/CClassClassificationComputationItem.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 "CClassClassificationComputationItem.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Classifier {
29
30
31 CClassClassificationComputationItem::CClassClassificationComputationItem(CSatisfiableCalculationJob* satCalcJob, CConcept *satisfiableTestedConcept) {
32 mSatCalcJob = satCalcJob;
33 testValid = true;
34 conceptSatisfiableTest = true;
35 conceptSubsumptionTest = false;
36 con0 = satisfiableTestedConcept;
37 con1 = 0;
38 }
39
40 CClassClassificationComputationItem::CClassClassificationComputationItem(CSatisfiableCalculationJob* satCalcJob, CConcept *subsumerTestedConcept, CConcept *subsumedTestedConcept) {
41 mSatCalcJob = satCalcJob;
42 testValid = true;
43 conceptSatisfiableTest = false;
44 conceptSubsumptionTest = true;
45 con0 = subsumerTestedConcept;
46 con1 = subsumedTestedConcept;
47 }
48
49 CClassClassificationComputationItem::~CClassClassificationComputationItem() {
50 }
51
52
53
54 bool CClassClassificationComputationItem::isConceptSatisfiableTest() {
55 return conceptSatisfiableTest;
56 }
57
58 bool CClassClassificationComputationItem::isConceptSubsumptionTest() {
59 return conceptSubsumptionTest;
60 }
61
62
63 CConcept *CClassClassificationComputationItem::getSatisfiableTestedConcept() {
64 if (conceptSatisfiableTest) {
65 return con0;
66 }
67 return 0;
68 }
69
70 CConcept *CClassClassificationComputationItem::getSubsumerTestedConcept() {
71 if (conceptSubsumptionTest) {
72 return con0;
73 }
74 return 0;
75 }
76
77 CConcept *CClassClassificationComputationItem::getSubsumedTestedConcept() {
78 if (conceptSubsumptionTest) {
79 return con1;
80 }
81 return 0;
82 }
83
84 bool CClassClassificationComputationItem::isTestValid() {
85 return testValid;
86 }
87
88 CClassClassificationComputationItem *CClassClassificationComputationItem::setTestInvalid() {
89 testValid = false;
90 return this;
91 }
92
93 CSatisfiableCalculationJob* CClassClassificationComputationItem::getSatisfiableCalculationJob()
94 {
95 return mSatCalcJob;
96 }
97
98
99 bool CClassClassificationComputationItem::testIsTestRedundant(CTaxonomy *taxonomy) {
100 bool redundant = false;
101 if (conceptSatisfiableTest) {
102 if (taxonomy->isSatisfiable(con0) || taxonomy->isNotSatisfiable(con0)) {
103 redundant = true;
104 }
105 } else if (conceptSubsumptionTest) {
106 if (taxonomy->isSubsumption(con0,con1) || taxonomy->isNotSubsumption(con0,con1)) {
107 redundant = true;
108 }
109 }
110 return redundant;
111 }
112
113
114
115 }; // end namespace Classifier
116
117 }; // end namespace Reasoner
118
119 }; // end namespace Konclude