Debian Codegraph @

Kernel/tAxiom.h

raw symbols SCIP
1 /* This file is part of the FaCT++ DL reasoner
2 Copyright (C) 2003-2015 Dmitry Tsarkov and The University of Manchester
3 Copyright (C) 2015-2017 Dmitry Tsarkov
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef TAXIOM_H
21 #define TAXIOM_Hcxx . . $ `Kernel/tAxiom.h:21:9`!
22
23 // uncomment this to have absorption debug messages
24 //#define RKG_DEBUG_ABSORPTION
25
26 #ifdef RKG_DEBUG_ABSORPTION
27 # include <iostream>
28 #else
29 # include <iosfwd>
30 #endif
31
32 #include <vector>
33
34 #include "globaldef.h"cxx . . $ `<file>/Kernel/globaldef.h`/
35 #include "dltree.h"cxx . . $ `<file>/Kernel/dltree.h`/
36 #include "tConcept.h"cxx . . $ `<file>/Kernel/tConcept.h`/
37 #include "tRole.h"cxx . . $ `<file>/Kernel/tRole.h`/
38 #include "counter.h"cxx . . $ `<file>/Kernel/counter.h`/
39
40 class TBoxcxx . . $ TBox#;
41
42 // statistical counters lives here
43 namespace Statcxx . . $ Stat/
44 {
45 class SAbsRepCNcxx . . $ Stat/SAbsRepCN#: public countercxx . . $ counter#<SAbsRepCNcxx . . $ Stat/SAbsRepCN#> {};
46 class SAbsRepForallcxx . . $ Stat/SAbsRepForall#: public countercxx . . $ counter#<SAbsRepForallcxx . . $ Stat/SAbsRepForall#> {};
47 class SAbsSplitcxx . . $ Stat/SAbsSplit#: public countercxx . . $ counter#<SAbsSplitcxx . . $ Stat/SAbsSplit#> {};
48 class SAbsBApplycxx . . $ Stat/SAbsBApply#: public countercxx . . $ counter#<SAbsBApplycxx . . $ Stat/SAbsBApply#> {};
49 class SAbsTApplycxx . . $ Stat/SAbsTApply#: public countercxx . . $ counter#<SAbsTApplycxx . . $ Stat/SAbsTApply#> {};
50 class SAbsCApplycxx . . $ Stat/SAbsCApply#: public countercxx . . $ counter#<SAbsCApplycxx . . $ Stat/SAbsCApply#> {};
51 class SAbsCAttemptcxx . . $ Stat/SAbsCAttempt#: public countercxx . . $ counter#<SAbsCAttemptcxx . . $ Stat/SAbsCAttempt#> {};
52 class SAbsNApplycxx . . $ Stat/SAbsNApply#: public countercxx . . $ counter#<SAbsNApplycxx . . $ Stat/SAbsNApply#> {};
53 class SAbsNAttemptcxx . . $ Stat/SAbsNAttempt#: public countercxx . . $ counter#<SAbsNAttemptcxx . . $ Stat/SAbsNAttempt#> {};
54 class SAbsRApplycxx . . $ Stat/SAbsRApply#: public countercxx . . $ counter#<SAbsRApplycxx . . $ Stat/SAbsRApply#> {};
55 class SAbsRAttemptcxx . . $ Stat/SAbsRAttempt#: public countercxx . . $ counter#<SAbsRAttemptcxx . . $ Stat/SAbsRAttempt#> {};
56 }
57
58 // NS for different DLTree matchers for trees in axiom
59 namespace InAxcxx . . $ InAx/
60 {
61 /// build an RW concept from a given [C|I]NAME-rooted DLTree
62 inline TConceptcxx . . $ TConcept#* getConceptcxx . . $ InAx/getConcept(9b2c8167507be48a). ( DLTreecxx . . $ DLTree#* p )
63 { return static_cast<TConceptcxx . . $ TConcept#*>(p->Elementcxx . . $ TsTTree#Element(19b2b6f17af048b).().getNEcxx . . $ TLexeme#getNE(28c03b9fd3c689f8).()); }
64 /// build an RO concept from a given [C|I]NAME-rooted DLTree
65 inline const TConceptcxx . . $ TConcept#* getConceptcxx . . $ InAx/getConcept(23efbc37c948274b). ( const DLTreecxx . . $ DLTree#* p )
66 { return static_cast<const TConceptcxx . . $ TConcept#*>(p->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).().getNEcxx . . $ TLexeme#getNE(28c03b9fd3c689f8).()); }
67 /// @ return true if a concept C is a concept is non-primitive
68 bool isNPcxx . . $ InAx/isNP(e710061aa085e772). ( const TConceptcxx . . $ TConcept#* C, TBoxcxx . . $ TBox#& KB );
69
70 /// @return true iff P is a TOP
71 inline bool isTopcxx . . $ InAx/isTop(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p ) { return p->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).() ==cxx . . $ TLexeme#`operator==`(b418e6031985303a). BOTTOMcxx . . $ BOTTOM.; }
72 /// @return true iff P is a BOTTOM
73 inline bool isBotcxx . . $ InAx/isBot(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p ) { return p->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).() ==cxx . . $ TLexeme#`operator==`(b418e6031985303a). TOPcxx . . $ TOP.; }
74 /// @return true iff P is a positive concept name
75 inline bool isPosCNcxx . . $ InAx/isPosCN(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p ) { return p->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).() ==cxx . . $ TLexeme#`operator==`(b418e6031985303a). NOTcxx . . $ NOT. && isNamecxx . . $ isName(937bda690ff1bb73).(p->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).()); }
76 /// @return true iff P is a positive non-primitive CN
77 inline bool isPosNPcxx . . $ InAx/isPosNP(136d7af063eca941). ( const DLTreecxx . . $ DLTree#* p, TBoxcxx . . $ TBox#& KB )
78 { return isPosCNcxx . . $ InAx/isPosCN(937bda690ff1bb73).(p) && isNPcxx . . $ InAx/isNP(e710061aa085e772).(getConceptcxx . . $ InAx/getConcept(9b2c8167507be48a).(p->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).()),KB); }
79 /// @return true iff P is a positive primitive CN
80 inline bool isPosPCcxx . . $ InAx/isPosPC(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p )
81 { return isPosCNcxx . . $ InAx/isPosCN(937bda690ff1bb73).(p) && getConceptcxx . . $ InAx/getConcept(9b2c8167507be48a).(p->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).())->isPrimitivecxx . . $ TConcept#isPrimitive(50ce9a9e25b4a850).(); }
82 /// @return true iff P is a negative concept name
83 inline bool isNegCNcxx . . $ InAx/isNegCN(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p ) { return isNamecxx . . $ isName(937bda690ff1bb73).(p); }
84 /// @return true iff P is a negative non-primitive CN
85 inline bool isNegNPcxx . . $ InAx/isNegNP(136d7af063eca941). ( const DLTreecxx . . $ DLTree#* p, TBoxcxx . . $ TBox#& KB )
86 { return isNegCNcxx . . $ InAx/isNegCN(937bda690ff1bb73).(p) && isNPcxx . . $ InAx/isNP(e710061aa085e772).(getConceptcxx . . $ InAx/getConcept(23efbc37c948274b).(p),KB); }
87 /// @return true iff P is a negative primitive CN
88 inline bool isNegPCcxx . . $ InAx/isNegPC(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p )
89 { return isNegCNcxx . . $ InAx/isNegCN(937bda690ff1bb73).(p) && getConceptcxx . . $ InAx/getConcept(23efbc37c948274b).(p)->isPrimitivecxx . . $ TConcept#isPrimitive(50ce9a9e25b4a850).(); }
90 /// @return true iff P is an AND expression
91 inline bool isAndcxx . . $ InAx/isAnd(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p ) { return p->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).() ==cxx . . $ TLexeme#`operator==`(b418e6031985303a). NOTcxx . . $ NOT. && p->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).()->Elementcxx . . $ TsTTree#Element(19b2b6f17af048b).() ==cxx . . $ TLexeme#`operator==`(b418e6031985303a). ANDcxx . . $ AND.; }
92 /// @return true iff P is an OR expression
93 inline bool isOrcxx . . $ InAx/isOr(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p ) { return p->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).() ==cxx . . $ TLexeme#`operator==`(b418e6031985303a). ANDcxx . . $ AND.; }
94 /// @return true iff P is a general FORALL expression
95 inline bool isForallcxx . . $ InAx/isForall(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p ) { return p->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).() ==cxx . . $ TLexeme#`operator==`(b418e6031985303a). NOTcxx . . $ NOT. && p->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).()->Elementcxx . . $ TsTTree#Element(19b2b6f17af048b).() ==cxx . . $ TLexeme#`operator==`(b418e6031985303a). FORALLcxx . . $ FORALL.; }
96 /// @return true iff P is an object FORALL expression
97 inline bool isOForallcxx . . $ InAx/isOForall(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p ) { return isForallcxx . . $ InAx/isForall(937bda690ff1bb73).(p) && !resolveRolecxx . . $ resolveRole(c256d257f6e22050).(p->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).()->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).())->isDataRolecxx . . $ TRole#isDataRole(50ce9a9e25b4a850).(); }
98 /// @return true iff P is a FORALL expression suitable for absorption
99 inline bool isAbsForallcxx . . $ InAx/isAbsForall(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p )
100 {
101 if ( !isOForallcxx . . $ InAx/isOForall(937bda690ff1bb73).(p) )
102 return false;
103 const DLTreecxx . . $ DLTree#* C = p->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).()->Rightcxx . . $ TsTTree#Right(f4b2f47551fb31d7).();
104 if ( isTopcxx . . $ InAx/isTop(937bda690ff1bb73).(C) ) // no sense to replace \AR.BOTTOM as it well lead to the same GCI
105 return false;
106 return !isNamecxx . . $ isName(937bda690ff1bb73).(C) || !getConceptcxx . . $ InAx/getConcept(23efbc37c948274b).(C)->isSystemcxx . . $ TNamedEntry#isSystem(50ce9a9e25b4a850).();
107 }
108 /// @return true iff P is a FORALL expression suitable for absorption with name at the end
109 inline bool isSimpleForallcxx . . $ InAx/isSimpleForall(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* p )
110 {
111 if ( !isAbsForallcxx . . $ InAx/isAbsForall(937bda690ff1bb73).(p) )
112 return false;
113 const DLTreecxx . . $ DLTree#* C = p->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).()->Rightcxx . . $ TsTTree#Right(f4b2f47551fb31d7).();
114 // forall is simple if its filler is a name of a primitive concept
115 return isNamecxx . . $ isName(937bda690ff1bb73).(C) && (getConceptcxx . . $ InAx/getConcept(23efbc37c948274b).(C)->Descriptioncxx . . $ TConcept#Description. == nullptr);
116 }
117 } // InAx
118
119 class TAxiomcxx . . $ TAxiom#
120 {
121 protected: // types
122 /// type for axiom's representation, suitable for absorption
123 typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<DLTreecxx . . $ DLTree#*> absorptionSetcxx . . $ TAxiom#absorptionSet#;
124 /// RW iterator for the elements of GCI
125 typedef absorptionSetcxx . . $ TAxiom#absorptionSet#::iteratorcxx . . $ std/vector#iterator# iteratorcxx . . $ TAxiom#iterator#;
126 /// RO iterator for the elements of GCI
127 typedef absorptionSetcxx . . $ TAxiom#absorptionSet#::const_iteratorcxx . . $ std/vector#const_iterator# const_iteratorcxx . . $ TAxiom#const_iterator#;
128 /// set of iterators to work with
129 typedef absorptionSetcxx . . $ TAxiom#absorptionSet# WorkSetcxx . . $ TAxiom#WorkSet#;
130
131 protected: // members
132 /// GCI is presented in the form (or Disjuncts);
133 absorptionSetcxx . . $ TAxiom#absorptionSet# Disjunctscxx . . $ TAxiom#Disjuncts.;
134 /// the origin of an axiom if obtained during processing
135 const TAxiomcxx . . $ TAxiom#* origincxx . . $ TAxiom#origin.;
136
137 protected: // methods
138 // access to labels
139
140 /// RW begin
141 iteratorcxx . . $ TAxiom#iterator# begincxx . . $ TAxiom#begin(75c7e1d24662ebd7). ( void ) { return Disjunctscxx . . $ TAxiom#Disjuncts..begincxx . . $ std/vector#begin(33b10a496a38335b).(); }
142 /// RW end
143 iteratorcxx . . $ TAxiom#iterator# endcxx . . $ TAxiom#end(75c7e1d24662ebd7). ( void ) { return Disjunctscxx . . $ TAxiom#Disjuncts..endcxx . . $ std/vector#end(33b10a496a38335b).(); }
144 /// RO begin
145 const_iteratorcxx . . $ TAxiom#const_iterator# begincxx . . $ TAxiom#begin(b26ece992c1b4aec). ( void ) const { return Disjunctscxx . . $ TAxiom#Disjuncts..begincxx . . $ std/vector#begin(359ca5030082c9f).(); }
146 /// RO end
147 const_iteratorcxx . . $ TAxiom#const_iterator# endcxx . . $ TAxiom#end(b26ece992c1b4aec). ( void ) const { return Disjunctscxx . . $ TAxiom#Disjuncts..endcxx . . $ std/vector#end(359ca5030082c9f).(); }
148
149 /// create a copy of a given GCI; ignore SKIP entry
150 TAxiomcxx . . $ TAxiom#* copycxx . . $ TAxiom#copy(f473873b85966b34). ( const DLTreecxx . . $ DLTree#* skip ) const
151 {
152 TAxiomcxx . . $ TAxiom#* ret = new TAxiomcxx . . $ TAxiom#TAxiom(be473cbdb9a4c326).(this);
153 for ( const auto& C: Disjunctscxx . . $ TAxiom#Disjuncts. )
154 if ( C != skip )
155 ret->Disjunctscxx . . $ TAxiom#Disjuncts..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(clonecxx . . $ clone(ec41a33c52a5614b).(C));
156 return ret;
157 }
158
159 // single disjunct's optimisations
160
161 /// simplify (OR C ...) for a non-primitive C in a given position
162 TAxiomcxx . . $ TAxiom#* simplifyPosNPcxx . . $ TAxiom#simplifyPosNP(f473873b85966b34). ( const DLTreecxx . . $ DLTree#* rep ) const
163 {
164 Statcxx . . $ Stat/::SAbsRepCNcxx . . $ Stat/SAbsRepCN#();
165 TAxiomcxx . . $ TAxiom#* ret = copycxx . . $ TAxiom#copy(f473873b85966b34).(rep);
166 ret->addcxx . . $ TAxiom#add(edf821a2fc5509f9).(createSNFNotcxx . . $ createSNFNot(1bf715d485c1268).(clonecxx . . $ clone(ec41a33c52a5614b).(InAxcxx . . $ InAx/::getConceptcxx . . $ InAx/getConcept(9b2c8167507be48a).(rep->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).())->Descriptioncxx . . $ TConcept#Description.)));
167 # ifdef RKG_DEBUG_ABSORPTION
168 std::cout << " simplify CN expression for" << rep->Left();
169 # endif
170 return ret;
171 }
172 /// simplify (OR ~C ...) for a non-primitive C in a given position
173 TAxiomcxx . . $ TAxiom#* simplifyNegNPcxx . . $ TAxiom#simplifyNegNP(f473873b85966b34). ( const DLTreecxx . . $ DLTree#* rep ) const
174 {
175 Statcxx . . $ Stat/::SAbsRepCNcxx . . $ Stat/SAbsRepCN#();
176 TAxiomcxx . . $ TAxiom#* ret = copycxx . . $ TAxiom#copy(f473873b85966b34).(rep);
177 ret->addcxx . . $ TAxiom#add(edf821a2fc5509f9).(clonecxx . . $ clone(ec41a33c52a5614b).(InAxcxx . . $ InAx/::getConceptcxx . . $ InAx/getConcept(23efbc37c948274b).(rep)->Descriptioncxx . . $ TConcept#Description.));
178 # ifdef RKG_DEBUG_ABSORPTION
179 std::cout << " simplify ~CN expression for" << rep;
180 # endif
181 return ret;
182 }
183 /// simplify (OR (SOME R C) ...)) in a given position
184 TAxiomcxx . . $ TAxiom#* simplifyForallcxx . . $ TAxiom#simplifyForall(ec547cdc3aed66c). ( const DLTreecxx . . $ DLTree#* rep, TBoxcxx . . $ TBox#& KB ) const;
185 /// split (OR (AND...) ...) in a given position
186 void splitcxx . . $ TAxiom#split(ba9ebff5236cfe61). ( stdcxx . . $ std/::vectorcxx . . $ std/vector#<TAxiomcxx . . $ TAxiom#*>& acc, const DLTreecxx . . $ DLTree#* rep, DLTreecxx . . $ DLTree#* pAnd ) const
187 {
188 if ( pAnd->Elementcxx . . $ TsTTree#Element(19b2b6f17af048b).().getTokencxx . . $ TLexeme#getToken(d71a1020745f3953).() == ANDcxx . . $ AND. )
189 { // split the AND
190 splitcxx . . $ TAxiom#split(ba9ebff5236cfe61). ( acc, rep, pAnd->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).() );
191 splitcxx . . $ TAxiom#split(ba9ebff5236cfe61). ( acc, rep, pAnd->Rightcxx . . $ TsTTree#Right(f4b2f47551fb31d7).() );
192 }
193 else
194 {
195 TAxiomcxx . . $ TAxiom#* ret = copycxx . . $ TAxiom#copy(f473873b85966b34).(rep);
196 ret->addcxx . . $ TAxiom#add(edf821a2fc5509f9).(createSNFNotcxx . . $ createSNFNot(1bf715d485c1268).(clonecxx . . $ clone(ec41a33c52a5614b).(pAnd)));
197 acc.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(ret);
198 }
199 }
200 /// create a concept expression corresponding to a given GCI; ignore SKIP entry
201 DLTreecxx . . $ DLTree#* createAnAxiomcxx . . $ TAxiom#createAnAxiom(8f188fbd9d5632d6). ( const DLTreecxx . . $ DLTree#* skip ) const;
202
203 public: // interface
204 /// create an empty GCI
205 explicit TAxiomcxx . . $ TAxiom#TAxiom(be473cbdb9a4c326). ( const TAxiomcxx . . $ TAxiom#* parent ) : origincxx . . $ TAxiom#origin.(parent) {}
206 /// copy c'tor
207 TAxiomcxx . . $ TAxiom#TAxiom(c5498a844a512ebb). ( const TAxiomcxx . . $ TAxiom#& ) = delete;
208 /// assignment
209 TAxiomcxx . . $ TAxiom#& operatorcxx . . $ TAxiom#`operator=`(435850f922dcad6a). = ( const TAxiomcxx . . $ TAxiom#& ) = delete;
210 /// d'tor: delete elements if AX is not in use
211 ~cxx . . $ TAxiom#`~TAxiom`(49f6e7a06ebc5aa8).TAxiomcxx . . $ TAxiom#()
212 {
213 for ( auto& p: Disjunctscxx . . $ TAxiom#Disjuncts. )
214 deleteTreecxx . . $ deleteTree(c5beffd064a5e5b2).(p);
215 }
216
217 /// add DLTree to an axiom
218 void addcxx . . $ TAxiom#add(edf821a2fc5509f9). ( DLTreecxx . . $ DLTree#* p );
219 /// check whether 2 axioms are the same
220 bool operatorcxx . . $ TAxiom#`operator==`(4685c79be7b49da1). == ( const TAxiomcxx . . $ TAxiom#& ax ) const
221 {
222 if ( Disjunctscxx . . $ TAxiom#Disjuncts..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() != ax.Disjunctscxx . . $ TAxiom#Disjuncts..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() )
223 return false;
224 auto p = begincxx . . $ TAxiom#begin(b26ece992c1b4aec).(), q = ax.begincxx . . $ TAxiom#begin(b26ece992c1b4aec).(), p_end = endcxx . . $ TAxiom#end(b26ece992c1b4aec).();
225 for ( ; p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p, ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).q )
226 if ( !equalTreescxx . . $ equalTrees(d3c03bdc42525896).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p,*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q) )
227 return false;
228 return true;
229 }
230
231 /// replace a defined concept with its description
232 TAxiomcxx . . $ TAxiom#* simplifyCNcxx . . $ TAxiom#simplifyCN(78ec7736a2556433). ( TBoxcxx . . $ TBox#& KB ) const;
233 /// replace a universal restriction with a fresh concept
234 TAxiomcxx . . $ TAxiom#* simplifyForallcxx . . $ TAxiom#simplifyForall(78ec7736a2556433). ( TBoxcxx . . $ TBox#& KB ) const;
235 /// replace a simple universal restriction with a fresh concept
236 TAxiomcxx . . $ TAxiom#* simplifySForallcxx . . $ TAxiom#simplifySForall(78ec7736a2556433). ( TBoxcxx . . $ TBox#& KB ) const;
237 /// split an axiom; @return new axiom and/or NULL
238 bool splitcxx . . $ TAxiom#split(dd394394fea2dda9). ( stdcxx . . $ std/::vectorcxx . . $ std/vector#<TAxiomcxx . . $ TAxiom#*>& acc ) const
239 {
240 acc.clearcxx . . $ std/vector#clear(49f6e7a06ebc5aa8).();
241 for ( const auto& C: Disjunctscxx . . $ TAxiom#Disjuncts. )
242 if ( InAxcxx . . $ InAx/::isAndcxx . . $ InAx/isAnd(937bda690ff1bb73).(C) )
243 {
244 Statcxx . . $ Stat/::SAbsSplitcxx . . $ Stat/SAbsSplit#();
245 # ifdef RKG_DEBUG_ABSORPTION
246 std::cout << " split AND expression" << C->Left();
247 # endif
248 splitcxx . . $ TAxiom#split(ba9ebff5236cfe61). ( acc, C, C->Leftcxx . . $ TsTTree#Left(f4b2f47551fb31d7).() );
249 // no need to split more than once:
250 // every extra splits would be together with unsplitted parts
251 // like: (A or B) and (C or D) would be transform into
252 // A and (C or D), B and (C or D), (A or B) and C, (A or B) and D
253 // so just return here
254 return true;
255 }
256
257 return false;
258 }
259 /// @return true iff an axiom is the same as one of its ancestors
260 bool isCycliccxx . . $ TAxiom#isCyclic(50ce9a9e25b4a850). ( void ) const
261 {
262 for ( auto p = origincxx . . $ TAxiom#origin.; p; p = p->origincxx . . $ TAxiom#origin. )
263 if ( *p ==cxx . . $ TAxiom#`operator==`(4685c79be7b49da1). *this )
264 {
265 # ifdef RKG_DEBUG_ABSORPTION
266 std::cout << " same as ancestor";
267 # endif
268 return true;
269 }
270 return false;
271 }
272 /// absorb into BOTTOM; @return true if absorption is performed
273 bool absorbIntoBottomcxx . . $ TAxiom#absorbIntoBottom(50ce9a9e25b4a850). ( void ) const;
274 /// absorb into TOP; @return true if absorption is performed
275 bool absorbIntoTopcxx . . $ TAxiom#absorbIntoTop(7e0306efbd9b1d86). ( TBoxcxx . . $ TBox#& KB ) const;
276 /// absorb into concept; @return true if absorption is performed
277 bool absorbIntoConceptcxx . . $ TAxiom#absorbIntoConcept(7e0306efbd9b1d86). ( TBoxcxx . . $ TBox#& KB ) const;
278 /// absorb into negation of a concept; @return true if absorption is performed
279 bool absorbIntoNegConceptcxx . . $ TAxiom#absorbIntoNegConcept(7e0306efbd9b1d86). ( TBoxcxx . . $ TBox#& KB ) const;
280 /// absorb into role domain; @return true if absorption is performed
281 bool absorbIntoDomaincxx . . $ TAxiom#absorbIntoDomain(50ce9a9e25b4a850). ( void ) const;
282 /// create a concept expression corresponding to a given GCI
283 DLTreecxx . . $ DLTree#* createAnAxiomcxx . . $ TAxiom#createAnAxiom(7ba0ba2d2b26f6a8). ( void ) const { return createAnAxiomcxx . . $ TAxiom#createAnAxiom(8f188fbd9d5632d6).(nullptr); }
284
285 #ifdef RKG_DEBUG_ABSORPTION
286 /// dump GCI for debug purposes
287 void dump ( std::ostream& o ) const;
288 #endif
289 }; // TAxiom;
290
291 #endif