Debian Codegraph @

Source/Reasoner/Taxonomy/CAbstractHierarchy.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 #ifndef KONCLUDE_REASONER_TAXONOMY_CABSTRACTHIERARCHY_CPP
22 #define KONCLUDE_REASONER_TAXONOMY_CABSTRACTHIERARCHY_CPP
23
24
25 #include "CAbstractHierarchy.h"
26
27
28 namespace Konclude {
29
30 namespace Reasoner {
31
32 namespace Taxonomy {
33
34
35 template<class T, class N, class E>
36 CAbstractHierarchy<T,N,E>::CAbstractHierarchy() {
37 }
38
39
40
41 template<class T, class N, class E>
42 bool CAbstractHierarchy<T,N,E>::isElementSubsumption(const E& subsumerElement, const E& subsumedElement) {
43 N* subsumerNode = getHierarchyNode(subsumerElement);
44 if (!subsumerNode) {
45 return false;
46 }
47 N* subsumedNode = getHierarchyNode(subsumedElement);
48 if (!subsumedNode) {
49 return false;
50 }
51 return isNodeSubsumption(subsumerNode,subsumedNode);
52 }
53
54 template<class T, class N, class E>
55 bool CAbstractHierarchy<T,N,E>::isElementEquivalence(const E& element1, const E& element2) {
56 N* node1 = getHierarchyNode(element1);
57 if (!node1) {
58 return false;
59 }
60 N* node2 = getHierarchyNode(element2);
61 if (!node2) {
62 return false;
63 }
64 return node1 == node2 || isNodeSubsumption(node1,node2) && isNodeSubsumption(node2,node1);
65 }
66
67 template<class T, class N, class E>
68 bool CAbstractHierarchy<T,N,E>::isElementSatisfiable(const E& element) {
69 N* node = getHierarchyNode(element);
70 if (!node) {
71 return false;
72 }
73 return isNodeSatisfiable(node);
74 }
75
76 template<class T, class N, class E>
77 bool CAbstractHierarchy<T,N,E>::isElementNotSatisfiable(const E& element) {
78 N* node = getHierarchyNode(element);
79 if (!node) {
80 return false;
81 }
82 return isElementNotSatisfiable(node);
83 }
84
85
86
87 template<class T, class N, class E>
88 bool CAbstractHierarchy<T,N,E>::isTopHierarchyElement(const E& element) {
89 N* node = getHierarchyNode(element);
90 if (!node) {
91 return false;
92 }
93 return isTopHierarchyNode(node);
94 }
95
96 template<class T, class N, class E>
97 bool CAbstractHierarchy<T,N,E>::isBottomHierarchyElement(const E& element) {
98 N* node = getHierarchyNode(element);
99 if (!node) {
100 return false;
101 }
102 return isBottomHierarchyNode(node);
103 }
104
105
106
107
108
109 }; // end namespace Taxonomy
110
111 }; // end namespace Reasoner
112
113 }; // end namespace Konclude
114
115 #endif // KONCLUDE_REASONER_TAXONOMY_CABSTRACTHIERARCHY_CPP