| 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 DLCONCEPTTAXONOMY_H |
| 21 | #define DLCONCEPTTAXONOMY_Hcxx . . $ `Kernel/DLConceptTaxonomy.h:21:9`! |
| 22 | |
| 23 | #include "TaxonomyCreator.h"cxx . . $ `<file>/Kernel/TaxonomyCreator.h`/ |
| 24 | #include "dlTBox.h"cxx . . $ `<file>/Kernel/dlTBox.h`/ |
| 25 | #include "tProgressMonitor.h"cxx . . $ `<file>/Kernel/tProgressMonitor.h`/ |
| 26 | |
| 27 | /// Taxonomy of named DL concepts (and mapped individuals) |
| 28 | class DLConceptTaxonomycxx . . $ DLConceptTaxonomy#: public TaxonomyCreatorcxx . . $ TaxonomyCreator# |
| 29 | { |
| 30 | protected: // types |
| 31 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<TaxonomyVertexcxx . . $ TaxonomyVertex#*> TaxVertexVeccxx . . $ DLConceptTaxonomy#TaxVertexVec#; |
| 32 | /// all the derived subsumers of a class (came from the model) |
| 33 | class DerivedSubsumerscxx . . $ DLConceptTaxonomy#DerivedSubsumers#: public KnownSubsumerscxx . . $ TaxonomyCreator#KnownSubsumers# |
| 34 | { |
| 35 | protected: // typedefs |
| 36 | /// set of the subsumers |
| 37 | typedef TaxonomyCreatorcxx . . $ TaxonomyCreator#::SubsumerSetcxx . . $ TaxonomyCreator#SubsumerSet# SubsumerSetcxx . . $ DLConceptTaxonomy#DerivedSubsumers#SubsumerSet#; |
| 38 | /// SS RW iterator |
| 39 | typedef SubsumerSetcxx . . $ DLConceptTaxonomy#DerivedSubsumers#SubsumerSet#::iteratorcxx . . $ std/vector#iterator# ss_iteratorcxx . . $ DLConceptTaxonomy#DerivedSubsumers#ss_iterator#; |
| 40 | |
| 41 | protected: // members |
| 42 | /// set of sure- and possible subsumers |
| 43 | SubsumerSetcxx . . $ DLConceptTaxonomy#DerivedSubsumers#SubsumerSet# Surecxx . . $ DLConceptTaxonomy#DerivedSubsumers#Sure., Possiblecxx . . $ DLConceptTaxonomy#DerivedSubsumers#Possible.; |
| 44 | |
| 45 | public: // interface |
| 46 | /// c'tor: copy given sets |
| 47 | DerivedSubsumerscxx . . $ DLConceptTaxonomy#DerivedSubsumers#DerivedSubsumers(48b040e49c1f4f4d). ( const SubsumerSetcxx . . $ DLConceptTaxonomy#DerivedSubsumers#SubsumerSet#& sure, const SubsumerSetcxx . . $ DLConceptTaxonomy#DerivedSubsumers#SubsumerSet#& possible ) |
| 48 | : KnownSubsumerscxx . . $ TaxonomyCreator#KnownSubsumers#() |
| 49 | , Surecxx . . $ DLConceptTaxonomy#DerivedSubsumers#Sure.(sure) |
| 50 | , Possiblecxx . . $ std/vector#vector(a1201200cf0efa42).(possible) |
| 51 | {} |
| 52 | |
| 53 | // iterators |
| 54 | |
| 55 | /// begin of the Sure subsumers interval |
| 56 | ss_iteratorcxx . . $ DLConceptTaxonomy#DerivedSubsumers#ss_iterator# s_begincxx . . $ DLConceptTaxonomy#DerivedSubsumers#s_begin(eb69919d41dfeca3). ( void ) override { return Surecxx . . $ DLConceptTaxonomy#DerivedSubsumers#Sure..begincxx . . $ std/vector#begin(33b10a496a38335b).(); } |
| 57 | /// end of the Sure subsumers interval |
| 58 | ss_iteratorcxx . . $ DLConceptTaxonomy#DerivedSubsumers#ss_iterator# s_endcxx . . $ DLConceptTaxonomy#DerivedSubsumers#s_end(eb69919d41dfeca3). ( void ) override { return Surecxx . . $ DLConceptTaxonomy#DerivedSubsumers#Sure..endcxx . . $ std/vector#end(33b10a496a38335b).(); } |
| 59 | /// begin of the Possible subsumers interval |
| 60 | ss_iteratorcxx . . $ DLConceptTaxonomy#DerivedSubsumers#ss_iterator# p_begincxx . . $ DLConceptTaxonomy#DerivedSubsumers#p_begin(eb69919d41dfeca3). ( void ) override { return Possiblecxx . . $ DLConceptTaxonomy#DerivedSubsumers#Possible..begincxx . . $ std/vector#begin(33b10a496a38335b).(); } |
| 61 | /// end of the Possible subsumers interval |
| 62 | ss_iteratorcxx . . $ DLConceptTaxonomy#DerivedSubsumers#ss_iterator# p_endcxx . . $ DLConceptTaxonomy#DerivedSubsumers#p_end(eb69919d41dfeca3). ( void ) override { return Possiblecxx . . $ DLConceptTaxonomy#DerivedSubsumers#Possible..endcxx . . $ std/vector#end(33b10a496a38335b).(); } |
| 63 | }; // DerivedSubsumers |
| 64 | |
| 65 | protected: // members |
| 66 | /// host tBox |
| 67 | TBoxcxx . . $ TBox#& tBoxcxx . . $ DLConceptTaxonomy#tBox.; |
| 68 | /// incremental sets M+ and M- |
| 69 | stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*> MPluscxx . . $ DLConceptTaxonomy#MPlus., MMinuscxx . . $ DLConceptTaxonomy#MMinus.; |
| 70 | /// set of possible parents |
| 71 | stdcxx . . $ std/::setcxx . . $ std/set#<TaxonomyVertexcxx . . $ TaxonomyVertex#*> candidatescxx . . $ DLConceptTaxonomy#candidates.; |
| 72 | /// whether look into it |
| 73 | bool useCandidatescxx . . $ DLConceptTaxonomy#useCandidates. = false; |
| 74 | /// common descendants of all parents of currently classified concept |
| 75 | TaxVertexVeccxx . . $ DLConceptTaxonomy#TaxVertexVec# Commoncxx . . $ DLConceptTaxonomy#Common.; |
| 76 | /// number of processed common parents |
| 77 | unsigned int nCommoncxx . . $ DLConceptTaxonomy#nCommon. = 0; |
| 78 | |
| 79 | // statistic counters |
| 80 | unsigned long nConceptscxx . . $ DLConceptTaxonomy#nConcepts. = 0; |
| 81 | unsigned long nTriescxx . . $ DLConceptTaxonomy#nTries. = 0; |
| 82 | unsigned long nPositivescxx . . $ DLConceptTaxonomy#nPositives. = 0; |
| 83 | unsigned long nNegativescxx . . $ DLConceptTaxonomy#nNegatives. = 0; |
| 84 | unsigned long nSearchCallscxx . . $ DLConceptTaxonomy#nSearchCalls. = 0; |
| 85 | unsigned long nSubCallscxx . . $ DLConceptTaxonomy#nSubCalls. = 0; |
| 86 | unsigned long nNonTrivialSubCallscxx . . $ DLConceptTaxonomy#nNonTrivialSubCalls. = 0; |
| 87 | |
| 88 | /// number of positive cached subsumptions |
| 89 | unsigned long nCachedPositivecxx . . $ DLConceptTaxonomy#nCachedPositive. = 0; |
| 90 | /// number of negative cached subsumptions |
| 91 | unsigned long nCachedNegativecxx . . $ DLConceptTaxonomy#nCachedNegative. = 0; |
| 92 | /// number of non-subsumptions detected by a sorted reasoning |
| 93 | unsigned long nSortedNegativecxx . . $ DLConceptTaxonomy#nSortedNegative. = 0; |
| 94 | /// number of non-subsumptions because of module reasons |
| 95 | unsigned long nModuleNegativecxx . . $ DLConceptTaxonomy#nModuleNegative. = 0; |
| 96 | |
| 97 | /// indicator of taxonomy creation progress |
| 98 | TProgressMonitorcxx . . $ TProgressMonitor#* pTaxProgresscxx . . $ DLConceptTaxonomy#pTaxProgress. = nullptr; |
| 99 | |
| 100 | // flags |
| 101 | |
| 102 | /// flag to use Bottom-Up search |
| 103 | bool flagNeedBottomUpcxx . . $ DLConceptTaxonomy#flagNeedBottomUp. = false; |
| 104 | |
| 105 | protected: // methods |
| 106 | //----------------------------------------------------------------- |
| 107 | //-- General support for DL concept classification |
| 108 | //----------------------------------------------------------------- |
| 109 | |
| 110 | /// get access to curEntry as a TConcept |
| 111 | const TConceptcxx . . $ TConcept#* curConceptcxx . . $ DLConceptTaxonomy#curConcept(7f9327d86ab44b18). ( void ) const { return static_cast<const TConceptcxx . . $ TConcept#*>(curEntrycxx . . $ TaxonomyCreator#curEntry.); } |
| 112 | /// tests subsumption (via tBox) and gather statistics. Use cache and other optimisations. |
| 113 | bool testSubcxx . . $ DLConceptTaxonomy#testSub(7e9f35c32394b4f5). ( const TConceptcxx . . $ TConcept#* p, const TConceptcxx . . $ TConcept#* q ); |
| 114 | /// test subsumption via TBox explicitly |
| 115 | bool testSubTBoxcxx . . $ DLConceptTaxonomy#testSubTBox(7e9f35c32394b4f5). ( const TConceptcxx . . $ TConcept#* p, const TConceptcxx . . $ TConcept#* q ) |
| 116 | { |
| 117 | bool res = tBoxcxx . . $ DLConceptTaxonomy#tBox..isSubHoldscxx . . $ TBox#isSubHolds(7e9f35c32394b4f5). ( p, q ); |
| 118 | |
| 119 | // update statistic |
| 120 | ++nTriescxx . . $ DLConceptTaxonomy#nTries.; |
| 121 | |
| 122 | if ( res ) |
| 123 | ++nPositivescxx . . $ DLConceptTaxonomy#nPositives.; |
| 124 | else |
| 125 | ++nNegativescxx . . $ DLConceptTaxonomy#nNegatives.; |
| 126 | |
| 127 | return res; |
| 128 | } |
| 129 | |
| 130 | // interface from BAADER paper |
| 131 | |
| 132 | /// SEARCH procedure from Baader et al paper |
| 133 | void searchBaadercxx . . $ DLConceptTaxonomy#searchBaader(ea5ea6ad7488bb8a). ( TaxonomyVertexcxx . . $ TaxonomyVertex#* cur ); |
| 134 | /// ENHANCED_SUBS procedure from Baader et al paper |
| 135 | bool enhancedSubs1cxx . . $ DLConceptTaxonomy#enhancedSubs1(50effb95a029e9ba). ( TaxonomyVertexcxx . . $ TaxonomyVertex#* cur ); |
| 136 | /// short-cut from ENHANCED_SUBS |
| 137 | bool enhancedSubs2cxx . . $ DLConceptTaxonomy#enhancedSubs2(50effb95a029e9ba). ( TaxonomyVertexcxx . . $ TaxonomyVertex#* cur ) |
| 138 | { |
| 139 | // if bottom-up search and CUR is not a successor of checking entity -- return false |
| 140 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(upDirection && !cur->isCommon()) ) |
| 141 | return false; |
| 142 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`! ( useCandidates && candidates.find(cur) == candidates.end() ) ) |
| 143 | return false; |
| 144 | return enhancedSubs1cxx . . $ DLConceptTaxonomy#enhancedSubs1(50effb95a029e9ba).(cur); |
| 145 | } |
| 146 | // wrapper for the ENHANCED_SUBS |
| 147 | inline bool enhancedSubscxx . . $ DLConceptTaxonomy#enhancedSubs(50effb95a029e9ba). ( TaxonomyVertexcxx . . $ TaxonomyVertex#* cur ) |
| 148 | { |
| 149 | ++nSubCallscxx . . $ DLConceptTaxonomy#nSubCalls.; |
| 150 | |
| 151 | if ( isValuedcxx . . $ TaxonomyCreator#isValued(5273acd5b7b596a5).(cur) ) |
| 152 | return getValuecxx . . $ TaxonomyCreator#getValue(5273acd5b7b596a5).(cur); |
| 153 | else |
| 154 | return setValuecxx . . $ TaxonomyCreator#setValue(2266beb367975663). ( cur, enhancedSubs2cxx . . $ DLConceptTaxonomy#enhancedSubs2(50effb95a029e9ba).(cur) ); |
| 155 | } |
| 156 | /// explicitly test appropriate subsumption relation |
| 157 | bool testSubsumptioncxx . . $ DLConceptTaxonomy#testSubsumption(50effb95a029e9ba). ( TaxonomyVertexcxx . . $ TaxonomyVertex#* cur ); |
| 158 | /// test whether a node could be a super-node of CUR |
| 159 | bool possibleSubcxx . . $ DLConceptTaxonomy#possibleSub(5273acd5b7b596a5). ( TaxonomyVertexcxx . . $ TaxonomyVertex#* v ) const |
| 160 | { |
| 161 | const TConceptcxx . . $ TConcept#* C = static_cast<const TConceptcxx . . $ TConcept#*>(v->getPrimercxx . . $ TaxonomyVertex#getPrimer(257357278432d96a).()); |
| 162 | // non-prim concepts are candidates |
| 163 | if ( !C->isPrimitivecxx . . $ TConcept#isPrimitive(50ce9a9e25b4a850).() ) |
| 164 | return true; |
| 165 | // all others should be in the possible sups list |
| 166 | return ksStackcxx . . $ TaxonomyCreator#ksStack..topcxx . . $ SearchableStack#top(535908e0c00a99ac).()->isPossibleSubcxx . . $ TaxonomyCreator#KnownSubsumers#isPossibleSub(c2bbfa133def1eb7).(C); |
| 167 | } |
| 168 | /// @return true if non-subsumption is due to ENTITY is not in the \bot-module |
| 169 | bool isNotInModulecxx . . $ DLConceptTaxonomy#isNotInModule(d552066cd41c9e94). ( const TNamedEntitycxx . . $ TNamedEntity#* entity ) const; |
| 170 | /// reclassify node |
| 171 | void reclassifycxx . . $ DLConceptTaxonomy#reclassify(95820de7043730ba). ( TaxonomyVertexcxx . . $ TaxonomyVertex#* node, const TSignaturecxx . . $ TSignature#* s ); |
| 172 | |
| 173 | /// propagate common value from NODE to all its descendants; save visited nodes |
| 174 | void propagateOneCommoncxx . . $ DLConceptTaxonomy#propagateOneCommon(ea5ea6ad7488bb8a). ( TaxonomyVertexcxx . . $ TaxonomyVertex#* node ); |
| 175 | /// mark as COMMON all vertexes that are sub-concepts of every parent of CURRENT |
| 176 | bool propagateUpcxx . . $ DLConceptTaxonomy#propagateUp(c9857a73d68e59ba). ( void ); |
| 177 | /// clear all COMMON information |
| 178 | void clearCommoncxx . . $ DLConceptTaxonomy#clearCommon(49f6e7a06ebc5aa8). ( void ) |
| 179 | { |
| 180 | for ( TaxVertexVeccxx . . $ DLConceptTaxonomy#TaxVertexVec#::iteratorcxx . . $ std/vector#iterator# p = Commoncxx . . $ DLConceptTaxonomy#Common..begincxx . . $ std/vector#begin(33b10a496a38335b).(), p_end = Commoncxx . . $ DLConceptTaxonomy#Common..endcxx . . $ std/vector#end(33b10a496a38335b).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 181 | (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p)->clearCommoncxx . . $ TaxonomyVertex#clearCommon(49f6e7a06ebc5aa8).(); |
| 182 | Commoncxx . . $ DLConceptTaxonomy#Common..clearcxx . . $ std/vector#clear(49f6e7a06ebc5aa8).(); |
| 183 | } |
| 184 | /// check if concept is unsat; add it as a synonym of BOTTOM if necessary |
| 185 | bool isUnsatisfiablecxx . . $ DLConceptTaxonomy#isUnsatisfiable(c9857a73d68e59ba). ( void ); |
| 186 | /// fill candidates |
| 187 | void fillCandidatescxx . . $ DLConceptTaxonomy#fillCandidates(ea5ea6ad7488bb8a). ( TaxonomyVertexcxx . . $ TaxonomyVertex#* cur ); |
| 188 | |
| 189 | //----------------------------------------------------------------- |
| 190 | //-- Tunable methods (depending on taxonomy type) |
| 191 | //----------------------------------------------------------------- |
| 192 | |
| 193 | /// prepare told subsumers for given entry if necessary |
| 194 | KnownSubsumerscxx . . $ TaxonomyCreator#KnownSubsumers#* buildKnownSubsumerscxx . . $ DLConceptTaxonomy#buildKnownSubsumers(29a29a73a651901d). ( ClassifiableEntrycxx . . $ ClassifiableEntry#* p ) override; |
| 195 | /// prepare signature for given entry |
| 196 | const TSignaturecxx . . $ TSignature#* buildSignaturecxx . . $ DLConceptTaxonomy#buildSignature(883ea8d29581efad). ( ClassifiableEntrycxx . . $ ClassifiableEntry#* p ) override; |
| 197 | /// check if no classification needed (synonym, orphan, unsatisfiable) |
| 198 | bool immediatelyClassifiedcxx . . $ DLConceptTaxonomy#immediatelyClassified(c9857a73d68e59ba). ( void ) override; |
| 199 | /// check if no BU classification is required as C=TOP |
| 200 | bool isEqualToTopcxx . . $ DLConceptTaxonomy#isEqualToTop(c9857a73d68e59ba). ( void ); |
| 201 | |
| 202 | /// check if it is possible to skip TD phase |
| 203 | bool needTopDowncxx . . $ DLConceptTaxonomy#needTopDown(50ce9a9e25b4a850). ( void ) const override |
| 204 | { return !(useCompletelyDefinedcxx . . $ TaxonomyCreator#useCompletelyDefined. && curEntrycxx . . $ TaxonomyCreator#curEntry.->isCompletelyDefinedcxx . . $ ClassifiableEntry#isCompletelyDefined(50ce9a9e25b4a850). ()); } |
| 205 | /// explicitly run TD phase |
| 206 | void runTopDowncxx . . $ DLConceptTaxonomy#runTopDown(49f6e7a06ebc5aa8). ( void ) override { searchBaadercxx . . $ DLConceptTaxonomy#searchBaader(ea5ea6ad7488bb8a).(pTaxcxx . . $ TaxonomyCreator#pTax.->getTopVertexcxx . . $ Taxonomy#getTopVertex(16f9ca5fa66f7d36).()); } |
| 207 | /// check if it is possible to skip BU phase |
| 208 | bool needBottomUpcxx . . $ DLConceptTaxonomy#needBottomUp(50ce9a9e25b4a850). ( void ) const override |
| 209 | { |
| 210 | // we DON'T need bottom-up phase for primitive concepts during CD-like reasoning |
| 211 | // if no GCIs are in the TBox (C [= T, T [= X or Y, X [= D, Y [= D) or (T [= {o}) |
| 212 | // or no reflexive roles w/RnD present (Refl(R), Range(R)=D) |
| 213 | return flagNeedBottomUpcxx . . $ DLConceptTaxonomy#flagNeedBottomUp. || !useCompletelyDefinedcxx . . $ TaxonomyCreator#useCompletelyDefined. || curConceptcxx . . $ DLConceptTaxonomy#curConcept(7f9327d86ab44b18).()->isNonPrimitivecxx . . $ TConcept#isNonPrimitive(50ce9a9e25b4a850).(); |
| 214 | } |
| 215 | /// explicitly run BU phase |
| 216 | void runBottomUpcxx . . $ DLConceptTaxonomy#runBottomUp(49f6e7a06ebc5aa8). ( void ) override |
| 217 | { |
| 218 | if ( propagateUpcxx . . $ DLConceptTaxonomy#propagateUp(c9857a73d68e59ba).() ) // Common is set up here |
| 219 | return; |
| 220 | if ( isEqualToTopcxx . . $ DLConceptTaxonomy#isEqualToTop(c9857a73d68e59ba).() ) // nothing to do |
| 221 | return; |
| 222 | if ( pTaxcxx . . $ TaxonomyCreator#pTax.->queryModecxx . . $ Taxonomy#queryMode(50ce9a9e25b4a850).() ) // after classification -- bottom set up already |
| 223 | searchBaadercxx . . $ DLConceptTaxonomy#searchBaader(ea5ea6ad7488bb8a).(pTaxcxx . . $ TaxonomyCreator#pTax.->getBottomVertexcxx . . $ Taxonomy#getBottomVertex(16f9ca5fa66f7d36).()); |
| 224 | else // during classification -- have to find leaf nodes |
| 225 | for ( TaxVertexVeccxx . . $ DLConceptTaxonomy#TaxVertexVec#::iteratorcxx . . $ std/vector#iterator# p = Commoncxx . . $ DLConceptTaxonomy#Common..begincxx . . $ std/vector#begin(33b10a496a38335b).(), p_end = Commoncxx . . $ DLConceptTaxonomy#Common..endcxx . . $ std/vector#end(33b10a496a38335b).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 226 | if ( (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p)->noNeighbourscxx . . $ TaxonomyVertex#noNeighbours(962fae8be55e1d9).(/*upDirection=*/false) ) |
| 227 | searchBaadercxx . . $ DLConceptTaxonomy#searchBaader(ea5ea6ad7488bb8a).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p); |
| 228 | } |
| 229 | |
| 230 | /// actions that to be done BEFORE entry will be classified |
| 231 | void preClassificationActionscxx . . $ DLConceptTaxonomy#preClassificationActions(49f6e7a06ebc5aa8). ( void ) override |
| 232 | { |
| 233 | ++nConceptscxx . . $ DLConceptTaxonomy#nConcepts.; |
| 234 | if ( pTaxProgresscxx . . $ DLConceptTaxonomy#pTaxProgress. != nullptr ) |
| 235 | pTaxProgresscxx . . $ DLConceptTaxonomy#pTaxProgress.->nextClasscxx . . $ TProgressMonitor#nextClass(49f6e7a06ebc5aa8).(); |
| 236 | } |
| 237 | /// @return true iff curEntry is classified as a synonym |
| 238 | bool classifySynonymcxx . . $ DLConceptTaxonomy#classifySynonym(c9857a73d68e59ba). ( void ) override; |
| 239 | |
| 240 | /// check if it is necessary to log taxonomy action |
| 241 | bool needLoggingcxx . . $ DLConceptTaxonomy#needLogging(50ce9a9e25b4a850). ( void ) const override { return true; } |
| 242 | |
| 243 | public: // interface |
| 244 | /// the only c'tor |
| 245 | DLConceptTaxonomycxx . . $ DLConceptTaxonomy#DLConceptTaxonomy(57849ba7a0482a8f). ( Taxonomycxx . . $ Taxonomy#* tax, TBoxcxx . . $ TBox#& kb ) |
| 246 | : TaxonomyCreatorcxx . . $ TaxonomyCreator#TaxonomyCreator(ce426daa62d7e7fd).(tax) |
| 247 | , tBoxcxx . . $ DLConceptTaxonomy#tBox.(kb) |
| 248 | {} |
| 249 | /// no copy c'tor |
| 250 | DLConceptTaxonomycxx . . $ DLConceptTaxonomy#DLConceptTaxonomy(f0ac8cd5f83bce8). ( const DLConceptTaxonomycxx . . $ DLConceptTaxonomy#& ) = delete; |
| 251 | /// no assignment |
| 252 | DLConceptTaxonomycxx . . $ DLConceptTaxonomy#& operatorcxx . . $ DLConceptTaxonomy#`operator=`(f4c81a58fe2b7a41). = ( const DLConceptTaxonomycxx . . $ DLConceptTaxonomy#& ) = delete; |
| 253 | |
| 254 | /// set bottom-up flag |
| 255 | void setBottomUpcxx . . $ DLConceptTaxonomy#setBottomUp(2dc2722f98170803). ( const TKBFlagscxx . . $ TKBFlags#& GCIs ) { flagNeedBottomUpcxx . . $ DLConceptTaxonomy#flagNeedBottomUp. = (GCIs.isGCIcxx . . $ TKBFlags#isGCI(50ce9a9e25b4a850).() || (GCIs.isReflexivecxx . . $ TKBFlags#isReflexive(50ce9a9e25b4a850).() && GCIs.isRnDcxx . . $ TKBFlags#isRnD(50ce9a9e25b4a850).())); } |
| 256 | /// reclassify taxonomy wrt changed sets |
| 257 | void reclassifycxx . . $ DLConceptTaxonomy#reclassify(75cae9a303a37910). ( const stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*>& MPlus, const stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*>& MMinus ); |
| 258 | /// set progress indicator |
| 259 | void setProgressIndicatorcxx . . $ DLConceptTaxonomy#setProgressIndicator(192f8d731e56d7e3). ( TProgressMonitorcxx . . $ TProgressMonitor#* pMon ) { pTaxProgresscxx . . $ DLConceptTaxonomy#pTaxProgress. = pMon; } |
| 260 | /// output taxonomy to a stream |
| 261 | void printcxx . . $ DLConceptTaxonomy#print(490063bd7e6d8d5d). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) const override; |
| 262 | }; // DLConceptTaxonomy |
| 263 | |
| 264 | // |
| 265 | // DLConceptTaxonomy implementation |
| 266 | // |
| 267 | |
| 268 | inline bool DLConceptTaxonomycxx . . $ DLConceptTaxonomy# :: isUnsatisfiablecxx . . $ DLConceptTaxonomy#isUnsatisfiable(c9857a73d68e59ba). ( void ) |
| 269 | { |
| 270 | const TConceptcxx . . $ TConcept#* p = curConceptcxx . . $ DLConceptTaxonomy#curConcept(7f9327d86ab44b18).(); |
| 271 | |
| 272 | if ( tBoxcxx . . $ DLConceptTaxonomy#tBox..isSatisfiablecxx . . $ TBox#isSatisfiable(15d44b555a30180e).(p) ) |
| 273 | return false; |
| 274 | |
| 275 | pTaxcxx . . $ TaxonomyCreator#pTax.->addCurrentToSynonymcxx . . $ Taxonomy#addCurrentToSynonym(ea5ea6ad7488bb8a).(pTaxcxx . . $ TaxonomyCreator#pTax.->getBottomVertexcxx . . $ Taxonomy#getBottomVertex(16f9ca5fa66f7d36).()); |
| 276 | return true; |
| 277 | } |
| 278 | |
| 279 | inline bool DLConceptTaxonomycxx . . $ DLConceptTaxonomy# :: immediatelyClassifiedcxx . . $ DLConceptTaxonomy#immediatelyClassified(c9857a73d68e59ba). ( void ) |
| 280 | { |
| 281 | if ( classifySynonymcxx . . $ DLConceptTaxonomy#classifySynonym(c9857a73d68e59ba).() ) |
| 282 | return true; |
| 283 | |
| 284 | if ( curConceptcxx . . $ DLConceptTaxonomy#curConcept(7f9327d86ab44b18).()->getClassTagcxx . . $ TConcept#getClassTag(863da13868153a34).() == cttTrueCompletelyDefinedcxx . . $ cttTrueCompletelyDefined. ) |
| 285 | return false; // true CD concepts can not be unsat |
| 286 | |
| 287 | // after SAT testing plan would be implemented |
| 288 | tBoxcxx . . $ DLConceptTaxonomy#tBox..initCachecxx . . $ TBox#initCache(6e2e6147ec169214).(const_cast<TConceptcxx . . $ TConcept#*>(curConceptcxx . . $ DLConceptTaxonomy#curConcept(7f9327d86ab44b18).())); |
| 289 | |
| 290 | return isUnsatisfiablecxx . . $ DLConceptTaxonomy#isUnsatisfiable(c9857a73d68e59ba).(); |
| 291 | } |
| 292 | |
| 293 | //----------------------------------------------------------------------------- |
| 294 | //-- implementation of taxonomy-related parts of TBox |
| 295 | //----------------------------------------------------------------------------- |
| 296 | |
| 297 | inline void |
| 298 | TBoxcxx . . $ TBox# :: initTaxonomycxx . . $ TBox#initTaxonomy(49f6e7a06ebc5aa8). ( void ) |
| 299 | { |
| 300 | pTaxcxx . . $ TBox#pTax. = new Taxonomycxx . . $ Taxonomy#Taxonomy(d190bd46de14e314). ( pTopcxx . . $ TBox#pTop., pBottomcxx . . $ TBox#pBottom. ); |
| 301 | pTaxCreatorcxx . . $ TBox#pTaxCreator. = new DLConceptTaxonomycxx . . $ DLConceptTaxonomy#DLConceptTaxonomy(57849ba7a0482a8f). ( pTaxcxx . . $ TBox#pTax., *this ); |
| 302 | } |
| 303 | |
| 304 | inline void |
| 305 | TBoxcxx . . $ TBox# :: classifyEntrycxx . . $ TBox#classifyEntry(3f0281ca3ae282d4). ( TConceptcxx . . $ TConcept#* entry ) |
| 306 | { |
| 307 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(isBlockedInd(entry)) ) |
| 308 | classifyEntrycxx . . $ TBox#classifyEntry(3f0281ca3ae282d4).(getBlockingIndcxx . . $ TBox#getBlockingInd(26bf38a14acccc37).(entry)); // make sure that the possible synonym is already classified |
| 309 | if ( !entry->isClassifiedcxx . . $ ClassifiableEntry#isClassified(50ce9a9e25b4a850).() ) |
| 310 | pTaxCreatorcxx . . $ TBox#pTaxCreator.->classifyEntrycxx . . $ TaxonomyCreator#classifyEntry(866fbb357e35bef0).(entry); |
| 311 | } |
| 312 | |
| 313 | inline void |
| 314 | TBoxcxx . . $ TBox# :: reclassifycxx . . $ TBox#reclassify(75cae9a303a37910). ( const stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*>& MPlus, const stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*>& MMinus ) |
| 315 | { |
| 316 | pTaxCreatorcxx . . $ TBox#pTaxCreator.->reclassifycxx . . $ DLConceptTaxonomy#reclassify(75cae9a303a37910). ( MPlus, MMinus ); |
| 317 | Statuscxx . . $ TBox#Status. = kbRealisedcxx . . $ kbRealised.; // FIXME!! check whether it is classified/realised |
| 318 | } |
| 319 | |
| 320 | #endif // DLCONCEPTTAXONOMY_H |