| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2013-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 | // incremental reasoning implementation |
| 21 | |
| 22 | #include "Kernel.h"cxx . . $ `<file>/Kernel/Kernel.h`/ |
| 23 | #include "OntologyBasedModularizer.h"cxx . . $ `<file>/Kernel/OntologyBasedModularizer.h`/ |
| 24 | #include "tOntologyPrinterLISP.h"cxx . . $ `<file>/Kernel/tOntologyPrinterLISP.h`/ |
| 25 | #include "procTimer.h"cxx . . $ `<file>/Kernel/procTimer.h`/ |
| 26 | #include "SaveLoadManager.h"cxx . . $ `<file>/Kernel/SaveLoadManager.h`/ // for saving/restoring ontology |
| 27 | |
| 28 | TsProcTimercxx . . $ TsProcTimer# moduleTimercxx . . $ moduleTimer., subCheckTimercxx . . $ subCheckTimer.; |
| 29 | int nModulecxx . . $ nModule. = 0; |
| 30 | |
| 31 | /// setup Name2Sig for a given name C |
| 32 | void |
| 33 | ReasoningKernelcxx . . $ ReasoningKernel# :: setupSigcxx . . $ ReasoningKernel#setupSig(97eebc1956244cf1). ( const TNamedEntitycxx . . $ TNamedEntity#* entity, const AxiomVeccxx . . $ AxiomVec#& Module ) |
| 34 | { |
| 35 | // do nothing if entity doesn't exist |
| 36 | if ( entity == nullptr ) |
| 37 | return; |
| 38 | |
| 39 | moduleTimercxx . . $ moduleTimer..Startcxx . . $ TsProcTimer#Start(49f6e7a06ebc5aa8).(); |
| 40 | // prepare a place to update |
| 41 | TSignaturecxx . . $ TSignature# sig; |
| 42 | NameSigMapcxx . . $ ReasoningKernel#NameSigMap#::iteratorcxx . . $ std/map#iterator# insert = Name2Sigcxx . . $ ReasoningKernel#Name2Sig..findcxx . . $ std/map#find(36f8d56706583706).(entity); |
| 43 | if ( insert ==cxx . . $ std/`operator==`(84f83906d8995b82). Name2Sigcxx . . $ ReasoningKernel#Name2Sig..endcxx . . $ std/map#end(fbe2f8c57595edf).() ) |
| 44 | insert =cxx . . $ std/_Rb_tree_iterator#`operator=`(6433c4871b1219a4). Name2Sigcxx . . $ ReasoningKernel#Name2Sig..insertcxx . . $ std/map#insert(92111883a3599ede).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(entity,&sig)).firstcxx . . $ std/pair#first.; |
| 45 | else |
| 46 | delete insert->cxx . . $ std/_Rb_tree_iterator#`operator->`(5a2a78a048fb49a8).secondcxx . . $ std/pair#second.; |
| 47 | |
| 48 | // calculate a module |
| 49 | sig.addcxx . . $ TSignature#add(70f9d3c046cd5911).(entity); |
| 50 | getModExtractorcxx . . $ ReasoningKernel#getModExtractor(4d297ab93f9ba51d).(SYN_LOC_STDcxx . . $ SYN_LOC_STD.)->getModulecxx . . $ OntologyBasedModularizer#getModule(957af31c21801c69).(Module,sig,M_BOTcxx . . $ M_BOT.); |
| 51 | ++nModulecxx . . $ nModule.; |
| 52 | |
| 53 | // perform update |
| 54 | insert->cxx . . $ std/_Rb_tree_iterator#`operator->`(5a2a78a048fb49a8).secondcxx . . $ std/pair#second. = new TSignaturecxx . . $ TSignature#(getModExtractorcxx . . $ ReasoningKernel#getModExtractor(4d297ab93f9ba51d).(SYN_LOC_STDcxx . . $ SYN_LOC_STD.)->getModularizercxx . . $ OntologyBasedModularizer#getModularizer(22b3476e6945f8b5).()->getSignaturecxx . . $ TModularizer#getSignature(cb1eb85423b8268e).()); |
| 55 | |
| 56 | moduleTimercxx . . $ moduleTimer..Stopcxx . . $ TsProcTimer#Stop(49f6e7a06ebc5aa8).(); |
| 57 | } |
| 58 | |
| 59 | /// build signature for ENTITY and all dependent entities from toProcess; look for modules in Module; |
| 60 | void |
| 61 | ReasoningKernelcxx . . $ ReasoningKernel# :: buildSignaturecxx . . $ ReasoningKernel#buildSignature(e6d1c02eaefc582f). ( const TNamedEntitycxx . . $ TNamedEntity#* entity, const AxiomVeccxx . . $ AxiomVec#& Module, stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*>& toProcess ) |
| 62 | { |
| 63 | toProcess.erasecxx . . $ std/set#erase(3a53bfe100edb289).(entity); |
| 64 | setupSigcxx . . $ ReasoningKernel#setupSig(97eebc1956244cf1). ( entity, Module ); |
| 65 | const AxiomVeccxx . . $ AxiomVec# NewModule = getModExtractorcxx . . $ std/vector#vector(a1201200cf0efa42).(SYN_LOC_STDcxx . . $ SYN_LOC_STD.)->getModularizercxx . . $ OntologyBasedModularizer#getModularizer(22b3476e6945f8b5).()->getModulecxx . . $ TModularizer#getModule(73e4577bb59fbb07).(); |
| 66 | if ( Module.sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() == NewModule.sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() ) // the same module |
| 67 | return; |
| 68 | // smaller module: recurse |
| 69 | for ( const TNamedEntitycxx . . $ TNamedEntity#* e : getModExtractorcxx . . $ ReasoningKernel#getModExtractor(4d297ab93f9ba51d).(SYN_LOC_STDcxx . . $ SYN_LOC_STD.)->getModularizercxx . . $ OntologyBasedModularizer#getModularizer(22b3476e6945f8b5).()->getSignaturecxx . . $ TModularizer#getSignature(cb1eb85423b8268e).() ) |
| 70 | if ( toProcess.countcxx . . $ std/set#count(a9c5b6ffd713dfa6).(e) > 0 ) // need to process |
| 71 | buildSignaturecxx . . $ ReasoningKernel#buildSignature(e6d1c02eaefc582f). ( e, NewModule, toProcess ); |
| 72 | } |
| 73 | |
| 74 | /// initialise the incremental bits on full reload |
| 75 | void |
| 76 | ReasoningKernelcxx . . $ ReasoningKernel# :: initIncrementalcxx . . $ ReasoningKernel#initIncremental(49f6e7a06ebc5aa8). ( void ) |
| 77 | { |
| 78 | delete ModSyncxx . . $ ReasoningKernel#ModSyn.; |
| 79 | ModSyncxx . . $ ReasoningKernel#ModSyn. = nullptr; |
| 80 | // fill the module signatures of the concepts |
| 81 | Name2Sigcxx . . $ ReasoningKernel#Name2Sig..clearcxx . . $ std/map#clear(49f6e7a06ebc5aa8).(); |
| 82 | // found all entities |
| 83 | stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*> toProcesscxx . . $ std/set#set(49f6e7a06ebc5aa8).; |
| 84 | for ( TBoxcxx . . $ TBox#::c_const_iteratorcxx . . $ TBox#c_const_iterator# p = getTBoxcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(ea0f1a22ba5f21a0).()->c_begincxx . . $ TBox#c_begin(23ec1c5bda99ac5d).(), p_end = getTBoxcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(ea0f1a22ba5f21a0).()->c_endcxx . . $ TBox#c_end(23ec1c5bda99ac5d).(); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 85 | toProcess.insertcxx . . $ std/set#insert(10916b2dbd511ba8).((*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p)->getEntitycxx . . $ TNamedEntry#getEntity(1a59bfca6295ee56).()); |
| 86 | // process all entries recursively |
| 87 | while ( !toProcess.emptycxx . . $ std/set#empty(50ce9a9e25b4a850).() ) |
| 88 | buildSignaturecxx . . $ ReasoningKernel#buildSignature(e6d1c02eaefc582f). ( *cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).toProcess.begincxx . . $ std/set#begin(a1617ab40ea76896).(), Ontologycxx . . $ ReasoningKernel#Ontology..getAxiomscxx . . $ TOntology#getAxioms(791b20285504d2d7).(), toProcess ); |
| 89 | |
| 90 | |
| 91 | getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->setNameSigMapcxx . . $ TBox#setNameSigMap(ce42f3253444d58f).(&Name2Sigcxx . . $ ReasoningKernel#Name2Sig.); |
| 92 | // fill in ontology signature |
| 93 | OntoSigcxx . . $ ReasoningKernel#OntoSig. =cxx . . $ TSignature#`operator=`(2869477412e37b9b). Ontologycxx . . $ ReasoningKernel#Ontology..getSignaturecxx . . $ TOntology#getSignature(5187f694bd2cd59e).(); |
| 94 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Init modules (" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). nModulecxx . . $ nModule. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ") time: " <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). moduleTimercxx . . $ moduleTimer. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " sec" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 95 | } |
| 96 | |
| 97 | void |
| 98 | ReasoningKernelcxx . . $ ReasoningKernel# :: doIncrementalcxx . . $ ReasoningKernel#doIncremental(49f6e7a06ebc5aa8). ( void ) |
| 99 | { |
| 100 | TsProcTimercxx . . $ TsProcTimer# total; |
| 101 | total.Startcxx . . $ TsProcTimer#Start(49f6e7a06ebc5aa8).(); |
| 102 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Incremental!\n"; |
| 103 | // re-set the modularizer to use updated ontology |
| 104 | delete ModSyncxx . . $ ReasoningKernel#ModSyn.; |
| 105 | ModSyncxx . . $ ReasoningKernel#ModSyn. = nullptr; |
| 106 | |
| 107 | stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*> MPluscxx . . $ std/set#set(49f6e7a06ebc5aa8)., MMinuscxx . . $ std/set#set(49f6e7a06ebc5aa8).; |
| 108 | stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntrycxx . . $ TNamedEntry#*> excludedcxx . . $ std/set#set(49f6e7a06ebc5aa8).; |
| 109 | |
| 110 | // detect new- and old- signature elements |
| 111 | TSignaturecxx . . $ TSignature# NewSig = Ontologycxx . . $ ReasoningKernel#Ontology..getSignaturecxx . . $ TOntology#getSignature(5187f694bd2cd59e).(); |
| 112 | TSignaturecxx . . $ TSignature#::BaseTypecxx . . $ TSignature#BaseType# RemovedEntitiescxx . . $ std/set#set(49f6e7a06ebc5aa8)., AddedEntitiescxx . . $ std/set#set(49f6e7a06ebc5aa8).; |
| 113 | stdcxx . . $ std/::set_differencecxx . . $ std/set_difference(385b6b6ffcd23ab9).(OntoSigcxx . . $ ReasoningKernel#OntoSig..begincxx . . $ TSignature#begin(e7f351f2dad9f44a).(), OntoSigcxx . . $ ReasoningKernel#OntoSig..endcxx . . $ TSignature#end(e7f351f2dad9f44a).(), NewSig.begincxx . . $ TSignature#begin(e7f351f2dad9f44a).(), NewSig.endcxx . . $ TSignature#end(e7f351f2dad9f44a).(), insertercxx . . $ std/inserter(cc902069f641a146).(RemovedEntities, RemovedEntities.begincxx . . $ std/set#begin(a1617ab40ea76896).())); |
| 114 | stdcxx . . $ std/::set_differencecxx . . $ std/set_difference(385b6b6ffcd23ab9).(NewSig.begincxx . . $ TSignature#begin(e7f351f2dad9f44a).(), NewSig.endcxx . . $ TSignature#end(e7f351f2dad9f44a).(), OntoSigcxx . . $ ReasoningKernel#OntoSig..begincxx . . $ TSignature#begin(e7f351f2dad9f44a).(), OntoSigcxx . . $ ReasoningKernel#OntoSig..endcxx . . $ TSignature#end(e7f351f2dad9f44a).(), insertercxx . . $ std/inserter(cc902069f641a146).(AddedEntities, AddedEntities.begincxx . . $ std/set#begin(a1617ab40ea76896).())); |
| 115 | |
| 116 | Taxonomycxx . . $ Taxonomy#* tax = getCTaxonomycxx . . $ ReasoningKernel#getCTaxonomy(f40506d1380adb7f).(); |
| 117 | // std::cout << "Original Taxonomy:"; |
| 118 | // tax->print(std::cout); |
| 119 | |
| 120 | // deal with removed concepts |
| 121 | TSignaturecxx . . $ TSignature#::BaseTypecxx . . $ TSignature#BaseType#::iteratorcxx . . $ std/set#iterator# ecxx . . $ std/_Rb_tree_const_iterator#_Rb_tree_const_iterator(49f6e7a06ebc5aa8)., e_endcxx . . $ std/_Rb_tree_const_iterator#_Rb_tree_const_iterator(49f6e7a06ebc5aa8).; |
| 122 | for ( e =cxx . . $ std/_Rb_tree_const_iterator#`operator=`(8f7a64636a090d52). RemovedEntities.begincxx . . $ std/set#begin(a1617ab40ea76896).(), e_end =cxx . . $ std/_Rb_tree_const_iterator#`operator=`(8f7a64636a090d52). RemovedEntities.endcxx . . $ std/set#end(a1617ab40ea76896).(); e !=cxx . . $ std/`operator!=`(7e1308a0738ea758). e_end; ++cxx . . $ std/_Rb_tree_const_iterator#operator++(998dce1072ed46d4).e ) |
| 123 | if ( const TConceptcxx . . $ TConcept#* C = dynamic_cast<const TConceptcxx . . $ TConcept#*>((*cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).e)->getEntrycxx . . $ TNamedEntity#getEntry(28c03b9fd3c689f8).()) ) |
| 124 | { |
| 125 | excluded.insertcxx . . $ std/set#insert(10916b2dbd511ba8).(C); |
| 126 | // remove all links |
| 127 | C->getTaxVertexcxx . . $ ClassifiableEntry#getTaxVertex(16f9ca5fa66f7d36).()->removecxx . . $ TaxonomyVertex#remove(49f6e7a06ebc5aa8).(); |
| 128 | // update Name2Sig |
| 129 | delete Name2Sigcxx . . $ ReasoningKernel#Name2Sig.[cxx . . $ std/map#`operator[]`(bbd415b616967878).*cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).e]; |
| 130 | Name2Sigcxx . . $ ReasoningKernel#Name2Sig..erasecxx . . $ std/map#erase(a7de169f3ef4bfb3).(*cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).e); |
| 131 | } |
| 132 | |
| 133 | // deal with added concepts |
| 134 | tax->deFinalisecxx . . $ Taxonomy#deFinalise(49f6e7a06ebc5aa8).(); |
| 135 | for ( e =cxx . . $ std/_Rb_tree_const_iterator#`operator=`(8f7a64636a090d52). AddedEntities.begincxx . . $ std/set#begin(a1617ab40ea76896).(), e_end =cxx . . $ std/_Rb_tree_const_iterator#`operator=`(8f7a64636a090d52). AddedEntities.endcxx . . $ std/set#end(a1617ab40ea76896).(); e !=cxx . . $ std/`operator!=`(7e1308a0738ea758). e_end; ++cxx . . $ std/_Rb_tree_const_iterator#operator++(998dce1072ed46d4).e ) |
| 136 | if ( const TDLConceptNamecxx . . $ TDLConceptName#* cName = dynamic_cast<const TDLConceptNamecxx . . $ TDLConceptName#*>(*cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).e) ) |
| 137 | { |
| 138 | // register the name in TBox |
| 139 | TreeDeletercxx . . $ TreeDeleter# TDcxx . . $ TreeDeleter#TreeDeleter(edf821a2fc5509f9).(this->ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(cName)); |
| 140 | TConceptcxx . . $ TConcept#* C = dynamic_cast<TConceptcxx . . $ TConcept#*>(cName->getEntrycxx . . $ TNamedEntity#getEntry(28c03b9fd3c689f8).()); |
| 141 | // create sig for it |
| 142 | setupSigcxx . . $ ReasoningKernel#setupSig(70f9d3c046cd5911).(cName); |
| 143 | // init the taxonomy element |
| 144 | TaxonomyVertexcxx . . $ TaxonomyVertex#* cur = tax->getCurrentcxx . . $ Taxonomy#getCurrent(e005a88f538258f6).(); |
| 145 | cur->clearcxx . . $ TaxonomyVertex#clear(49f6e7a06ebc5aa8).(); |
| 146 | cur->setSamplecxx . . $ TaxonomyVertex#setSample(c310a0381288b48e).(C); |
| 147 | cur->addNeighbourcxx . . $ TaxonomyVertex#addNeighbour(93beaa2f49a74c7). ( /*upDirection=*/true, tax->getTopVertexcxx . . $ Taxonomy#getTopVertex(16f9ca5fa66f7d36).() ); |
| 148 | tax->finishCurrentNodecxx . . $ Taxonomy#finishCurrentNode(49f6e7a06ebc5aa8).(); |
| 149 | // std::cout << "Insert " << C->getName() << std::endl; |
| 150 | } |
| 151 | OntoSigcxx . . $ ReasoningKernel#OntoSig. =cxx . . $ TSignature#`operator=`(6f74423c3ed79251). NewSig; |
| 152 | |
| 153 | // fill in M^+ and M^- sets |
| 154 | TsProcTimercxx . . $ TsProcTimer# t; |
| 155 | t.Startcxx . . $ TsProcTimer#Start(49f6e7a06ebc5aa8).(); |
| 156 | LocalityCheckercxx . . $ LocalityChecker#* lc = getModExtractorcxx . . $ ReasoningKernel#getModExtractor(4d297ab93f9ba51d).(SYN_LOC_STDcxx . . $ SYN_LOC_STD.)->getModularizercxx . . $ OntologyBasedModularizer#getModularizer(22b3476e6945f8b5).()->getLocalityCheckercxx . . $ TModularizer#getLocalityChecker(217d0df15fc6e9c).(); |
| 157 | TOntologycxx . . $ TOntology#::iteratorcxx . . $ TOntology#iterator# nb = Ontologycxx . . $ ReasoningKernel#Ontology..beginUnprocessedcxx . . $ TOntology#beginUnprocessed(37aced936b943211).(), ne = Ontologycxx . . $ ReasoningKernel#Ontology..endcxx . . $ TOntology#end(37aced936b943211).(), rb = Ontologycxx . . $ ReasoningKernel#Ontology..beginRetractedcxx . . $ TOntology#beginRetracted(37aced936b943211).(), re = Ontologycxx . . $ ReasoningKernel#Ontology..endRetractedcxx . . $ TOntology#endRetracted(37aced936b943211).(); |
| 158 | // TLISPOntologyPrinter pr(std::cout); |
| 159 | // TOntology::iterator q; |
| 160 | // for ( q = nb; q != ne; ++q ) |
| 161 | // { |
| 162 | // std::cout << "Add:"; |
| 163 | // (*q)->accept(pr); |
| 164 | // } |
| 165 | // for ( q = rb; q != re; ++q ) |
| 166 | // { |
| 167 | // std::cout << "Del:"; |
| 168 | // (*q)->accept(pr); |
| 169 | // } |
| 170 | for ( NameSigMapcxx . . $ ReasoningKernel#NameSigMap#::iteratorcxx . . $ std/map#iterator# p = Name2Sigcxx . . $ ReasoningKernel#Name2Sig..begincxx . . $ std/map#begin(fbe2f8c57595edf).(), p_end = Name2Sigcxx . . $ ReasoningKernel#Name2Sig..endcxx . . $ std/map#end(fbe2f8c57595edf).(); p !=cxx . . $ std/`operator!=`(84f83906d8995b82). p_end; ++cxx . . $ std/_Rb_tree_iterator#operator++(9461e5518c11c498).p ) |
| 171 | { |
| 172 | lc->setSignatureValuecxx . . $ LocalityChecker#setSignatureValue(7393b46d99f9f765).(*p->cxx . . $ std/_Rb_tree_iterator#`operator->`(5a2a78a048fb49a8).secondcxx . . $ std/pair#second.); |
| 173 | for ( TOntologycxx . . $ TOntology#::iteratorcxx . . $ TOntology#iterator# notProcessed = nb; notProcessed !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). ne; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).notProcessed ) |
| 174 | if ( !lc->localcxx . . $ LocalityChecker#local(c12ce7eacb2f7daa).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).notProcessed) ) |
| 175 | { |
| 176 | MPlus.insertcxx . . $ std/set#insert(411a10a755068dfe).(p->cxx . . $ std/_Rb_tree_iterator#`operator->`(5a2a78a048fb49a8).firstcxx . . $ std/pair#first.); |
| 177 | // std::cout << "Non-local NP axiom "; |
| 178 | // (*notProcessed)->accept(pr); |
| 179 | // std::cout << " wrt " << p->first->getName() << std::endl; |
| 180 | break; |
| 181 | } |
| 182 | for ( TOntologycxx . . $ TOntology#::iteratorcxx . . $ TOntology#iterator# retracted = rb; retracted !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). re; retracted++cxx . . $ __gnu_cxx/__normal_iterator#operator++(c443b773b1266d5a). ) |
| 183 | if ( !lc->localcxx . . $ LocalityChecker#local(c12ce7eacb2f7daa).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).retracted) ) |
| 184 | { |
| 185 | MMinus.insertcxx . . $ std/set#insert(411a10a755068dfe).(p->cxx . . $ std/_Rb_tree_iterator#`operator->`(5a2a78a048fb49a8).firstcxx . . $ std/pair#first.); |
| 186 | // FIXME!! only concepts for now |
| 187 | TaxonomyVertexcxx . . $ TaxonomyVertex#* v = dynamic_cast<const ClassifiableEntrycxx . . $ ClassifiableEntry#*>(p->cxx . . $ std/_Rb_tree_iterator#`operator->`(5a2a78a048fb49a8).firstcxx . . $ std/pair#first.->getEntrycxx . . $ TNamedEntity#getEntry(28c03b9fd3c689f8).())->getTaxVertexcxx . . $ ClassifiableEntry#getTaxVertex(16f9ca5fa66f7d36).(); |
| 188 | if ( v->noNeighbourscxx . . $ TaxonomyVertex#noNeighbours(962fae8be55e1d9).(true) ) |
| 189 | { |
| 190 | v->addNeighbourcxx . . $ TaxonomyVertex#addNeighbour(93beaa2f49a74c7).(true,tax->getTopVertexcxx . . $ Taxonomy#getTopVertex(16f9ca5fa66f7d36).()); |
| 191 | tax->getTopVertexcxx . . $ Taxonomy#getTopVertex(16f9ca5fa66f7d36).()->addNeighbourcxx . . $ TaxonomyVertex#addNeighbour(93beaa2f49a74c7).(false,v); |
| 192 | } |
| 193 | // std::cout << "Non-local RT axiom "; |
| 194 | // (*retracted)->accept(pr); |
| 195 | // std::cout << " wrt " << p->first->getName() << std::endl; |
| 196 | break; |
| 197 | } |
| 198 | } |
| 199 | t.Stopcxx . . $ TsProcTimer#Stop(49f6e7a06ebc5aa8).(); |
| 200 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Determine concepts that need reclassification: done in " <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). t <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 201 | |
| 202 | // build changed modules |
| 203 | stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*> toProcesscxx . . $ std/set#set(a5cb4082b223c231).(MPlus); |
| 204 | toProcess.insertcxx . . $ std/set#insert(50ef72ff69bc573d). ( MMinus.begincxx . . $ std/set#begin(a1617ab40ea76896).(), MMinus.endcxx . . $ std/set#end(a1617ab40ea76896).() ); |
| 205 | // process all entries recursively |
| 206 | while ( !toProcess.emptycxx . . $ std/set#empty(50ce9a9e25b4a850).() ) |
| 207 | buildSignaturecxx . . $ ReasoningKernel#buildSignature(e6d1c02eaefc582f). ( *cxx . . $ std/_Rb_tree_const_iterator#`operator*`(ea465e50d690edfe).toProcess.begincxx . . $ std/set#begin(a1617ab40ea76896).(), Ontologycxx . . $ ReasoningKernel#Ontology..getAxiomscxx . . $ TOntology#getAxioms(791b20285504d2d7).(), toProcess ); |
| 208 | |
| 209 | tax->finalisecxx . . $ Taxonomy#finalise(49f6e7a06ebc5aa8).(); |
| 210 | // std::cout << "Adjusted Taxonomy:"; |
| 211 | // tax->print(std::cout); |
| 212 | |
| 213 | t.Resetcxx . . $ TsProcTimer#Reset(49f6e7a06ebc5aa8).(); |
| 214 | t.Startcxx . . $ TsProcTimer#Start(49f6e7a06ebc5aa8).(); |
| 215 | // save taxonomy |
| 216 | SaveLoadManagercxx . . $ SaveLoadManager# SLManagercxx . . $ SaveLoadManager#SaveLoadManager(9c546c94e5fcce4e).("Incremental"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 217 | SLManager.preparecxx . . $ SaveLoadManager#prepare(b45ddcbc8423892c).(/*input=*/false); |
| 218 | // FIXME!! for now |
| 219 | excluded.clearcxx . . $ std/set#clear(49f6e7a06ebc5aa8).(); |
| 220 | getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->SaveTaxonomycxx . . $ TBox#SaveTaxonomy(743aa3bb9dc93fde).(SLManager,excluded); |
| 221 | |
| 222 | // do actual change |
| 223 | useIncrementalReasoningcxx . . $ ReasoningKernel#useIncrementalReasoning. = false; |
| 224 | forceReloadcxx . . $ ReasoningKernel#forceReload(49f6e7a06ebc5aa8).(); |
| 225 | pTBoxcxx . . $ ReasoningKernel#pTBox.->setNameSigMapcxx . . $ TBox#setNameSigMap(ce42f3253444d58f).(&Name2Sigcxx . . $ ReasoningKernel#Name2Sig.); |
| 226 | pTBoxcxx . . $ ReasoningKernel#pTBox.->isConsistentcxx . . $ TBox#isConsistent(c9857a73d68e59ba).(); |
| 227 | useIncrementalReasoningcxx . . $ ReasoningKernel#useIncrementalReasoning. = true; |
| 228 | |
| 229 | // load the taxonomy |
| 230 | SLManager.preparecxx . . $ SaveLoadManager#prepare(b45ddcbc8423892c).(/*input=*/true); |
| 231 | getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->LoadTaxonomycxx . . $ TBox#LoadTaxonomy(da67b8e43f9c9b96).(SLManager); |
| 232 | t.Stopcxx . . $ TsProcTimer#Stop(49f6e7a06ebc5aa8).(); |
| 233 | |
| 234 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Reloading ontology: done in " <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). t <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 235 | |
| 236 | tax = getCTaxonomycxx . . $ ReasoningKernel#getCTaxonomy(f40506d1380adb7f).(); |
| 237 | // std::cout << "Reloaded Taxonomy:"; |
| 238 | // tax->print(std::cout); |
| 239 | // std::cout.flush(); |
| 240 | |
| 241 | subCheckTimercxx . . $ subCheckTimer..Startcxx . . $ TsProcTimer#Start(49f6e7a06ebc5aa8).(); |
| 242 | getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->reclassifycxx . . $ TBox#reclassify(75cae9a303a37910). ( MPlus, MMinus ); |
| 243 | subCheckTimercxx . . $ subCheckTimer..Stopcxx . . $ TsProcTimer#Stop(49f6e7a06ebc5aa8).(); |
| 244 | Ontologycxx . . $ ReasoningKernel#Ontology..setProcessedcxx . . $ TOntology#setProcessed(49f6e7a06ebc5aa8).(); |
| 245 | total.Stopcxx . . $ TsProcTimer#Stop(49f6e7a06ebc5aa8).(); |
| 246 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Total modularization (" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). nModulecxx . . $ nModule. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ") time: " <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). moduleTimercxx . . $ moduleTimer. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " sec\nTotal reasoning time: " <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). subCheckTimercxx . . $ subCheckTimer. |
| 247 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " sec\nTotal reclassification time: " <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). total <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " sec" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 248 | } |
| 249 | |
| 250 | stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& |
| 251 | operatorcxx . . $ `operator<<`(1205b1c84aa92a69). << ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o, const TSignaturecxx . . $ TSignature#& sig ) |
| 252 | { |
| 253 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "["; |
| 254 | for ( const TNamedEntitycxx . . $ TNamedEntity#* entity : sig ) |
| 255 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). entity->getNamecxx . . $ TNamedEntity#getName(a9f41ea0e82d88cf).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " "; |
| 256 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 257 | return o; |
| 258 | } |