| 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 DLTBOX_H |
| 21 | #define DLTBOX_Hcxx . . $ `Kernel/dlTBox.h:21:9`! |
| 22 | |
| 23 | #include <string> |
| 24 | #include <vector> |
| 25 | #include <set> |
| 26 | #include <map> |
| 27 | |
| 28 | #include "tConcept.h"cxx . . $ `<file>/Kernel/tConcept.h`/ |
| 29 | #include "tIndividual.h"cxx . . $ `<file>/Kernel/tIndividual.h`/ |
| 30 | #include "modelCacheSingleton.h"cxx . . $ `<file>/Kernel/modelCacheSingleton.h`/ |
| 31 | #include "RoleMaster.h"cxx . . $ `<file>/Kernel/RoleMaster.h`/ |
| 32 | #include "LogicFeature.h"cxx . . $ `<file>/Kernel/LogicFeature.h`/ |
| 33 | #include "dlDag.h"cxx . . $ `<file>/Kernel/dlDag.h`/ |
| 34 | #include "ifOptions.h"cxx . . $ `<file>/Kernel/ifOptions.h`/ |
| 35 | #include "PriorityMatrix.h"cxx . . $ `<file>/Kernel/PriorityMatrix.h`/ |
| 36 | #include "tRelated.h"cxx . . $ `<file>/Kernel/tRelated.h`/ |
| 37 | #include "tNECollection.h"cxx . . $ `<file>/Kernel/tNECollection.h`/ |
| 38 | #include "tAxiomSet.h"cxx . . $ `<file>/Kernel/tAxiomSet.h`/ |
| 39 | #include "DataTypeCenter.h"cxx . . $ `<file>/Kernel/DataTypeCenter.h`/ |
| 40 | #include "tProgressMonitor.h"cxx . . $ `<file>/Kernel/tProgressMonitor.h`/ |
| 41 | #include "tKBFlags.h"cxx . . $ `<file>/Kernel/tKBFlags.h`/ |
| 42 | |
| 43 | class DlSatTestercxx . . $ DlSatTester#; |
| 44 | class Taxonomycxx . . $ Taxonomy#; |
| 45 | class DLConceptTaxonomycxx . . $ DLConceptTaxonomy#; |
| 46 | class dumpInterfacecxx . . $ dumpInterface#; |
| 47 | class TSignaturecxx . . $ TSignature#; |
| 48 | class SaveLoadManagercxx . . $ SaveLoadManager#; |
| 49 | |
| 50 | /// enumeration for the reasoner status |
| 51 | enum KBStatuscxx . . $ KBStatus# |
| 52 | { |
| 53 | kbEmptycxx . . $ kbEmpty., // no axioms loaded yet; not used in TBox |
| 54 | kbLoadingcxx . . $ kbLoading., // axioms are added to the KB, no preprocessing done |
| 55 | kbCCheckedcxx . . $ kbCChecked., // KB is preprocessed and consistency checked |
| 56 | kbClassifiedcxx . . $ kbClassified., // KB is classified |
| 57 | kbRealisedcxx . . $ kbRealised., // KB is realised |
| 58 | }; |
| 59 | |
| 60 | class TBoxcxx . . $ TBox# |
| 61 | { |
| 62 | friend class DlSatTestercxx . . $ DlSatTester#; |
| 63 | friend class NominalReasonercxx . . $ NominalReasoner#; |
| 64 | friend class ReasoningKernelcxx . . $ ReasoningKernel#; |
| 65 | friend class TAxiomcxx . . $ TAxiom#; // FIXME!! while TConcept can't get rid of told cycles |
| 66 | friend class DLConceptTaxonomycxx . . $ DLConceptTaxonomy#; |
| 67 | |
| 68 | public: // type interface |
| 69 | /// vector of CONCEPT-like elements |
| 70 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<TConceptcxx . . $ TConcept#*> ConceptVectorcxx . . $ TBox#ConceptVector#; |
| 71 | /// vector of SINGLETON-like elements |
| 72 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<TIndividualcxx . . $ TIndividual#*> SingletonVectorcxx . . $ TBox#SingletonVector#; |
| 73 | /// map between names and corresponding module signatures |
| 74 | typedef stdcxx . . $ std/::mapcxx . . $ std/map#<const TNamedEntitycxx . . $ TNamedEntity#*, const TSignaturecxx . . $ TSignature#*> NameSigMapcxx . . $ TBox#NameSigMap#; |
| 75 | |
| 76 | protected: // types |
| 77 | /// type for DISJOINT-like statements |
| 78 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<DLTreecxx . . $ DLTree#*> ExpressionArraycxx . . $ TBox#ExpressionArray#; |
| 79 | /// set of concepts together with creation methods |
| 80 | typedef TNECollectioncxx . . $ TNECollection#<TConceptcxx . . $ TConcept#> ConceptCollectioncxx . . $ TBox#ConceptCollection#; |
| 81 | /// collection of individuals |
| 82 | typedef TNECollectioncxx . . $ TNECollection#<TIndividualcxx . . $ TIndividual#> IndividualCollectioncxx . . $ TBox#IndividualCollection#; |
| 83 | /// type for the array of Related elements |
| 84 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<TRelatedcxx . . $ TRelated#*> RelatedCollectioncxx . . $ TBox#RelatedCollection#; |
| 85 | /// type for a collection of DIFFERENT individuals |
| 86 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<SingletonVectorcxx . . $ TBox#SingletonVector#> DifferentIndividualscxx . . $ TBox#DifferentIndividuals#; |
| 87 | /// type for a A -> C map |
| 88 | typedef stdcxx . . $ std/::mapcxx . . $ std/map#<TConceptcxx . . $ TConcept#*, DLTreecxx . . $ DLTree#*> ConceptDefMapcxx . . $ TBox#ConceptDefMap#; |
| 89 | /// type for a set of concepts |
| 90 | typedef stdcxx . . $ std/::setcxx . . $ std/set#<TConceptcxx . . $ TConcept#*> ConceptSetcxx . . $ TBox#ConceptSet#; |
| 91 | |
| 92 | /// class for simple rules like Ch :- Cb1, Cbi, CbN; all C are primitive named concepts |
| 93 | class TSimpleRulecxx . . $ TBox#TSimpleRule# |
| 94 | { |
| 95 | public: // type interface |
| 96 | /// type for the rule body |
| 97 | typedef TBoxcxx . . $ TBox#::ConceptVectorcxx . . $ TBox#ConceptVector# TRuleBodycxx . . $ TBox#TSimpleRule#TRuleBody#; |
| 98 | /// RW iterator over body |
| 99 | typedef TRuleBodycxx . . $ TBox#TSimpleRule#TRuleBody#::iteratorcxx . . $ std/vector#iterator# iteratorcxx . . $ TBox#TSimpleRule#iterator#; |
| 100 | /// RO iterator over body |
| 101 | typedef TRuleBodycxx . . $ TBox#TSimpleRule#TRuleBody#::const_iteratorcxx . . $ std/vector#const_iterator# const_iteratorcxx . . $ TBox#TSimpleRule#const_iterator#; |
| 102 | |
| 103 | public: // members |
| 104 | /// body of the rule |
| 105 | TRuleBodycxx . . $ TBox#TSimpleRule#TRuleBody# Bodycxx . . $ TBox#TSimpleRule#Body.; |
| 106 | /// head of the rule as a DLTree |
| 107 | DLTreecxx . . $ DLTree#* tHeadcxx . . $ TBox#TSimpleRule#tHead.; |
| 108 | /// head of the rule as a BP |
| 109 | BipolarPointercxx . . $ BipolarPointer# bpHeadcxx . . $ TBox#TSimpleRule#bpHead. = bpINVALIDcxx . . $ bpINVALID.; |
| 110 | |
| 111 | public: // interface |
| 112 | /// init c'tor |
| 113 | TSimpleRulecxx . . $ TBox#TSimpleRule#TSimpleRule(b0f8a7a48a8d759b). ( const TRuleBodycxx . . $ TBox#TSimpleRule#TRuleBody#& body, DLTreecxx . . $ DLTree#* head ) |
| 114 | : Bodycxx . . $ TBox#TSimpleRule#Body.(body) |
| 115 | , tHeadcxx . . $ TBox#TSimpleRule#tHead.(head) |
| 116 | {} |
| 117 | /// no copy c'tor |
| 118 | TSimpleRulecxx . . $ TBox#TSimpleRule#TSimpleRule(33df37c42a5b1f9a). ( const TSimpleRulecxx . . $ TBox#TSimpleRule#& ) = delete; |
| 119 | /// no assignment |
| 120 | TSimpleRulecxx . . $ TBox#TSimpleRule#& operatorcxx . . $ TBox#TSimpleRule#`operator=`(4b044015d6ad771f).= ( const TSimpleRulecxx . . $ TBox#TSimpleRule#& ) = delete; |
| 121 | /// empty d'tor |
| 122 | virtual ~cxx . . $ TBox#TSimpleRule#`~TSimpleRule`(49f6e7a06ebc5aa8).TSimpleRulecxx . . $ TBox#TSimpleRule#() { deleteTreecxx . . $ deleteTree(c5beffd064a5e5b2).(tHeadcxx . . $ TBox#TSimpleRule#tHead.); } |
| 123 | }; // TSimpleRule |
| 124 | /// all simple rules in KB |
| 125 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<TSimpleRulecxx . . $ TBox#TSimpleRule#*> TSimpleRulescxx . . $ TBox#TSimpleRules#; |
| 126 | /// R-C cache for the \forall R.C replacement in GCIs |
| 127 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<DLTreecxx . . $ DLTree#*,TConceptcxx . . $ TConcept#*> > TRCCachecxx . . $ TBox#TRCCache#; |
| 128 | |
| 129 | protected: // typedefs |
| 130 | /// RW concept iterator |
| 131 | typedef ConceptCollectioncxx . . $ TBox#ConceptCollection#::iteratorcxx . . $ TNECollection#iterator# c_iteratorcxx . . $ TBox#c_iterator#; |
| 132 | /// RW individual iterator |
| 133 | typedef IndividualCollectioncxx . . $ TBox#IndividualCollection#::iteratorcxx . . $ TNECollection#iterator# i_iteratorcxx . . $ TBox#i_iterator#; |
| 134 | /// RO ExpressionArray iterator |
| 135 | typedef ExpressionArraycxx . . $ TBox#ExpressionArray#::const_iteratorcxx . . $ std/vector#const_iterator# ea_iteratorcxx . . $ TBox#ea_iterator#; |
| 136 | |
| 137 | public: // interface |
| 138 | /// RO concept iterator |
| 139 | typedef ConceptCollectioncxx . . $ TBox#ConceptCollection#::const_iteratorcxx . . $ TNECollection#const_iterator# c_const_iteratorcxx . . $ TBox#c_const_iterator#; |
| 140 | /// RO individual iterator |
| 141 | typedef IndividualCollectioncxx . . $ TBox#IndividualCollection#::const_iteratorcxx . . $ TNECollection#const_iterator# i_const_iteratorcxx . . $ TBox#i_const_iterator#; |
| 142 | |
| 143 | protected: // members |
| 144 | /// relevance label (to determine logical features) |
| 145 | TLabellercxx . . $ TLabeller# relevancecxx . . $ TBox#relevance.; |
| 146 | /// DAG of all expressions |
| 147 | DLDagcxx . . $ DLDag# DLHeapcxx . . $ TBox#DLHeap.; |
| 148 | |
| 149 | /// reasoner for TBox-related queries w/o nominals |
| 150 | DlSatTestercxx . . $ DlSatTester#* stdReasonercxx . . $ TBox#stdReasoner. = nullptr; |
| 151 | /// reasoner for TBox-related queries with nominals |
| 152 | DlSatTestercxx . . $ DlSatTester#* nomReasonercxx . . $ TBox#nomReasoner. = nullptr; |
| 153 | |
| 154 | /// progress monitor |
| 155 | TProgressMonitorcxx . . $ TProgressMonitor#* pMonitorcxx . . $ TBox#pMonitor. = nullptr; |
| 156 | |
| 157 | /// vectors for Completely defined, Non-CD and Non-primitive concepts |
| 158 | ConceptVectorcxx . . $ TBox#ConceptVector# arrayCDcxx . . $ TBox#arrayCD., arrayNoCDcxx . . $ TBox#arrayNoCD., arrayNPcxx . . $ TBox#arrayNP.; |
| 159 | /// taxonomy structure of a TBox |
| 160 | Taxonomycxx . . $ Taxonomy#* pTaxcxx . . $ TBox#pTax. = nullptr; |
| 161 | /// classifier |
| 162 | DLConceptTaxonomycxx . . $ DLConceptTaxonomy#* pTaxCreatorcxx . . $ TBox#pTaxCreator. = nullptr; |
| 163 | /// name-signature map |
| 164 | NameSigMapcxx . . $ TBox#NameSigMap#* pName2Sigcxx . . $ TBox#pName2Sig. = nullptr; |
| 165 | /// DataType center |
| 166 | DataTypeCentercxx . . $ DataTypeCenter# DTCentercxx . . $ TBox#DTCenter.; |
| 167 | /// set of reasoning options |
| 168 | const ifOptionSetcxx . . $ ifOptionSet#* pOptionscxx . . $ TBox#pOptions.; |
| 169 | /// status of the KB |
| 170 | KBStatuscxx . . $ KBStatus# Statuscxx . . $ TBox#Status. = kbLoadingcxx . . $ kbLoading.; |
| 171 | |
| 172 | /// global KB features |
| 173 | LogicFeaturescxx . . $ LogicFeatures# KBFeaturescxx . . $ TBox#KBFeatures.; |
| 174 | /// GCI features |
| 175 | LogicFeaturescxx . . $ LogicFeatures# GCIFeaturescxx . . $ TBox#GCIFeatures.; |
| 176 | /// nominal cloud features |
| 177 | LogicFeaturescxx . . $ LogicFeatures# NCFeaturescxx . . $ TBox#NCFeatures.; |
| 178 | /// aux features |
| 179 | LogicFeaturescxx . . $ LogicFeatures# auxFeaturescxx . . $ TBox#auxFeatures.; |
| 180 | /// pointer to current feature (in case of local ones) |
| 181 | LogicFeaturescxx . . $ LogicFeatures#* curFeaturecxx . . $ TBox#curFeature. = nullptr; |
| 182 | |
| 183 | // auxiliary concepts for Taxonomy |
| 184 | |
| 185 | /// concept representing Top |
| 186 | TConceptcxx . . $ TConcept#* pTopcxx . . $ TBox#pTop.; |
| 187 | /// concept representing Bottom |
| 188 | TConceptcxx . . $ TConcept#* pBottomcxx . . $ TBox#pBottom.; |
| 189 | /// concept representing temporary one that can not be used anywhere in the ontology |
| 190 | TConceptcxx . . $ TConcept#* pTempcxx . . $ TBox#pTemp.; |
| 191 | /// temporary concept that represents query |
| 192 | TConceptcxx . . $ TConcept#* pQuerycxx . . $ TBox#pQuery. = nullptr; |
| 193 | |
| 194 | /// all named concepts |
| 195 | ConceptCollectioncxx . . $ TBox#ConceptCollection# Conceptscxx . . $ TBox#Concepts.; |
| 196 | /// all named individuals/nominals |
| 197 | IndividualCollectioncxx . . $ TBox#IndividualCollection# Individualscxx . . $ TBox#Individuals.; |
| 198 | /// "normal" (object) roles |
| 199 | RoleMastercxx . . $ RoleMaster# ORMcxx . . $ TBox#ORM.; |
| 200 | /// data roles |
| 201 | RoleMastercxx . . $ RoleMaster# DRMcxx . . $ TBox#DRM.; |
| 202 | /// set of GCIs |
| 203 | TAxiomSetcxx . . $ TAxiomSet# Axiomscxx . . $ TBox#Axioms.; |
| 204 | /// given individual-individual relations |
| 205 | RelatedCollectioncxx . . $ TBox#RelatedCollection# RelatedIcxx . . $ TBox#RelatedI.; |
| 206 | /// known disjoint sets of individuals |
| 207 | DifferentIndividualscxx . . $ TBox#DifferentIndividuals# Differentcxx . . $ TBox#Different.; |
| 208 | /// all simple rules in KB |
| 209 | TSimpleRulescxx . . $ TBox#TSimpleRules# SimpleRulescxx . . $ TBox#SimpleRules.; |
| 210 | /// map to show the possible equivalence between individuals |
| 211 | stdcxx . . $ std/::mapcxx . . $ std/map#<TConceptcxx . . $ TConcept#*, stdcxx . . $ std/::paircxx . . $ std/pair#<TIndividualcxx . . $ TIndividual#*,bool> > SameIcxx . . $ TBox#SameI.; |
| 212 | /// map from A->C for axioms A [= C where A = D is in the TBox |
| 213 | ConceptDefMapcxx . . $ TBox#ConceptDefMap# ExtraConceptDefscxx . . $ TBox#ExtraConceptDefs.; |
| 214 | |
| 215 | /// internalisation of a general axioms |
| 216 | BipolarPointercxx . . $ BipolarPointer# T_Gcxx . . $ TBox#T_G. = bpTOPcxx . . $ bpTOP.; |
| 217 | /// KB flags about GCIs |
| 218 | TKBFlagscxx . . $ TKBFlags# GCIscxx . . $ TBox#GCIs.; |
| 219 | |
| 220 | /// cache for the \forall R.C replacements during absorption |
| 221 | TRCCachecxx . . $ TBox#TRCCache# RCCachecxx . . $ TBox#RCCache.; |
| 222 | |
| 223 | /// maps from concept index to concept itself |
| 224 | ConceptVectorcxx . . $ TBox#ConceptVector# ConceptMapcxx . . $ TBox#ConceptMap.; |
| 225 | |
| 226 | /// number of concepts and individuals; used to set index for modelCache |
| 227 | unsigned int nCcxx . . $ TBox#nC. = 0; |
| 228 | /// number of all distinct roles; used to set index for modelCache |
| 229 | unsigned int nRcxx . . $ TBox#nR. = 0; |
| 230 | /// current aux concept's ID |
| 231 | unsigned int auxConceptIDcxx . . $ TBox#auxConceptID. = 0; |
| 232 | /// how many times nominals were found during translation to DAG; local to BuildDAG |
| 233 | unsigned int nNominalReferencescxx . . $ TBox#nNominalReferences. = 0; |
| 234 | /// number of relevant calls to named concepts; local to relevance |
| 235 | unsigned long nRelevantCCallscxx . . $ TBox#nRelevantCCalls. = 0; |
| 236 | /// number of relevant calls to concept expressions; local to relevance |
| 237 | unsigned long nRelevantBCallscxx . . $ TBox#nRelevantBCalls. = 0; |
| 238 | |
| 239 | /// searchable stack for the told subsumers |
| 240 | stdcxx . . $ std/::setcxx . . $ std/set#<TConceptcxx . . $ TConcept#*> CInProcesscxx . . $ TBox#CInProcess.; |
| 241 | /// all the synonyms in the told subsumers' cycle |
| 242 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<TConceptcxx . . $ TConcept#*> ToldSynonymscxx . . $ TBox#ToldSynonyms.; |
| 243 | |
| 244 | /// fairness constraints |
| 245 | ConceptVectorcxx . . $ TBox#ConceptVector# Fairnesscxx . . $ TBox#Fairness.; |
| 246 | |
| 247 | /// priority matrix for To-Do lists |
| 248 | ToDoPriorMatrixcxx . . $ ToDoPriorMatrix# PriorityMatrixcxx . . $ TBox#PriorityMatrix.; |
| 249 | /// single SAT/SUB test timeout in milliseconds |
| 250 | unsigned long testTimeoutcxx . . $ TBox#testTimeout. = 0; |
| 251 | |
| 252 | //--------------------------------------------------------------------------- |
| 253 | // Reasoner's members: there are many reasoner classes, some members are shared |
| 254 | //--------------------------------------------------------------------------- |
| 255 | |
| 256 | /// flag for switching semantic branching |
| 257 | bool useSemanticBranchingcxx . . $ TBox#useSemanticBranching. = true; |
| 258 | /// flag for switching backjumping |
| 259 | bool useBackjumpingcxx . . $ TBox#useBackjumping. = true; |
| 260 | /// whether or not check blocking status as late as possible |
| 261 | bool useLazyBlockingcxx . . $ TBox#useLazyBlocking. = true; |
| 262 | /// flag for switching between Anywhere and Ancestor blocking |
| 263 | bool useAnywhereBlockingcxx . . $ TBox#useAnywhereBlocking. = true; |
| 264 | /// flag to use caching during completion tree construction |
| 265 | bool useNodeCachecxx . . $ TBox#useNodeCache. = true; |
| 266 | /// how many nodes skip before block; work only with FAIRNESS |
| 267 | int nSkipBeforeBlockcxx . . $ TBox#nSkipBeforeBlock. = 0; |
| 268 | |
| 269 | //--------------------------------------------------------------------------- |
| 270 | // User-defined flags |
| 271 | //--------------------------------------------------------------------------- |
| 272 | |
| 273 | /// flag for creating taxonomy |
| 274 | bool useCompletelyDefinedcxx . . $ TBox#useCompletelyDefined. = true; |
| 275 | /// flag for dumping TBox relevant to query |
| 276 | bool dumpQuerycxx . . $ TBox#dumpQuery. = false; |
| 277 | /// whether or not we need classification. Set up in checkQueryNames() |
| 278 | bool needClassificationcxx . . $ TBox#needClassification. = true; |
| 279 | /// shall we prefer C=D axioms to C[=E in definition of concepts |
| 280 | bool alwaysPreferEqualscxx . . $ TBox#alwaysPreferEquals. = true; |
| 281 | /// use special domains as GCIs |
| 282 | bool useSpecialDomainscxx . . $ TBox#useSpecialDomains. = false; |
| 283 | /// shall verbose output be used |
| 284 | bool verboseOutputcxx . . $ TBox#verboseOutput. = false; |
| 285 | /// create cache of individual relations during consistency check (much faster but could be incomplete) |
| 286 | bool precacheRelatedcxx . . $ TBox#precacheRelated. = true; |
| 287 | |
| 288 | //--------------------------------------------------------------------------- |
| 289 | // Internally defined flags |
| 290 | //--------------------------------------------------------------------------- |
| 291 | |
| 292 | /// whether we use sorted reasoning; depends on some simplifications |
| 293 | bool useSortedReasoningcxx . . $ TBox#useSortedReasoning. = true; |
| 294 | /// flag whether TBox is GALEN-like |
| 295 | bool isLikeGALENcxx . . $ TBox#isLikeGALEN. = false; |
| 296 | /// flag whether TBox is WINE-like |
| 297 | bool isLikeWINEcxx . . $ TBox#isLikeWINE. = false; |
| 298 | |
| 299 | /// whether KB is consistent |
| 300 | bool Consistentcxx . . $ TBox#Consistent. = true; |
| 301 | |
| 302 | /// time spend for preprocessing |
| 303 | float preprocTimecxx . . $ TBox#preprocTime. = 0.0; |
| 304 | /// time spend for consistency checking |
| 305 | float consistTimecxx . . $ TBox#consistTime. = 0.0; |
| 306 | |
| 307 | protected: // methods |
| 308 | /// init all flags using given set of options |
| 309 | void readConfigcxx . . $ TBox#readConfig(caa43d10477a9290). ( const ifOptionSetcxx . . $ ifOptionSet#* Options ); |
| 310 | /// initialise Top and Bottom internal concepts |
| 311 | void initTopBottomcxx . . $ TBox#initTopBottom(49f6e7a06ebc5aa8). ( void ); |
| 312 | |
| 313 | |
| 314 | //----------------------------------------------------------------------------- |
| 315 | //-- internal iterators |
| 316 | //----------------------------------------------------------------------------- |
| 317 | |
| 318 | /// RW begin() for concepts |
| 319 | c_iteratorcxx . . $ TBox#c_iterator# c_begincxx . . $ TBox#c_begin(23ec1c5bda99ac5d). ( void ) { return Conceptscxx . . $ TBox#Concepts..begincxx . . $ TNECollection#begin(4d22c310f101d92a).(); } |
| 320 | /// RW end() for concepts |
| 321 | c_iteratorcxx . . $ TBox#c_iterator# c_endcxx . . $ TBox#c_end(23ec1c5bda99ac5d). ( void ) { return Conceptscxx . . $ TBox#Concepts..endcxx . . $ TNECollection#end(4d22c310f101d92a).(); } |
| 322 | |
| 323 | /// RW begin() for individuals |
| 324 | i_iteratorcxx . . $ TBox#i_iterator# i_begincxx . . $ TBox#i_begin(78b5d4d1a9fb506d). ( void ) { return Individualscxx . . $ TBox#Individuals..begincxx . . $ TNECollection#begin(4d22c310f101d92a).(); } |
| 325 | /// RW end() for individuals |
| 326 | i_iteratorcxx . . $ TBox#i_iterator# i_endcxx . . $ TBox#i_end(78b5d4d1a9fb506d). ( void ) { return Individualscxx . . $ TBox#Individuals..endcxx . . $ TNECollection#end(4d22c310f101d92a).(); } |
| 327 | |
| 328 | //----------------------------------------------------------------------------- |
| 329 | //-- internal ensure*-like interface |
| 330 | //----------------------------------------------------------------------------- |
| 331 | |
| 332 | /// @return concept by given Named Entry ID |
| 333 | static TConceptcxx . . $ TConcept#* toConceptcxx . . $ TBox#toConcept(45d7b14406cbd318). ( TNamedEntrycxx . . $ TNamedEntry#* id ) { return static_cast<TConceptcxx . . $ TConcept#*>(id); } |
| 334 | /// @return concept by given Named Entry ID |
| 335 | static const TConceptcxx . . $ TConcept#* toConceptcxx . . $ TBox#toConcept(baa2beb1f5a1674). ( const TNamedEntrycxx . . $ TNamedEntry#* id ) { return static_cast<const TConceptcxx . . $ TConcept#*>(id); } |
| 336 | /// @return individual by given Named Entry ID |
| 337 | static TIndividualcxx . . $ TIndividual#* toIndividualcxx . . $ TBox#toIndividual(1199bc9a67399c68). ( TNamedEntrycxx . . $ TNamedEntry#* id ) { return static_cast<TIndividualcxx . . $ TIndividual#*>(id); } |
| 338 | /// @return individual by given Named Entry ID |
| 339 | static const TIndividualcxx . . $ TIndividual#* toIndividualcxx . . $ TBox#toIndividual(2f8995dada6a2043). ( const TNamedEntrycxx . . $ TNamedEntry#* id ) { return static_cast<const TIndividualcxx . . $ TIndividual#*>(id); } |
| 340 | |
| 341 | //----------------------------------------------------------------------------- |
| 342 | //-- internal BP-to-concept interface |
| 343 | //----------------------------------------------------------------------------- |
| 344 | |
| 345 | /// set P as a concept corresponding BP |
| 346 | void setBPforConceptcxx . . $ TBox#setBPforConcept(3d894be8bab7153d). ( BipolarPointercxx . . $ BipolarPointer# bp, TConceptcxx . . $ TConcept#* p ) |
| 347 | { |
| 348 | DLHeapcxx . . $ TBox#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).bp].setConceptcxx . . $ DLVertex#setConcept(69d9f70ea506b4a4).(p); |
| 349 | p->pNamecxx . . $ TConcept#pName. = bp; |
| 350 | } |
| 351 | |
| 352 | /// get concept by it's BP (non-const version) |
| 353 | TDataEntrycxx . . $ TDataEntry#* getDataEntryByBPcxx . . $ TBox#getDataEntryByBP(bea4ca33148edf2e). ( BipolarPointercxx . . $ BipolarPointer# bp ) |
| 354 | { |
| 355 | TDataEntrycxx . . $ TDataEntry#* p = static_cast<TDataEntrycxx . . $ TDataEntry#*>(DLHeapcxx . . $ TBox#DLHeap.[cxx . . $ DLDag#`operator[]`(e265d70853dfed20).bp].getConceptcxx . . $ DLVertex#getConcept(f3d19eb180c44c64).()); |
| 356 | fpp_assertcxx . . $ EFPPAssertion# ( p != nullptr ); |
| 357 | return p; |
| 358 | } |
| 359 | /// get concept by it's BP (const version) |
| 360 | const TDataEntrycxx . . $ TDataEntry#* getDataEntryByBPcxx . . $ TBox#getDataEntryByBP(8513d1ebfa7d4562). ( BipolarPointercxx . . $ BipolarPointer# bp ) const |
| 361 | { |
| 362 | const TDataEntrycxx . . $ TDataEntry#* p = static_cast<const TDataEntrycxx . . $ TDataEntry#*>(DLHeapcxx . . $ TBox#DLHeap.[cxx . . $ DLDag#`operator[]`(5fe3b8e96045ba2c).bp].getConceptcxx . . $ DLVertex#getConcept(1867504d72698304).()); |
| 363 | fpp_assertcxx . . $ EFPPAssertion#EFPPAssertion(85c52e162fed56f9). ( p != nullptr ); |
| 364 | return p; |
| 365 | } |
| 366 | |
| 367 | |
| 368 | //----------------------------------------------------------------------------- |
| 369 | //-- internal concept building interface |
| 370 | //----------------------------------------------------------------------------- |
| 371 | |
| 372 | /// checks if C is defined as C=D and set Synonyms accordingly |
| 373 | void checkEarlySynonymcxx . . $ TBox#checkEarlySynonym(3f0281ca3ae282d4). ( TConceptcxx . . $ TConcept#* C ) |
| 374 | { |
| 375 | if ( C->isSynonymcxx . . $ ClassifiableEntry#isSynonym(50ce9a9e25b4a850).() ) |
| 376 | return; // nothing to do |
| 377 | if ( C->isPrimitivecxx . . $ TConcept#isPrimitive(50ce9a9e25b4a850).() ) |
| 378 | return; // couldn't be a synonym |
| 379 | if ( !isCNcxx . . $ isCN(937bda690ff1bb73).(C->Descriptioncxx . . $ TConcept#Description.) ) |
| 380 | return; // complex expression -- not a synonym(imm.) |
| 381 | |
| 382 | C->setSynonymcxx . . $ ClassifiableEntry#setSynonym(866fbb357e35bef0).(getCIcxx . . $ TBox#getCI(a9db10ac0cf504ba).(C->Descriptioncxx . . $ TConcept#Description.)); |
| 383 | C->initToldSubsumerscxx . . $ TConcept#initToldSubsumers(49f6e7a06ebc5aa8).(); |
| 384 | } |
| 385 | /// make concept C non-primitive with definition DESC; @return it's old description |
| 386 | DLTreecxx . . $ DLTree#* makeNonPrimitivecxx . . $ TBox#makeNonPrimitive(1e45738bba157392). ( TConceptcxx . . $ TConcept#* C, DLTreecxx . . $ DLTree#* desc ) |
| 387 | { |
| 388 | DLTreecxx . . $ DLTree#* ret = C->makeNonPrimitivecxx . . $ TConcept#makeNonPrimitive(1bf715d485c1268).(desc); |
| 389 | checkEarlySynonymcxx . . $ TBox#checkEarlySynonym(3f0281ca3ae282d4).(C); |
| 390 | return ret; |
| 391 | } |
| 392 | |
| 393 | //----------------------------------------------------------------------------- |
| 394 | //-- support for n-ary predicates |
| 395 | //----------------------------------------------------------------------------- |
| 396 | |
| 397 | /// build a construction in the form AND (\neg q_i) |
| 398 | template <typename Iterator> |
| 399 | DLTreecxx . . $ DLTree#* buildDisjAuxcxx . . $ TBox#buildDisjAux(3ad5232b67752138). ( Iterator beg, Iterator end ) |
| 400 | { |
| 401 | DLTreecxx . . $ DLTree#* t = createTopcxx . . $ createTop(aa22cc08b69ae2ef).(); |
| 402 | for ( Iterator i = beg; i < end; ++i ) |
| 403 | t = createSNFAndcxx . . $ createSNFAnd(f2877343b7b69ea7). ( t, createSNFNotcxx . . $ createSNFNot(1bf715d485c1268).(clonecxx . . $ clone(ec41a33c52a5614b).(*i)) ); |
| 404 | return t; |
| 405 | } |
| 406 | /// process a disjoint set [beg,end) in a usual manner |
| 407 | template <typename Iterator> |
| 408 | void processDisjointcxx . . $ TBox#processDisjoint(249673c20e2b8d5). ( Iterator beg, Iterator end ) |
| 409 | { |
| 410 | for ( Iterator i = beg; i < end; ++i ) |
| 411 | addSubsumeAxiomcxx . . $ TBox#addSubsumeAxiom(4128fa2c78139db0). ( *i, buildDisjAuxcxx . . $ TBox#buildDisjAux(3ad5232b67752138). ( i+cxx . . $ operator+(a79ac10aefecd7d4).1, end ) ); |
| 412 | } |
| 413 | //----------------------------------------------------------------------------- |
| 414 | //-- internal DAG building methods |
| 415 | //----------------------------------------------------------------------------- |
| 416 | |
| 417 | /// build a DAG-structure for concepts and axioms |
| 418 | void buildDAGcxx . . $ TBox#buildDAG(49f6e7a06ebc5aa8). ( void ); |
| 419 | |
| 420 | /// translate concept P (together with definition) to DAG representation |
| 421 | void addConceptToHeapcxx . . $ TBox#addConceptToHeap(3f0281ca3ae282d4). ( TConceptcxx . . $ TConcept#* p ); |
| 422 | /// register data-related expression in the DAG; @return it's DAG index |
| 423 | BipolarPointercxx . . $ BipolarPointer# addDataExprToHeapcxx . . $ TBox#addDataExprToHeap(7391a4cac9a59a30). ( TDataEntrycxx . . $ TDataEntry#* p ); |
| 424 | /// builds DAG entry by general concept expression |
| 425 | BipolarPointercxx . . $ BipolarPointer# tree2dagcxx . . $ TBox#tree2dag(9508c6a8f13d6e3b). ( const DLTreecxx . . $ DLTree#* ); |
| 426 | /// create forall node (together with transitive sub-roles entries) |
| 427 | BipolarPointercxx . . $ BipolarPointer# forall2dagcxx . . $ TBox#forall2dag(53bf71045b2bebcc). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C ); |
| 428 | /// create atmost node (together with NN-rule entries) |
| 429 | BipolarPointercxx . . $ BipolarPointer# atmost2dagcxx . . $ TBox#atmost2dag(eddf04e77472431f). ( unsigned int n, const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C ); |
| 430 | /// create REFLEXIVE node |
| 431 | BipolarPointercxx . . $ BipolarPointer# reflexive2dagcxx . . $ TBox#reflexive2dag(67a8b55b30a79916). ( const TRolecxx . . $ TRole#* R ) |
| 432 | { |
| 433 | // input check: only simple roles are allowed in the reflexivity construction |
| 434 | if ( !R->isSimplecxx . . $ TRole#isSimple(50ce9a9e25b4a850).() ) |
| 435 | throw EFPPNonSimpleRolecxx . . $ EFPPNonSimpleRole#(Rcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).->getNamecxx . . $ TNamedEntry#getName(a9f41ea0e82d88cf).()); |
| 436 | return inversecxx . . $ inverse(7864480464b09eea). ( DLHeapcxx . . $ TBox#DLHeap..addcxx . . $ DLDag#add(b86a49c684080b5d). ( new DLVertexcxx . . $ DLVertex# ( dtIrrcxx . . $ dtIrr., R ) ) ); |
| 437 | } |
| 438 | /// create node for AND expression T |
| 439 | BipolarPointercxx . . $ BipolarPointer# and2dagcxx . . $ TBox#and2dag(9508c6a8f13d6e3b). ( const DLTreecxx . . $ DLTree#* t ); |
| 440 | /// add elements of T to and-like vertex V; @return true if clash occurs |
| 441 | bool fillANDVertexcxx . . $ TBox#fillANDVertex(764b05170664e007). ( DLVertexcxx . . $ DLVertex#* v, const DLTreecxx . . $ DLTree#* t ); |
| 442 | /// create forall node for data role |
| 443 | BipolarPointercxx . . $ BipolarPointer# dataForall2dagcxx . . $ TBox#dataForall2dag(53bf71045b2bebcc). ( const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C ) |
| 444 | { return DLHeapcxx . . $ TBox#DLHeap..addcxx . . $ DLDag#add(b86a49c684080b5d). ( new DLVertexcxx . . $ DLVertex#DLVertex(cb14fcc1b50645ce). ( dtForallcxx . . $ dtForall., 0, R, C ) ); } |
| 445 | /// create atmost node for data role |
| 446 | BipolarPointercxx . . $ BipolarPointer# dataAtMost2dagcxx . . $ TBox#dataAtMost2dag(eddf04e77472431f). ( unsigned int n, const TRolecxx . . $ TRole#* R, BipolarPointercxx . . $ BipolarPointer# C ) |
| 447 | { return DLHeapcxx . . $ TBox#DLHeap..addcxx . . $ DLDag#add(b86a49c684080b5d). ( new DLVertexcxx . . $ DLVertex# ( dtLEcxx . . $ dtLE., n, R, C ) ); } |
| 448 | /// @return a pointer to concept representation |
| 449 | BipolarPointercxx . . $ BipolarPointer# concept2dagcxx . . $ TBox#concept2dag(2f4043ddf2093eae). ( TConceptcxx . . $ TConcept#* p ) |
| 450 | { |
| 451 | if ( p == nullptr ) |
| 452 | return bpINVALIDcxx . . $ bpINVALID.; |
| 453 | if ( !isValidcxx . . $ isValid(83c267b20bac841a).(p->pNamecxx . . $ TConcept#pName.) ) |
| 454 | addConceptToHeapcxx . . $ TBox#addConceptToHeap(3f0281ca3ae282d4).(p); |
| 455 | return p->resolveIdcxx . . $ TConcept#resolveId(455f465bc33b4cdf).(); |
| 456 | } |
| 457 | |
| 458 | //----------------------------------------------------------------------------- |
| 459 | //-- internal parser (input) interface |
| 460 | //----------------------------------------------------------------------------- |
| 461 | |
| 462 | /// set the flag that forbid usage of undefined names for concepts/roles; @return old value |
| 463 | bool setForbidUndefinedNamescxx . . $ TBox#setForbidUndefinedNames(efaadfb7dc14930a). ( bool val ) |
| 464 | { |
| 465 | ORMcxx . . $ TBox#ORM..setUndefinedNamescxx . . $ RoleMaster#setUndefinedNames(b45ddcbc8423892c).(!val); |
| 466 | DRMcxx . . $ TBox#DRM..setUndefinedNamescxx . . $ RoleMaster#setUndefinedNames(b45ddcbc8423892c).(!val); |
| 467 | Individualscxx . . $ TBox#Individuals..setLockedcxx . . $ TNECollection#setLocked(efaadfb7dc14930a).(val); |
| 468 | return Conceptscxx . . $ TBox#Concepts..setLockedcxx . . $ TNECollection#setLocked(efaadfb7dc14930a).(val); |
| 469 | } |
| 470 | /// tries to apply axiom C [= CN; @return NULL if applicable or new CN |
| 471 | DLTreecxx . . $ DLTree#* applyAxiomCToCNcxx . . $ TBox#applyAxiomCToCN(f2877343b7b69ea7). ( DLTreecxx . . $ DLTree#* C, DLTreecxx . . $ DLTree#* CN ); |
| 472 | /// tries to apply axiom CN [= C; @return NULL if applicable or new CN |
| 473 | DLTreecxx . . $ DLTree#* applyAxiomCNToCcxx . . $ TBox#applyAxiomCNToC(f2877343b7b69ea7). ( DLTreecxx . . $ DLTree#* CN, DLTreecxx . . $ DLTree#* C ); |
| 474 | /// tries to add C = RHS for the concept C; @return true if OK |
| 475 | bool addNonprimitiveDefinitioncxx . . $ TBox#addNonprimitiveDefinition(139e67a379f4bc6e). ( TConceptcxx . . $ TConcept#* C, DLTreecxx . . $ DLTree#* rhs ); |
| 476 | /// tries to add C = RHS for the concept C [= X; @return true if OK |
| 477 | bool switchToNonprimitivecxx . . $ TBox#switchToNonprimitive(139e67a379f4bc6e). ( TConceptcxx . . $ TConcept#* C, DLTreecxx . . $ DLTree#* rhs ); |
| 478 | /// transform definition C=D' with C [= E into C [= (D' and E) with D [= C |
| 479 | /// D is usually D', but see addSubsumeForDefined() |
| 480 | void makeDefinitionPrimitivecxx . . $ TBox#makeDefinitionPrimitive(12a9e5ce3420c48d). ( TConceptcxx . . $ TConcept#* C, DLTreecxx . . $ DLTree#* E, DLTreecxx . . $ DLTree#* D ) |
| 481 | { |
| 482 | C->setPrimitivecxx . . $ TConcept#setPrimitive(49f6e7a06ebc5aa8).(); // now we have C [= D' |
| 483 | C->addDesccxx . . $ TConcept#addDesc(edf821a2fc5509f9).(E); // here C [= (D' and E) |
| 484 | C->initToldSubsumerscxx . . $ TConcept#initToldSubsumers(49f6e7a06ebc5aa8).(); |
| 485 | // all we need is to add (old C's desc)D [= C |
| 486 | addSubsumeAxiomcxx . . $ TBox#addSubsumeAxiom(237c04ede5740138). ( D, getTreecxx . . $ TBox#getTree(8f1a6b264b733ed7).(C) ); |
| 487 | } |
| 488 | |
| 489 | // for complex Concept operations |
| 490 | /// try to absorb GCI C[=D; if not possible, just record this GCI |
| 491 | void processGCIcxx . . $ TBox#processGCI(237c04ede5740138). ( DLTreecxx . . $ DLTree#* C, DLTreecxx . . $ DLTree#* D ) { Axiomscxx . . $ TBox#Axioms..addAxiomcxx . . $ TAxiomSet#addAxiom(237c04ede5740138). ( C, D ); } |
| 492 | |
| 493 | // recognize Range/Domain restriction in an axiom and transform it into role R&D. |
| 494 | // return true if transformation was performed |
| 495 | bool axiomToRangeDomaincxx . . $ TBox#axiomToRangeDomain(2458d46d5fbf19d5). ( DLTreecxx . . $ DLTree#* l, DLTreecxx . . $ DLTree#* r ); |
| 496 | |
| 497 | /// @return true if BP represents a named entry in a DAG |
| 498 | bool isNamedConceptcxx . . $ TBox#isNamedConcept(4a668f6de69bf818). ( BipolarPointercxx . . $ BipolarPointer# bp ) const |
| 499 | { |
| 500 | DagTagcxx . . $ DagTag# tag = DLHeapcxx . . $ TBox#DLHeap.[cxx . . $ DLDag#`operator[]`(5fe3b8e96045ba2c).bp].Typecxx . . $ DLVertexTagDFS#Type(d9c59f5f195b46b8).(); |
| 501 | return isCNameTagcxx . . $ isCNameTag(7b512e7165d9f2af).(tag) || tag == dtDataTypecxx . . $ dtDataType. || tag == dtDataValuecxx . . $ dtDataValue.; |
| 502 | } |
| 503 | |
| 504 | /// get aux concept obtained from C=\AR.~D by forall replacement |
| 505 | TConceptcxx . . $ TConcept#* getRCCachecxx . . $ TBox#getRCCache(87b5a9ed25249735). ( const DLTreecxx . . $ DLTree#* C ) const |
| 506 | { |
| 507 | for ( TRCCachecxx . . $ TBox#TRCCache#::const_iteratorcxx . . $ std/vector#const_iterator# p = RCCachecxx . . $ TBox#RCCache..begincxx . . $ std/vector#begin(359ca5030082c9f).(), p_end = RCCachecxx . . $ TBox#RCCache..endcxx . . $ std/vector#end(359ca5030082c9f).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 508 | if ( equalTreescxx . . $ equalTrees(d3c03bdc42525896). ( C, p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).firstcxx . . $ std/pair#first. ) ) |
| 509 | return p->cxx . . $ __gnu_cxx/__normal_iterator#`operator->`(a68f0626e749d9f6).secondcxx . . $ std/pair#second.; |
| 510 | return nullptr; |
| 511 | } |
| 512 | /// add CN as a cache entry for C=\AR.~D> |
| 513 | void setRCCachecxx . . $ TBox#setRCCache(c9a684c58d5a1e4b). ( DLTreecxx . . $ DLTree#* C, TConceptcxx . . $ TConcept#* CN ) { RCCachecxx . . $ TBox#RCCache..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(C,CN)); } |
| 514 | |
| 515 | /// check if TBox contains too many GCIs to switch strategy |
| 516 | bool isGalenLikeTBoxcxx . . $ TBox#isGalenLikeTBox(50ce9a9e25b4a850). ( void ) const { return isLikeGALENcxx . . $ TBox#isLikeGALEN.; } |
| 517 | /// check if TBox contains too many nominals and GCIs to switch strategy |
| 518 | bool isWineLikeTBoxcxx . . $ TBox#isWineLikeTBox(50ce9a9e25b4a850). ( void ) const { return isLikeWINEcxx . . $ TBox#isLikeWINE.; } |
| 519 | |
| 520 | //----------------------------------------------------------------------------- |
| 521 | //-- internal preprocessing methods |
| 522 | //----------------------------------------------------------------------------- |
| 523 | |
| 524 | /// build a roles taxonomy and a DAG |
| 525 | void Preprocesscxx . . $ TBox#Preprocess(49f6e7a06ebc5aa8). ( void ); |
| 526 | /// transform C [= D with C = E into GCIs |
| 527 | void TransformExtraSubsumptionscxx . . $ TBox#TransformExtraSubsumptions(49f6e7a06ebc5aa8). ( void ); |
| 528 | /// absorb all axioms |
| 529 | void AbsorbAxiomscxx . . $ TBox#AbsorbAxioms(49f6e7a06ebc5aa8). ( void ) |
| 530 | { |
| 531 | unsigned int nSynonyms = countSynonymscxx . . $ TBox#countSynonyms(ddd8539a2fcdd4ce).(); |
| 532 | Axiomscxx . . $ TBox#Axioms..absorbcxx . . $ TAxiomSet#absorb(f708dce9a8856c70).(); |
| 533 | if ( countSynonymscxx . . $ TBox#countSynonyms(ddd8539a2fcdd4ce).() > nSynonyms ) |
| 534 | replaceAllSynonymscxx . . $ TBox#replaceAllSynonyms(49f6e7a06ebc5aa8).(); |
| 535 | if ( Axiomscxx . . $ TBox#Axioms..wasRoleAbsorptionAppliedcxx . . $ TAxiomSet#wasRoleAbsorptionApplied(50ce9a9e25b4a850).() ) |
| 536 | initToldSubsumerscxx . . $ TBox#initToldSubsumers(49f6e7a06ebc5aa8).(); |
| 537 | } |
| 538 | |
| 539 | /// pre-process RELATED axioms: resolve synonyms, mark individuals as related |
| 540 | void preprocessRelatedcxx . . $ TBox#preprocessRelated(49f6e7a06ebc5aa8). ( void ); |
| 541 | /// determine all sorts in KB (make job only for SORTED_REASONING) |
| 542 | void determineSortscxx . . $ TBox#determineSorts(49f6e7a06ebc5aa8). ( void ); |
| 543 | |
| 544 | /// calculate statistic for DAG and Roles |
| 545 | void CalculateStatisticcxx . . $ TBox#CalculateStatistic(49f6e7a06ebc5aa8). ( void ); |
| 546 | /// Remove DLTree* from TConcept after DAG is constructed |
| 547 | void RemoveExtraDescriptionscxx . . $ TBox#RemoveExtraDescriptions(49f6e7a06ebc5aa8). ( void ); |
| 548 | |
| 549 | /// init Range and Domain for all roles of RM; sets hasGCI if R&D was found |
| 550 | void initRangeDomaincxx . . $ TBox#initRangeDomain(c1024d870f8578d8). ( RoleMastercxx . . $ RoleMaster#& RM ); |
| 551 | |
| 552 | /// set told TOP concept whether necessary |
| 553 | void initToldSubsumerscxx . . $ TBox#initToldSubsumers(49f6e7a06ebc5aa8). ( void ) |
| 554 | { |
| 555 | for ( c_iteratorcxx . . $ TBox#c_iterator# pc = c_begincxx . . $ TBox#c_begin(23ec1c5bda99ac5d).(); pc !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). c_endcxx . . $ TBox#c_end(23ec1c5bda99ac5d).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pc ) |
| 556 | if ( !(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pc)->isSynonymcxx . . $ ClassifiableEntry#isSynonym(50ce9a9e25b4a850).() ) |
| 557 | (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pc)->initToldSubsumerscxx . . $ TConcept#initToldSubsumers(49f6e7a06ebc5aa8).(); |
| 558 | for ( i_iteratorcxx . . $ TBox#i_iterator# pi = i_begincxx . . $ TBox#i_begin(78b5d4d1a9fb506d).(); pi !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). i_endcxx . . $ TBox#i_end(78b5d4d1a9fb506d).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pi ) |
| 559 | if ( !(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pi)->isSynonymcxx . . $ ClassifiableEntry#isSynonym(50ce9a9e25b4a850).() ) |
| 560 | (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pi)->initToldSubsumerscxx . . $ TIndividual#initToldSubsumers(49f6e7a06ebc5aa8).(); |
| 561 | } |
| 562 | /// set told TOP concept whether necessary |
| 563 | void setToldTopcxx . . $ TBox#setToldTop(49f6e7a06ebc5aa8). ( void ) |
| 564 | { |
| 565 | for ( c_iteratorcxx . . $ TBox#c_iterator# pc = c_begincxx . . $ TBox#c_begin(23ec1c5bda99ac5d).(); pc !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). c_endcxx . . $ TBox#c_end(23ec1c5bda99ac5d).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pc ) |
| 566 | (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pc)->setToldTopcxx . . $ TConcept#setToldTop(3f0281ca3ae282d4).(pTopcxx . . $ TBox#pTop.); |
| 567 | for ( i_iteratorcxx . . $ TBox#i_iterator# pi = i_begincxx . . $ TBox#i_begin(78b5d4d1a9fb506d).(); pi !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). i_endcxx . . $ TBox#i_end(78b5d4d1a9fb506d).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pi ) |
| 568 | (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pi)->setToldTopcxx . . $ TConcept#setToldTop(3f0281ca3ae282d4).(pTopcxx . . $ TBox#pTop.); |
| 569 | } |
| 570 | /// calculate TS depth for all concepts |
| 571 | void calculateTSDepthcxx . . $ TBox#calculateTSDepth(49f6e7a06ebc5aa8). ( void ) |
| 572 | { |
| 573 | for ( c_iteratorcxx . . $ TBox#c_iterator# pc = c_begincxx . . $ TBox#c_begin(23ec1c5bda99ac5d).(); pc !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). c_endcxx . . $ TBox#c_end(23ec1c5bda99ac5d).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pc ) |
| 574 | (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pc)->calculateTSDepthcxx . . $ TConcept#calculateTSDepth(db52760e79bf9054).(); |
| 575 | for ( i_iteratorcxx . . $ TBox#i_iterator# pi = i_begincxx . . $ TBox#i_begin(78b5d4d1a9fb506d).(); pi !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). i_endcxx . . $ TBox#i_end(78b5d4d1a9fb506d).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pi ) |
| 576 | (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pi)->calculateTSDepthcxx . . $ TConcept#calculateTSDepth(db52760e79bf9054).(); |
| 577 | } |
| 578 | |
| 579 | /// find referential cycles (like A [= (and B C), B [= A) and transform them to synonyms (B=A, A[=C) |
| 580 | void transformToldCyclescxx . . $ TBox#transformToldCycles(49f6e7a06ebc5aa8). ( void ); |
| 581 | /// check if P appears in referential cycle; |
| 582 | /// @return concept which creates cycle, NULL if no such concept exists. |
| 583 | TConceptcxx . . $ TConcept#* checkToldCyclecxx . . $ TBox#checkToldCycle(2463a09a87430b75). ( TConceptcxx . . $ TConcept#* p ); |
| 584 | /// transform i [= C [= j into i=C=j for i,j nominals |
| 585 | void transformSingletonHierarchycxx . . $ TBox#transformSingletonHierarchy(49f6e7a06ebc5aa8). ( void ); |
| 586 | /// make P and all its non-singleton parents synonyms to its singleton parent; @return that singleton |
| 587 | TIndividualcxx . . $ TIndividual#* transformSingletonWithSPcxx . . $ TBox#transformSingletonWithSP(38385e3551a319c2). ( TConceptcxx . . $ TConcept#* p ); |
| 588 | /// helper to the previous function |
| 589 | TIndividualcxx . . $ TIndividual#* getSPForConceptcxx . . $ TBox#getSPForConcept(38385e3551a319c2). ( TConceptcxx . . $ TConcept#* p ); |
| 590 | |
| 591 | /// @return true if C is referenced in TREE; use PROCESSED to record explored names |
| 592 | bool isReferencedcxx . . $ TBox#isReferenced(98b03190f111a09d). ( TConceptcxx . . $ TConcept#* C, DLTreecxx . . $ DLTree#* tree, ConceptSetcxx . . $ TBox#ConceptSet#& processed ) const; |
| 593 | /// @return true if C is referenced in the definition of concept D; use PROCESSED to record explored names |
| 594 | bool isReferencedcxx . . $ TBox#isReferenced(301dea6fb175ea62). ( TConceptcxx . . $ TConcept#* C, TConceptcxx . . $ TConcept#* D, ConceptSetcxx . . $ TBox#ConceptSet#& processed ) const |
| 595 | { |
| 596 | // mark D as processed |
| 597 | processed.insertcxx . . $ std/set#insert(411a10a755068dfe).(D); |
| 598 | // check the description of D |
| 599 | if ( D->Descriptioncxx . . $ TConcept#Description. == nullptr ) |
| 600 | return false; |
| 601 | if ( isReferencedcxx . . $ TBox#isReferenced(98b03190f111a09d). ( C, D->Descriptioncxx . . $ TConcept#Description., processed ) ) |
| 602 | return true; |
| 603 | // we are done for primitive concepts |
| 604 | if ( D->isPrimitivecxx . . $ TConcept#isPrimitive(50ce9a9e25b4a850).() ) |
| 605 | return false; |
| 606 | // check if D has an extra description |
| 607 | auto p = ExtraConceptDefscxx . . $ TBox#ExtraConceptDefs..findcxx . . $ std/map#find(7b3585bb5da8f7d).(D); |
| 608 | if ( p !=cxx . . $ std/`operator!=`(7e1308a0738ea758). ExtraConceptDefscxx . . $ TBox#ExtraConceptDefs..endcxx . . $ std/map#end(646659518938a4d6).() ) |
| 609 | return isReferencedcxx . . $ TBox#isReferenced(98b03190f111a09d). ( C, p->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(1016ee5406d91ab9).secondcxx . . $ std/pair#second., processed ); |
| 610 | return false; |
| 611 | } |
| 612 | |
| 613 | /// @return number of synonyms in the KB |
| 614 | unsigned int countSynonymscxx . . $ TBox#countSynonyms(ddd8539a2fcdd4ce). ( void ) const |
| 615 | { |
| 616 | unsigned int nSynonyms = 0; |
| 617 | for ( c_const_iteratorcxx . . $ TBox#c_const_iterator# pc = c_begincxx . . $ TBox#c_begin(b45ca211050fca7).(); pc !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). c_endcxx . . $ TBox#c_end(b45ca211050fca7).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pc ) |
| 618 | if ( (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pc)->isSynonymcxx . . $ ClassifiableEntry#isSynonym(50ce9a9e25b4a850).() ) |
| 619 | ++nSynonyms; |
| 620 | |
| 621 | for ( i_const_iteratorcxx . . $ TBox#i_const_iterator# pi = i_begincxx . . $ TBox#i_begin(80d9d5fe67f36f59).(); pi !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). i_endcxx . . $ TBox#i_end(80d9d5fe67f36f59).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pi ) |
| 622 | if ( (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pi)->isSynonymcxx . . $ ClassifiableEntry#isSynonym(50ce9a9e25b4a850).() ) |
| 623 | ++nSynonyms; |
| 624 | return nSynonyms; |
| 625 | } |
| 626 | /// replace all synonyms in concept descriptions with their definitions |
| 627 | void replaceAllSynonymscxx . . $ TBox#replaceAllSynonyms(49f6e7a06ebc5aa8). ( void ); |
| 628 | |
| 629 | /// init Extra Rule field in concepts given by a vector V with a given INDEX |
| 630 | inline void |
| 631 | initRuleFieldscxx . . $ TBox#initRuleFields(9bcfa4d1c5e5b6cd). ( const ConceptVectorcxx . . $ TBox#ConceptVector#& v, size_tcxx . . $ size_t# index ) const |
| 632 | { |
| 633 | for ( ConceptVectorcxx . . $ TBox#ConceptVector#::const_iteratorcxx . . $ std/vector#const_iterator# q = v.begincxx . . $ std/vector#begin(359ca5030082c9f).(), q_end = v.endcxx . . $ std/vector#end(359ca5030082c9f).(); q <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). q_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).q ) |
| 634 | (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q)->addExtraRulecxx . . $ TConcept#addExtraRule(2c44cd906ae4e829).(index); |
| 635 | } |
| 636 | /// mark all concepts wrt their classification tag |
| 637 | void fillsClassificationTagcxx . . $ TBox#fillsClassificationTag(49f6e7a06ebc5aa8). ( void ) |
| 638 | { |
| 639 | for ( c_const_iteratorcxx . . $ TBox#c_const_iterator# pc = c_begincxx . . $ TBox#c_begin(23ec1c5bda99ac5d).(); pc !=cxx . . $ __gnu_cxx/`operator!=`(9b2ee563b24e7156). c_endcxx . . $ TBox#c_end(23ec1c5bda99ac5d).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pc ) |
| 640 | (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pc)->getClassTagcxx . . $ TConcept#getClassTag(9839f985a220c015).(); |
| 641 | for ( i_const_iteratorcxx . . $ TBox#i_const_iterator# pi = i_begincxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(ea0f1a22ba5f21a0).(); pi !=cxx . . $ __gnu_cxx/`operator!=`(9b2ee563b24e7156). i_endcxx . . $ TBox#i_end(78b5d4d1a9fb506d).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pi ) |
| 642 | (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pi)->getClassTagcxx . . $ TConcept#getClassTag(9839f985a220c015).(); |
| 643 | } |
| 644 | /// set new concept index for given C wrt existing nC |
| 645 | void setConceptIndexcxx . . $ TBox#setConceptIndex(3f0281ca3ae282d4). ( TConceptcxx . . $ TConcept#* C ) |
| 646 | { |
| 647 | C->setIndexcxx . . $ ClassifiableEntry#setIndex(cb2f890c2fdad230).(nCcxx . . $ TBox#nC.); |
| 648 | ConceptMapcxx . . $ TBox#ConceptMap..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(C); |
| 649 | ++nCcxx . . $ TBox#nC.; |
| 650 | } |
| 651 | /// set index on all classifiable entries |
| 652 | void setAllIndexescxx . . $ TBox#setAllIndexes(49f6e7a06ebc5aa8). ( void ); |
| 653 | |
| 654 | //----------------------------------------------------------------------------- |
| 655 | //-- internal reasoner-related interface |
| 656 | //----------------------------------------------------------------------------- |
| 657 | |
| 658 | /// @return true iff reasoners were initialised |
| 659 | bool reasonersInitedcxx . . $ TBox#reasonersInited(50ce9a9e25b4a850). ( void ) const { return stdReasonercxx . . $ TBox#stdReasoner. != nullptr; } |
| 660 | /// get RW reasoner wrt nominal case |
| 661 | DlSatTestercxx . . $ DlSatTester#* getReasonercxx . . $ TBox#getReasoner(975d19aa5547cabb). ( void ) |
| 662 | { |
| 663 | fpp_assertcxx . . $ TBox#curFeature. ( curFeature != nullptr ); |
| 664 | if ( curFeaturecxx . . $ TBox#curFeature.->hasSingletonscxx . . $ LogicFeatures#hasSingletons(50ce9a9e25b4a850).() ) |
| 665 | return nomReasonercxx . . $ TBox#nomReasoner.; |
| 666 | else |
| 667 | return stdReasonercxx . . $ TBox#stdReasoner.; |
| 668 | } |
| 669 | /// get RO reasoner wrt nominal case |
| 670 | const DlSatTestercxx . . $ DlSatTester#* getReasonercxx . . $ TBox#getReasoner(e761467fb66e6cec). ( void ) const |
| 671 | { |
| 672 | fpp_assertcxx . . $ TBox#curFeature. ( curFeature != nullptr ); |
| 673 | if ( curFeaturecxx . . $ TBox#curFeature.->hasSingletonscxx . . $ LogicFeatures#hasSingletons(50ce9a9e25b4a850).() ) |
| 674 | return nomReasonercxx . . $ TBox#nomReasoner.; |
| 675 | else |
| 676 | return stdReasonercxx . . $ TBox#stdReasoner.; |
| 677 | } |
| 678 | /// check whether KB is consistent; @return true if it is |
| 679 | bool performConsistencyCheckcxx . . $ TBox#performConsistencyCheck(c9857a73d68e59ba). ( void ); // implemented in Reasoner.h |
| 680 | |
| 681 | //----------------------------------------------------------------------------- |
| 682 | //-- internal reasoning interface |
| 683 | //----------------------------------------------------------------------------- |
| 684 | |
| 685 | /// init reasoning service: create reasoner(s) |
| 686 | void initReasonercxx . . $ TBox#initReasoner(49f6e7a06ebc5aa8). ( void ); // implemented in Reasoner.h |
| 687 | /// init taxonomy and classifier |
| 688 | void initTaxonomycxx . . $ TBox#initTaxonomy(49f6e7a06ebc5aa8). ( void ); // implemented in DLConceptTaxonomy.h |
| 689 | /// set NameSigMap |
| 690 | void setNameSigMapcxx . . $ TBox#setNameSigMap(ce42f3253444d58f). ( NameSigMapcxx . . $ TBox#NameSigMap#* p ) { pName2Sigcxx . . $ TBox#pName2Sig. = p; } |
| 691 | /// creating taxonomy for given TBox; include individuals if necessary |
| 692 | void createTaxonomycxx . . $ TBox#createTaxonomy(b45ddcbc8423892c). ( bool needIndividuals ); |
| 693 | /// partition all elements in [begin,end) range wtr their tags |
| 694 | template <typename Iterator> |
| 695 | unsigned int fillArrayscxx . . $ TBox#fillArrays(7aec5fd617a6aa65). ( Iterator begin, Iterator end ) |
| 696 | { |
| 697 | unsigned int n = 0; |
| 698 | for ( Iterator p = begin; p < end; ++p ) |
| 699 | { |
| 700 | if ( (*p)->isNonClassifiable() ) |
| 701 | continue; |
| 702 | ++n; |
| 703 | switch ( (*p)->getClassTag() ) |
| 704 | { |
| 705 | case cttTrueCompletelyDefinedcxx . . $ cttTrueCompletelyDefined.: |
| 706 | arrayCDcxx . . $ TBox#arrayCD..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(*p); |
| 707 | break; |
| 708 | default: |
| 709 | arrayNoCDcxx . . $ TBox#arrayNoCD..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(*p); |
| 710 | break; |
| 711 | case cttNonPrimitivecxx . . $ cttNonPrimitive.: |
| 712 | case cttHasNonPrimitiveTScxx . . $ cttHasNonPrimitiveTS.: |
| 713 | arrayNPcxx . . $ TBox#arrayNP..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(*p); |
| 714 | break; |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | return n; |
| 719 | } |
| 720 | /// classify all concepts from given COLLECTION with given CD value |
| 721 | void classifyConceptscxx . . $ TBox#classifyConcepts(cccdbcffc97ee4ec). ( const ConceptVectorcxx . . $ TBox#ConceptVector#& collection, bool curCompletelyDefined, const char* type ); |
| 722 | /// classify single concept |
| 723 | void classifyEntrycxx . . $ TBox#classifyEntry(3f0281ca3ae282d4). ( TConceptcxx . . $ TConcept#* entry ); |
| 724 | |
| 725 | //----------------------------------------------------------------------------- |
| 726 | //-- internal cache-related methods |
| 727 | //----------------------------------------------------------------------------- |
| 728 | |
| 729 | /// init const cache for either bpTOP or bpBOTTOM |
| 730 | void initConstCachecxx . . $ TBox#initConstCache(d4f767463ce0a6b3). ( BipolarPointercxx . . $ BipolarPointer# p ) { DLHeapcxx . . $ TBox#DLHeap..setCachecxx . . $ DLDag#setCache(5d5e965ff81adf26). ( p, createConstCachecxx . . $ createConstCache(b04ec3060c58d05c).(p) ); } |
| 731 | /// init [singleton] cache for given concept and polarity |
| 732 | void initSingletonCachecxx . . $ TBox#initSingletonCache(f6c6a24de40d17e0). ( const TConceptcxx . . $ TConcept#* p, bool pos ) |
| 733 | { DLHeapcxx . . $ TBox#DLHeap..setCachecxx . . $ DLDag#setCache(5d5e965ff81adf26). ( createBiPointercxx . . $ createBiPointer(d455ce14f374a3ab).(p->pNamecxx . . $ TConcept#pName.,pos), new modelCacheSingletoncxx . . $ modelCacheSingleton#(createBiPointercxx . . $ createBiPointer(655f523120ea3b6c).(p->indexcxx . . $ ClassifiableEntry#index(ddd8539a2fcdd4ce).(),pos)) ); } |
| 734 | /// create cache for ~C where C is a primitive concept (as it is simple) |
| 735 | void buildSimpleCachecxx . . $ TBox#buildSimpleCache(49f6e7a06ebc5aa8). ( void ); |
| 736 | |
| 737 | //----------------------------------------------------------------------------- |
| 738 | //-- internal output helper methods |
| 739 | //----------------------------------------------------------------------------- |
| 740 | |
| 741 | void PrintDagEntrycxx . . $ TBox#PrintDagEntry(94fe421b246ddbdb). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o, BipolarPointercxx . . $ BipolarPointer# p ) const; |
| 742 | /// print one concept-like entry |
| 743 | void PrintConceptcxx . . $ TBox#PrintConcept(2c84f40513d9abdd). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o, const TConceptcxx . . $ TConcept#* p ) const; |
| 744 | /// print all registered concepts |
| 745 | void PrintConceptscxx . . $ TBox#PrintConcepts(490063bd7e6d8d5d). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) const |
| 746 | { |
| 747 | if ( Conceptscxx . . $ TBox#Concepts..sizecxx . . $ TNECollection#size(fe4d2d262d4164a8).() == 0 ) |
| 748 | return; |
| 749 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Concepts (" <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). Conceptscxx . . $ TBox#Concepts..sizecxx . . $ TNECollection#size(fe4d2d262d4164a8).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "):\n"; |
| 750 | for ( c_const_iteratorcxx . . $ TBox#c_const_iterator# pc = c_begincxx . . $ TBox#c_begin(b45ca211050fca7).(); pc !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). c_endcxx . . $ TBox#c_end(b45ca211050fca7).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pc ) |
| 751 | PrintConceptcxx . . $ TBox#PrintConcept(2c84f40513d9abdd).(o,*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pc); |
| 752 | } |
| 753 | /// print all registered individuals |
| 754 | void PrintIndividualscxx . . $ TBox#PrintIndividuals(490063bd7e6d8d5d). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) const |
| 755 | { |
| 756 | if ( Individualscxx . . $ TBox#Individuals..sizecxx . . $ TNECollection#size(fe4d2d262d4164a8).() == 0 ) |
| 757 | return; |
| 758 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Individuals (" <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). Individualscxx . . $ TBox#Individuals..sizecxx . . $ TNECollection#size(fe4d2d262d4164a8).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "):\n"; |
| 759 | for ( i_const_iteratorcxx . . $ TBox#i_const_iterator# pi = i_begincxx . . $ TBox#i_begin(80d9d5fe67f36f59).(); pi !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). i_endcxx . . $ TBox#i_end(80d9d5fe67f36f59).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pi ) |
| 760 | PrintConceptcxx . . $ TBox#PrintConcept(2c84f40513d9abdd).(o,*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pi); |
| 761 | } |
| 762 | void PrintSimpleRulescxx . . $ TBox#PrintSimpleRules(490063bd7e6d8d5d). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) const |
| 763 | { |
| 764 | if ( SimpleRulescxx . . $ TBox#SimpleRules..emptycxx . . $ std/vector#empty(50ce9a9e25b4a850).() ) |
| 765 | return; |
| 766 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Simple rules (" <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). SimpleRulescxx . . $ TBox#SimpleRules..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "):\n"; |
| 767 | for ( TSimpleRulescxx . . $ TBox#TSimpleRules#::const_iteratorcxx . . $ std/vector#const_iterator# p = SimpleRulescxx . . $ TBox#SimpleRules..begincxx . . $ std/vector#begin(359ca5030082c9f).(); p <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). SimpleRulescxx . . $ TBox#SimpleRules..endcxx . . $ std/vector#end(359ca5030082c9f).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 768 | { |
| 769 | ConceptVectorcxx . . $ TBox#ConceptVector#::const_iteratorcxx . . $ std/vector#const_iterator# q = (cxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(ea0f1a22ba5f21a0).*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p)->Bodycxx . . $ TBox#TSimpleRule#Body..begincxx . . $ std/vector#begin(33b10a496a38335b).(), q_end = (cxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(ea0f1a22ba5f21a0).*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p)->Bodycxx . . $ TBox#TSimpleRule#Body..endcxx . . $ std/vector#end(33b10a496a38335b).(); |
| 770 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "(" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q)->getNamecxx . . $ TNamedEntry#getName(a9f41ea0e82d88cf).(); |
| 771 | while ( ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).q <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). q_end ) |
| 772 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q)->getNamecxx . . $ TNamedEntry#getName(a9f41ea0e82d88cf).(); |
| 773 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ") => " <<cxx . . $ `operator<<`(607b78f3c31ebc02). (*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p)->tHeadcxx . . $ TBox#TSimpleRule#tHead. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 774 | } |
| 775 | } |
| 776 | void PrintAxiomscxx . . $ TBox#PrintAxioms(490063bd7e6d8d5d). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) const |
| 777 | { |
| 778 | if ( T_Gcxx . . $ TBox#T_G. == bpTOPcxx . . $ bpTOP. ) |
| 779 | return; |
| 780 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Axioms:\nT [="; |
| 781 | PrintDagEntrycxx . . $ TBox#PrintDagEntry(94fe421b246ddbdb). ( o, T_Gcxx . . $ TBox#T_G. ); |
| 782 | } |
| 783 | /// print KB features to LL |
| 784 | void printFeaturescxx . . $ TBox#printFeatures(83f5f38750778ac8). ( void ) const; |
| 785 | |
| 786 | //----------------------------------------------------------------------------- |
| 787 | //-- save/load support; implementation in SaveLoad.cpp |
| 788 | //----------------------------------------------------------------------------- |
| 789 | |
| 790 | //----------------------------------------------------------------------------- |
| 791 | //-- internal relevance helper methods |
| 792 | //----------------------------------------------------------------------------- |
| 793 | /// is given concept relevant wrt current TBox |
| 794 | bool isRelevantcxx . . $ TBox#isRelevant(b352c686bfa4bc3f). ( const TConceptcxx . . $ TConcept#* p ) const { return p->isRelevantcxx . . $ TConcept#isRelevant(cb76649e174af24).(relevancecxx . . $ TBox#relevance.); } |
| 795 | /// set given concept relevant wrt current TBox |
| 796 | void setRelevant1cxx . . $ TBox#setRelevant1(3f0281ca3ae282d4). ( TConceptcxx . . $ TConcept#* p ); |
| 797 | /// set given concept relevant wrt current TBox if not checked yet |
| 798 | void setRelevantcxx . . $ TBox#setRelevant(3f0281ca3ae282d4). ( TConceptcxx . . $ TConcept#* p ) { if ( !isRelevantcxx . . $ TBox#isRelevant(b352c686bfa4bc3f).(p) ) setRelevant1cxx . . $ TBox#setRelevant1(3f0281ca3ae282d4).(p); } |
| 799 | |
| 800 | /// is given role relevant wrt current TBox |
| 801 | bool isRelevantcxx . . $ TBox#isRelevant(81d69a9c8508a392). ( const TRolecxx . . $ TRole#* p ) const { return p->isRelevantcxx . . $ TRole#isRelevant(cb76649e174af24).(relevancecxx . . $ TBox#relevance.); } |
| 802 | /// set given role relevant wrt current TBox |
| 803 | void setRelevant1cxx . . $ TBox#setRelevant1(3d6e099a537f0595). ( TRolecxx . . $ TRole#* p ); |
| 804 | /// set given role relevant wrt current TBox if not checked yet |
| 805 | void setRelevantcxx . . $ TBox#setRelevant(3d6e099a537f0595). ( TRolecxx . . $ TRole#* p ) |
| 806 | { |
| 807 | if ( ( likelycxx . . $ `Kernel/globaldef.h:28:10`!(p->getId() != 0) || p->isTopcxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).() ) && !isRelevantcxx . . $ TBox#isRelevant(81d69a9c8508a392).(p) ) |
| 808 | setRelevant1cxx . . $ TBox#setRelevant1(3d6e099a537f0595).(p); |
| 809 | } |
| 810 | |
| 811 | /// set given DAG entry relevant wrt current TBox |
| 812 | void setRelevantcxx . . $ TBox#setRelevant(d4f767463ce0a6b3). ( BipolarPointercxx . . $ BipolarPointer# p ); |
| 813 | |
| 814 | /// gather information about logical features of relevant concept |
| 815 | void collectLogicFeaturecxx . . $ TBox#collectLogicFeature(d1b1787efb22fc2d). ( const TConceptcxx . . $ TConcept#* p ) const |
| 816 | { |
| 817 | if ( curFeaturecxx . . $ TBox#curFeature. ) |
| 818 | curFeaturecxx . . $ TBox#curFeature.->fillConceptDatacxx . . $ LogicFeatures#fillConceptData(49c8796e4511ff9d).(p); |
| 819 | } |
| 820 | /// gather information about logical features of relevant role |
| 821 | void collectLogicFeaturecxx . . $ TBox#collectLogicFeature(318ce8d73e657f48). ( const TRolecxx . . $ TRole#* p ) const |
| 822 | { |
| 823 | if ( curFeaturecxx . . $ TBox#curFeature. ) // update features w.r.t. current concept |
| 824 | curFeaturecxx . . $ TBox#curFeature.->fillRoleDatacxx . . $ LogicFeatures#fillRoleData(b2320954eb62eea2). ( p, isRelevantcxx . . $ TBox#isRelevant(81d69a9c8508a392).(p->inversecxx . . $ TRole#inverse(69f26110a94b259f).()) ); |
| 825 | } |
| 826 | /// gather information about logical features of relevant DAG entry |
| 827 | void collectLogicFeaturecxx . . $ TBox#collectLogicFeature(65382114aacc8d2c). ( const DLVertexcxx . . $ DLVertex#& v, bool pos ) const |
| 828 | { |
| 829 | if ( curFeaturecxx . . $ TBox#curFeature. ) |
| 830 | curFeaturecxx . . $ TBox#curFeature.->fillDAGDatacxx . . $ LogicFeatures#fillDAGData(6a493ba1542d2d3b). ( v, pos ); |
| 831 | } |
| 832 | /// mark all active GCIs relevant |
| 833 | void markGCIsRelevantcxx . . $ TBox#markGCIsRelevant(49f6e7a06ebc5aa8). ( void ) { setRelevantcxx . . $ TBox#setRelevant(d4f767463ce0a6b3).(T_Gcxx . . $ TBox#T_G.); } |
| 834 | |
| 835 | //----------------------------------------------------------------------------- |
| 836 | //-- internal relevance interface |
| 837 | //----------------------------------------------------------------------------- |
| 838 | /// set all TBox content (namely, concepts and GCIs) relevant |
| 839 | void markAllRelevantcxx . . $ TBox#markAllRelevant(49f6e7a06ebc5aa8). ( void ) |
| 840 | { |
| 841 | for ( c_iteratorcxx . . $ TBox#c_iterator# pc = c_begincxx . . $ TBox#c_begin(23ec1c5bda99ac5d).(); pc !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). c_endcxx . . $ TBox#c_end(23ec1c5bda99ac5d).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pc ) |
| 842 | setRelevantcxx . . $ TBox#setRelevant(3f0281ca3ae282d4).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pc); |
| 843 | for ( i_iteratorcxx . . $ TBox#i_iterator# pi = i_begincxx . . $ TBox#i_begin(78b5d4d1a9fb506d).(); pi !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). i_endcxx . . $ TBox#i_end(78b5d4d1a9fb506d).(); ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).pi ) |
| 844 | setRelevantcxx . . $ TBox#setRelevant(3f0281ca3ae282d4).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).pi); |
| 845 | |
| 846 | markGCIsRelevantcxx . . $ TBox#markGCIsRelevant(49f6e7a06ebc5aa8).(); |
| 847 | } |
| 848 | /// mark chosen part of TBox (P, Q and GCIs) relevant |
| 849 | void calculateRelevantcxx . . $ TBox#calculateRelevant(8cc49028a64014a4). ( TConceptcxx . . $ TConcept#* p, TConceptcxx . . $ TConcept#* q ) |
| 850 | { |
| 851 | setRelevantcxx . . $ TBox#setRelevant(3f0281ca3ae282d4).(p); |
| 852 | if ( q != nullptr ) |
| 853 | setRelevantcxx . . $ TBox#setRelevant(3f0281ca3ae282d4).(q); |
| 854 | markGCIsRelevantcxx . . $ TBox#markGCIsRelevant(49f6e7a06ebc5aa8).(); |
| 855 | } |
| 856 | /// clear all relevance info |
| 857 | void clearRelevanceInfocxx . . $ TBox#clearRelevanceInfo(49f6e7a06ebc5aa8). ( void ) { relevancecxx . . $ TBox#relevance..newLabelcxx . . $ TLabeller#newLabel(49f6e7a06ebc5aa8).(); } |
| 858 | /// gather relevance statistic for the whole KB |
| 859 | void gatherRelevanceInfocxx . . $ TBox#gatherRelevanceInfo(49f6e7a06ebc5aa8). ( void ); |
| 860 | /// put relevance information to a concept's data |
| 861 | void setConceptRelevantcxx . . $ TBox#setConceptRelevant(3f0281ca3ae282d4). ( TConceptcxx . . $ TConcept#* p ) |
| 862 | { |
| 863 | curFeaturecxx . . $ TBox#curFeature. = &p->posFeaturescxx . . $ TConcept#posFeatures.; |
| 864 | setRelevantcxx . . $ TBox#setRelevant(d4f767463ce0a6b3).(p->pBodycxx . . $ TConcept#pBody.); |
| 865 | KBFeaturescxx . . $ TBox#KBFeatures. |=cxx . . $ LogicFeatures#`operator|=`(9c0e370cfff66a7a). p->posFeaturescxx . . $ TConcept#posFeatures.; |
| 866 | collectLogicFeaturecxx . . $ TBox#collectLogicFeature(d1b1787efb22fc2d).(p); |
| 867 | clearRelevanceInfocxx . . $ TBox#clearRelevanceInfo(49f6e7a06ebc5aa8).(); |
| 868 | |
| 869 | // nothing to do for neg-prim concepts |
| 870 | if ( p->isPrimitivecxx . . $ TConcept#isPrimitive(50ce9a9e25b4a850).() ) |
| 871 | return; |
| 872 | |
| 873 | curFeaturecxx . . $ TBox#curFeature. = &p->negFeaturescxx . . $ TConcept#negFeatures.; |
| 874 | setRelevantcxx . . $ TBox#setRelevant(d4f767463ce0a6b3).(inversecxx . . $ inverse(7864480464b09eea).(p->pBodycxx . . $ TConcept#pBody.)); |
| 875 | KBFeaturescxx . . $ TBox#KBFeatures. |=cxx . . $ LogicFeatures#`operator|=`(9c0e370cfff66a7a). p->negFeaturescxx . . $ TConcept#negFeatures.; |
| 876 | clearRelevanceInfocxx . . $ TBox#clearRelevanceInfo(49f6e7a06ebc5aa8).(); |
| 877 | } |
| 878 | /// update AUX features with the given one; update roles if necessary |
| 879 | void updateAuxFeaturescxx . . $ TBox#updateAuxFeatures(b5b90b78616ed72d). ( const LogicFeaturescxx . . $ LogicFeatures#& lf ) |
| 880 | { |
| 881 | if ( !lf.emptycxx . . $ LogicFeatures#empty(50ce9a9e25b4a850).() ) |
| 882 | { |
| 883 | auxFeaturescxx . . $ TBox#auxFeatures. |=cxx . . $ LogicFeatures#`operator|=`(9c0e370cfff66a7a). lf; |
| 884 | auxFeaturescxx . . $ TBox#auxFeatures..mergeRolescxx . . $ LogicFeatures#mergeRoles(49f6e7a06ebc5aa8).(); |
| 885 | } |
| 886 | } |
| 887 | /// prepare features for SAT(P), or SUB(P,Q) test |
| 888 | void prepareFeaturescxx . . $ TBox#prepareFeatures(774c8a5cd0d40bb6). ( const TConceptcxx . . $ TConcept#* pConcept, const TConceptcxx . . $ TConcept#* qConcept ); |
| 889 | /// clear current features |
| 890 | void clearFeaturescxx . . $ TBox#clearFeatures(49f6e7a06ebc5aa8). ( void ) { curFeaturecxx . . $ TBox#curFeature. = nullptr; } |
| 891 | |
| 892 | //----------------------------------------------------------------------------- |
| 893 | //-- internal dump output interface |
| 894 | //----------------------------------------------------------------------------- |
| 895 | /// dump concept-like essence using given dump method |
| 896 | void dumpConceptcxx . . $ TBox#dumpConcept(a4db8d8f21e66feb). ( dumpInterfacecxx . . $ dumpInterface#* dump, const TConceptcxx . . $ TConcept#* p ) const; |
| 897 | /// dump role-like essence using given dump method |
| 898 | void dumpRolecxx . . $ TBox#dumpRole(168e534236295eca). ( dumpInterfacecxx . . $ dumpInterface#* dump, const TRolecxx . . $ TRole#* p ) const; |
| 899 | /// dump general concept expression using given dump method |
| 900 | void dumpExpressioncxx . . $ TBox#dumpExpression(fb4f27af2f2e980). ( dumpInterfacecxx . . $ dumpInterface#* dump, BipolarPointercxx . . $ BipolarPointer# p ) const; |
| 901 | /// dump all (relevant) roles |
| 902 | void dumpAllRolescxx . . $ TBox#dumpAllRoles(338ae63f5fd45b1b). ( dumpInterfacecxx . . $ dumpInterface#* dump ) const; |
| 903 | |
| 904 | //----------------------------------------------------------------------------- |
| 905 | //-- internal save/load interface; implementation in SaveLoad.cpp |
| 906 | //----------------------------------------------------------------------------- |
| 907 | |
| 908 | /// init pointer2int maps |
| 909 | void initPointerMapscxx . . $ TBox#initPointerMaps(aaac402dd6f8bcf7). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ) const; |
| 910 | |
| 911 | public: |
| 912 | /// init c'tor |
| 913 | TBoxcxx . . $ TBox#TBox(da4a163a7cd92f4d). ( const ifOptionSetcxx . . $ ifOptionSet#* Options, |
| 914 | const stdcxx . . $ std/::stringcxx . . $ std/string#& TopORoleName, |
| 915 | const stdcxx . . $ std/::stringcxx . . $ std/string#& BotORoleName, |
| 916 | const stdcxx . . $ std/::stringcxx . . $ std/string#& TopDRoleName, |
| 917 | const stdcxx . . $ std/::stringcxx . . $ std/string#& BotDRoleName ); |
| 918 | /// no copy c'tor |
| 919 | TBoxcxx . . $ TBox#TBox(d7ce26b385cb593f). ( const TBoxcxx . . $ TBox#& ) = delete; |
| 920 | /// no assignment |
| 921 | TBoxcxx . . $ TBox#& operatorcxx . . $ TBox#`operator=`(d7f084bc8566992e). = ( const TBoxcxx . . $ TBox#& ) = delete; |
| 922 | /// d'tor |
| 923 | ~cxx . . $ TBox#`~TBox`(49f6e7a06ebc5aa8).TBoxcxx . . $ TBox#(); |
| 924 | |
| 925 | /// get RW access to used Role Master |
| 926 | RoleMastercxx . . $ RoleMaster#& getORMcxx . . $ TBox#getORM(94330852db6e789a). ( void ) { return ORMcxx . . $ TBox#ORM.; } |
| 927 | /// get RO access to used Role Master |
| 928 | const RoleMastercxx . . $ RoleMaster#& getORMcxx . . $ TBox#getORM(f53ea36832a88d52). ( void ) const { return ORMcxx . . $ TBox#ORM.; } |
| 929 | /// get RW access to used DataRole Master |
| 930 | RoleMastercxx . . $ RoleMaster#& getDRMcxx . . $ TBox#getDRM(94330852db6e789a). ( void ) { return DRMcxx . . $ TBox#DRM.; } |
| 931 | /// get RO access to used DataRole Master |
| 932 | const RoleMastercxx . . $ RoleMaster#& getDRMcxx . . $ TBox#getDRM(f53ea36832a88d52). ( void ) const { return DRMcxx . . $ TBox#DRM.; } |
| 933 | /// get RW access to the RoleMaster depending of the R |
| 934 | RoleMastercxx . . $ RoleMaster#& getRMcxx . . $ TBox#getRM(d63bc69855fc8040). ( const TRolecxx . . $ TRole#* R ) { return R->isDataRolecxx . . $ TRole#isDataRole(50ce9a9e25b4a850).() ? getDRMcxx . . $ TBox#getDRM(94330852db6e789a).() : getORMcxx . . $ TBox#getORM(94330852db6e789a).(); } |
| 935 | /// get RO access to the RoleMaster depending of the R |
| 936 | const RoleMastercxx . . $ RoleMaster#& getRMcxx . . $ TBox#getRM(c59bcf333322fd03). ( const TRolecxx . . $ TRole#* R ) const { return R->isDataRolecxx . . $ TRole#isDataRole(50ce9a9e25b4a850).() ? getDRMcxx . . $ TBox#getDRM(f53ea36832a88d52).() : getORMcxx . . $ TBox#getORM(f53ea36832a88d52).(); } |
| 937 | /// get RW access to a DT center |
| 938 | DataTypeCentercxx . . $ DataTypeCenter#& getDataTypeCentercxx . . $ TBox#getDataTypeCenter(dd641241804ece05). ( void ) { return DTCentercxx . . $ TBox#DTCenter.; } |
| 939 | /// get RO access to a DT center |
| 940 | const DataTypeCentercxx . . $ DataTypeCenter#& getDataTypeCentercxx . . $ TBox#getDataTypeCenter(91dfeba50d158280). ( void ) const { return DTCentercxx . . $ TBox#DTCenter.; } |
| 941 | /// get RO access to DAG (needed for KE) |
| 942 | const DLDagcxx . . $ DLDag#& getDagcxx . . $ TBox#getDag(9e19445b34a9809a). ( void ) const { return DLHeapcxx . . $ TBox#DLHeap.; } |
| 943 | |
| 944 | /// set the value of a test timeout in milliseconds to VALUE |
| 945 | void setTestTimeoutcxx . . $ TBox#setTestTimeout(2c44cd906ae4e829). ( unsigned long value ) { testTimeoutcxx . . $ TBox#testTimeout. = value; } |
| 946 | /// (dis-)allow reasoner to use the undefined names in queries |
| 947 | void setUseUndefinedNamescxx . . $ TBox#setUseUndefinedNames(b45ddcbc8423892c). ( bool value ) { Conceptscxx . . $ TBox#Concepts..setAllowFreshcxx . . $ TNECollection#setAllowFresh(efaadfb7dc14930a).(value); } |
| 948 | /// set flag to use node cache to value VAL |
| 949 | void setUseNodeCachecxx . . $ TBox#setUseNodeCache(b45ddcbc8423892c). ( bool val ) { useNodeCachecxx . . $ TBox#useNodeCache. = val; } |
| 950 | |
| 951 | //----------------------------------------------------------------------------- |
| 952 | //-- public parser ensure* interface |
| 953 | //----------------------------------------------------------------------------- |
| 954 | |
| 955 | /// return registered concept by given NAME; @return NULL if can't register |
| 956 | TConceptcxx . . $ TConcept#* getConceptcxx . . $ TBox#getConcept(91c47a16c070dcb4). ( const stdcxx . . $ std/::stringcxx . . $ std/string#& name ) { return Conceptscxx . . $ TBox#Concepts..getcxx . . $ TNECollection#get(e53703f8e2b82653).(name); } |
| 957 | /// return registered individual by given NAME; @return NULL if can't register |
| 958 | TIndividualcxx . . $ TIndividual#* getIndividualcxx . . $ TBox#getIndividual(59d5ff1132777197). ( const stdcxx . . $ std/::stringcxx . . $ std/string#& name ) { return Individualscxx . . $ TBox#Individuals..getcxx . . $ TNECollection#get(e53703f8e2b82653).(name); } |
| 959 | |
| 960 | /// @return true iff given NAME is a name of a registered individual |
| 961 | bool isIndividualcxx . . $ TBox#isIndividual(13a55b95a0133754). ( const stdcxx . . $ std/::stringcxx . . $ std/string#& name ) const { return Individualscxx . . $ TBox#Individuals..isRegisteredcxx . . $ TNECollection#isRegistered(13a55b95a0133754).(name); } |
| 962 | /// @return true iff given ENTRY is a registered individual |
| 963 | bool isIndividualcxx . . $ TBox#isIndividual(d8a4b25e330b0b26). ( const TNamedEntrycxx . . $ TNamedEntry#* entry ) const { return isIndividualcxx . . $ TBox#isIndividual(13a55b95a0133754).(entrycxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).->getNamecxx . . $ TNamedEntry#getName(a9f41ea0e82d88cf).()); } |
| 964 | /// @return true iff given TREE represents a registered individual |
| 965 | bool isIndividualcxx . . $ TBox#isIndividual(4f9ee8c35ac4b1e6). ( const DLTreecxx . . $ DLTree#* tree ) const |
| 966 | { return (tree->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).().getTokencxx . . $ TLexeme#getToken(d71a1020745f3953).() == INAMEcxx . . $ INAME. && isIndividualcxx . . $ TBox#isIndividual(d8a4b25e330b0b26).(tree->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).().getNEcxx . . $ TLexeme#getNE(28c03b9fd3c689f8).())); } |
| 967 | /// @return true iff given DLTree represents a data value |
| 968 | static bool isDataValuecxx . . $ TBox#isDataValue(937bda690ff1bb73). ( const DLTreecxx . . $ DLTree#* entry ) |
| 969 | { |
| 970 | return entry->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).().getTokencxx . . $ TLexeme#getToken(d71a1020745f3953).() == DATAEXPRcxx . . $ DATAEXPR. && |
| 971 | static_cast<const TDataEntrycxx . . $ TDataEntry#*>(entry->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).().getNEcxx . . $ TLexeme#getNE(28c03b9fd3c689f8).())->isDataValuecxx . . $ TDataEntry#isDataValue(50ce9a9e25b4a850).(); |
| 972 | } |
| 973 | |
| 974 | /// get TOP/BOTTOM/CN/IN by the DLTree entry |
| 975 | TConceptcxx . . $ TConcept#* getCIcxx . . $ TBox#getCI(a9db10ac0cf504ba). ( const DLTreecxx . . $ DLTree#* name ) |
| 976 | { |
| 977 | if ( name->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).() ==cxx . . $ TLexeme#`operator==`(b418e6031985303a). TOPcxx . . $ TOP. ) |
| 978 | return pTopcxx . . $ TBox#pTop.; |
| 979 | if ( name->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).() ==cxx . . $ TLexeme#`operator==`(b418e6031985303a). BOTTOMcxx . . $ BOTTOM. ) |
| 980 | return pBottomcxx . . $ TBox#pBottom.; |
| 981 | |
| 982 | if ( !isNamecxx . . $ isName(937bda690ff1bb73).(name) ) |
| 983 | return nullptr; |
| 984 | |
| 985 | if ( name->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).().getTokencxx . . $ TLexeme#getToken(d71a1020745f3953).() == CNAMEcxx . . $ CNAME. ) |
| 986 | return toConceptcxx . . $ TBox#toConcept(45d7b14406cbd318).(name->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).().getNEcxx . . $ TLexeme#getNE(28c03b9fd3c689f8).()); |
| 987 | else |
| 988 | return toIndividualcxx . . $ TBox#toIndividual(1199bc9a67399c68).(name->Elementcxx . . $ TsTTree#Element(ea465e50d690edfe).().getNEcxx . . $ TLexeme#getNE(28c03b9fd3c689f8).()); |
| 989 | } |
| 990 | /// get a DL tree by a given concept-like C |
| 991 | DLTreecxx . . $ DLTree#* getTreecxx . . $ TBox#getTree(8f1a6b264b733ed7). ( TConceptcxx . . $ TConcept#* C ) const |
| 992 | { |
| 993 | if ( C == nullptr ) |
| 994 | return nullptr; |
| 995 | if ( C == pTopcxx . . $ TBox#pTop. ) |
| 996 | return createTopcxx . . $ createTop(aa22cc08b69ae2ef).(); |
| 997 | if ( C == pBottomcxx . . $ TBox#pBottom. ) |
| 998 | return createBottomcxx . . $ createBottom(aa22cc08b69ae2ef).(); |
| 999 | return createEntrycxx . . $ createEntry(21bce954c2c882e2). ( isIndividualcxx . . $ TBox#isIndividual(d8a4b25e330b0b26).(C) ? INAMEcxx . . $ INAME. : CNAMEcxx . . $ CNAME., C ); |
| 1000 | } |
| 1001 | /// get fresh concept |
| 1002 | DLTreecxx . . $ DLTree#* getFreshConceptcxx . . $ TBox#getFreshConcept(7ba0ba2d2b26f6a8). ( void ) const { return createEntrycxx . . $ createEntry(21bce954c2c882e2). ( CNAMEcxx . . $ CNAME., pTempcxx . . $ TBox#pTemp. ); } |
| 1003 | |
| 1004 | // n-ary absorption support |
| 1005 | |
| 1006 | /// get unique aux concept |
| 1007 | TConceptcxx . . $ TConcept#* getAuxConceptcxx . . $ TBox#getAuxConcept(9b2c8167507be48a). ( DLTreecxx . . $ DLTree#* desc = nullptr ); |
| 1008 | /// replace RC=(AR:~C) with X such that C [= AR^-:X for fresh X. @return X |
| 1009 | TConceptcxx . . $ TConcept#* replaceForallcxx . . $ TBox#replaceForall(9b2c8167507be48a). ( DLTreecxx . . $ DLTree#* RC ); |
| 1010 | /// @return true iff C has a cyclic definition, ie is referenced in its own description |
| 1011 | bool isCycliccxx . . $ TBox#isCyclic(78140581f8900ef9). ( TConceptcxx . . $ TConcept#* C ) const |
| 1012 | { |
| 1013 | ConceptSetcxx . . $ TBox#ConceptSet# processedcxx . . $ std/set#set(49f6e7a06ebc5aa8).; |
| 1014 | return isReferencedcxx . . $ TBox#isReferenced(301dea6fb175ea62). ( C, C, processed ); |
| 1015 | } |
| 1016 | |
| 1017 | //----------------------------------------------------------------------------- |
| 1018 | //-- public input axiom interface |
| 1019 | //----------------------------------------------------------------------------- |
| 1020 | |
| 1021 | /// register individual relation <a,b>:R |
| 1022 | void RegisterIndividualRelationcxx . . $ TBox#RegisterIndividualRelation(b27626525369bbbd). ( TNamedEntrycxx . . $ TNamedEntry#* a, TNamedEntrycxx . . $ TNamedEntry#* R, TNamedEntrycxx . . $ TNamedEntry#* b ) |
| 1023 | { |
| 1024 | if ( !isIndividualcxx . . $ TBox#isIndividual(d8a4b25e330b0b26).(a) || !isIndividualcxx . . $ TBox#isIndividual(d8a4b25e330b0b26).(b) ) |
| 1025 | throw EFaCTPlusPluscxx . . $ EFaCTPlusPlus#EFaCTPlusPlus(85c52e162fed56f9).("Individual expected in related()"); |
| 1026 | RelatedIcxx . . $ TBox#RelatedI..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70). ( new |
| 1027 | TRelatedcxx . . $ TRelated#TRelated(9a60f9f6a8e43197). ( toIndividualcxx . . $ TBox#toIndividual(1199bc9a67399c68).(a), |
| 1028 | toIndividualcxx . . $ TBox#toIndividual(1199bc9a67399c68).(b), |
| 1029 | static_cast<TRolecxx . . $ TRole#*>(R) ) ); |
| 1030 | RelatedIcxx . . $ TBox#RelatedI..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70). ( new |
| 1031 | TRelatedcxx . . $ TRelated#TRelated(9a60f9f6a8e43197). ( toIndividualcxx . . $ TBox#toIndividual(1199bc9a67399c68).(b), |
| 1032 | toIndividualcxx . . $ TBox#toIndividual(1199bc9a67399c68).(a), |
| 1033 | static_cast<TRolecxx . . $ TRole#*>(R)->inversecxx . . $ TRole#inverse(6cda9dc08d29302e).() ) ); |
| 1034 | } |
| 1035 | |
| 1036 | /// add general subsumption axiom C [= D |
| 1037 | void addSubsumeAxiomcxx . . $ TBox#addSubsumeAxiom(237c04ede5740138). ( DLTreecxx . . $ DLTree#* C, DLTreecxx . . $ DLTree#* D ); |
| 1038 | /// add axiom CN [= D for concept CN |
| 1039 | void addSubsumeAxiomcxx . . $ TBox#addSubsumeAxiom(4128fa2c78139db0). ( TConceptcxx . . $ TConcept#* C, DLTreecxx . . $ DLTree#* D ) { addSubsumeAxiomcxx . . $ TBox#addSubsumeAxiom(237c04ede5740138). ( getTreecxx . . $ TBox#getTree(8f1a6b264b733ed7).(C), D ); } |
| 1040 | /// add an axiom CN [= E for defined CN (CN=D already in base) |
| 1041 | void addSubsumeForDefinedcxx . . $ TBox#addSubsumeForDefined(4128fa2c78139db0). ( TConceptcxx . . $ TConcept#* C, DLTreecxx . . $ DLTree#* E ); |
| 1042 | /// add an axiom LHS = RHS |
| 1043 | void addEqualityAxiomcxx . . $ TBox#addEqualityAxiom(237c04ede5740138). ( DLTreecxx . . $ DLTree#* lhs, DLTreecxx . . $ DLTree#* rhs ); |
| 1044 | |
| 1045 | /// add simple rule RULE to the TBox' rules |
| 1046 | inline |
| 1047 | void addSimpleRulecxx . . $ TBox#addSimpleRule(239770515a12d88a). ( TSimpleRulecxx . . $ TBox#TSimpleRule#* Rule ) |
| 1048 | { |
| 1049 | initRuleFieldscxx . . $ TBox#initRuleFields(9bcfa4d1c5e5b6cd). ( Rule->Bodycxx . . $ TBox#TSimpleRule#Body., SimpleRulescxx . . $ TBox#SimpleRules..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).() ); |
| 1050 | SimpleRulescxx . . $ TBox#SimpleRules..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(Rule); |
| 1051 | } |
| 1052 | /// add binary simple rule (C0,C1)=>H |
| 1053 | void addBSimpleRulecxx . . $ TBox#addBSimpleRule(786ed05e5dc64853). ( TConceptcxx . . $ TConcept#* C0, TConceptcxx . . $ TConcept#* C1, DLTreecxx . . $ DLTree#* H ) |
| 1054 | { |
| 1055 | ConceptVectorcxx . . $ TBox#ConceptVector# vcxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 1056 | v.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(C0); |
| 1057 | v.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(C1); |
| 1058 | addSimpleRulecxx . . $ TBox#addSimpleRule(239770515a12d88a). ( new TSimpleRulecxx . . $ TBox#TSimpleRule#TSimpleRule(b0f8a7a48a8d759b). ( v, H ) ); |
| 1059 | } |
| 1060 | |
| 1061 | // external-set methods for set-of-concept-expressions |
| 1062 | void processEquivalentCcxx . . $ TBox#processEquivalentC(117de6f0d8a75fcb). ( ea_iteratorcxx . . $ TBox#ea_iterator# beg, ea_iteratorcxx . . $ TBox#ea_iterator# end ); |
| 1063 | void processDisjointCcxx . . $ TBox#processDisjointC(117de6f0d8a75fcb). ( ea_iteratorcxx . . $ TBox#ea_iterator# beg, ea_iteratorcxx . . $ TBox#ea_iterator# end ); |
| 1064 | void processEquivalentRcxx . . $ TBox#processEquivalentR(117de6f0d8a75fcb). ( ea_iteratorcxx . . $ TBox#ea_iterator# beg, ea_iteratorcxx . . $ TBox#ea_iterator# end ); |
| 1065 | void processDisjointRcxx . . $ TBox#processDisjointR(117de6f0d8a75fcb). ( ea_iteratorcxx . . $ TBox#ea_iterator# beg, ea_iteratorcxx . . $ TBox#ea_iterator# end ); |
| 1066 | void processSamecxx . . $ TBox#processSame(117de6f0d8a75fcb). ( ea_iteratorcxx . . $ TBox#ea_iterator# beg, ea_iteratorcxx . . $ TBox#ea_iterator# end ); |
| 1067 | void processDifferentcxx . . $ TBox#processDifferent(117de6f0d8a75fcb). ( ea_iteratorcxx . . $ TBox#ea_iterator# beg, ea_iteratorcxx . . $ TBox#ea_iterator# end ); |
| 1068 | |
| 1069 | /// let TBox know that the whole ontology is loaded |
| 1070 | void finishLoadingcxx . . $ TBox#finishLoading(49f6e7a06ebc5aa8). ( void ) { setForbidUndefinedNamescxx . . $ TBox#setForbidUndefinedNames(efaadfb7dc14930a).(true); } |
| 1071 | /// @return true if KB contains fairness constraints |
| 1072 | bool hasFCcxx . . $ TBox#hasFC(50ce9a9e25b4a850). ( void ) const { return !Fairnesscxx . . $ TBox#Fairness..emptycxx . . $ std/vector#empty(50ce9a9e25b4a850).(); } |
| 1073 | /// add concept expression C as a fairness constraint |
| 1074 | void setFairnessConstraintcxx . . $ TBox#setFairnessConstraint(117de6f0d8a75fcb). ( ea_iteratorcxx . . $ TBox#ea_iterator# beg, ea_iteratorcxx . . $ TBox#ea_iterator# end ) |
| 1075 | { |
| 1076 | for ( ; beg <cxx . . $ __gnu_cxx/`operator<`(ef3c5749062e825c). end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).beg ) |
| 1077 | if ( isNamecxx . . $ isName(937bda690ff1bb73).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).beg) ) |
| 1078 | { |
| 1079 | Fairnesscxx . . $ TBox#Fairness..push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(getCIcxx . . $ TBox#getCI(a9db10ac0cf504ba).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).beg)); |
| 1080 | deleteTreecxx . . $ deleteTree(c5beffd064a5e5b2).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).beg); |
| 1081 | } |
| 1082 | else |
| 1083 | { |
| 1084 | // build a flag for a FC |
| 1085 | TConceptcxx . . $ TConcept#* fc = getAuxConceptcxx . . $ TBox#getAuxConcept(9b2c8167507be48a).(); |
| 1086 | Fairnesscxx . . $ TBox#Fairness..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(fc); |
| 1087 | // make an axiom: FC = C |
| 1088 | addEqualityAxiomcxx . . $ TBox#addEqualityAxiom(237c04ede5740138). ( getTreecxx . . $ TBox#getTree(8f1a6b264b733ed7).(fc), *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).beg ); |
| 1089 | } |
| 1090 | // in presence of fairness constraints use ancestor blocking |
| 1091 | if ( useAnywhereBlockingcxx . . $ TBox#useAnywhereBlocking. && hasFCcxx . . $ TBox#hasFC(50ce9a9e25b4a850).() ) |
| 1092 | { |
| 1093 | useAnywhereBlockingcxx . . $ TBox#useAnywhereBlocking. = false; |
| 1094 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llAlwayscxx . . $ llAlways.) ) |
| 1095 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nFairness constraints: set useAnywhereBlocking = 0"; |
| 1096 | } |
| 1097 | } |
| 1098 | |
| 1099 | //----------------------------------------------------------------------------- |
| 1100 | //-- public access interface |
| 1101 | //----------------------------------------------------------------------------- |
| 1102 | |
| 1103 | /// GCI Axioms access |
| 1104 | BipolarPointercxx . . $ BipolarPointer# getTGcxx . . $ TBox#getTG(455f465bc33b4cdf). ( void ) const { return T_Gcxx . . $ TBox#T_G.; } |
| 1105 | /// get simple rule by its INDEX |
| 1106 | const TSimpleRulecxx . . $ TBox#TSimpleRule#* getSimpleRulecxx . . $ TBox#getSimpleRule(5b04ea8eb21e8d6c). ( size_tcxx . . $ size_t# index ) const { return SimpleRulescxx . . $ TBox#SimpleRules.[cxx . . $ std/vector#`operator[]`(b61e45a10b63f40a).index]; } |
| 1107 | |
| 1108 | /// check if the relevant part of KB contains inverse roles. |
| 1109 | bool isIRinQuerycxx . . $ TBox#isIRinQuery(50ce9a9e25b4a850). ( void ) const |
| 1110 | { |
| 1111 | if ( curFeaturecxx . . $ TBox#curFeature. != nullptr ) |
| 1112 | return curFeaturecxx . . $ TBox#curFeature.->hasInverseRolecxx . . $ LogicFeatures#hasInverseRole(50ce9a9e25b4a850).(); |
| 1113 | else |
| 1114 | return KBFeaturescxx . . $ TBox#KBFeatures..hasInverseRolecxx . . $ LogicFeatures#hasInverseRole(50ce9a9e25b4a850).(); |
| 1115 | } |
| 1116 | /// check if the relevant part of KB contains number restrictions. |
| 1117 | bool isNRinQuerycxx . . $ TBox#isNRinQuery(50ce9a9e25b4a850). ( void ) const |
| 1118 | { |
| 1119 | const LogicFeaturescxx . . $ LogicFeatures#* p = curFeaturecxx . . $ TBox#curFeature. ? curFeaturecxx . . $ TBox#curFeature. : &KBFeaturescxx . . $ TBox#KBFeatures.; |
| 1120 | return p->hasFunctionalRestrictioncxx . . $ LogicFeatures#hasFunctionalRestriction(50ce9a9e25b4a850).() || p->hasNumberRestrictioncxx . . $ LogicFeatures#hasNumberRestriction(50ce9a9e25b4a850).() || p->hasQNumberRestrictioncxx . . $ LogicFeatures#hasQNumberRestriction(50ce9a9e25b4a850).(); |
| 1121 | } |
| 1122 | /// check if the relevant part of KB contains singletons |
| 1123 | bool testHasNominalscxx . . $ TBox#testHasNominals(50ce9a9e25b4a850). ( void ) const |
| 1124 | { |
| 1125 | if ( curFeaturecxx . . $ TBox#curFeature. != nullptr ) |
| 1126 | return curFeaturecxx . . $ TBox#curFeature.->hasSingletonscxx . . $ LogicFeatures#hasSingletons(50ce9a9e25b4a850).(); |
| 1127 | else |
| 1128 | return KBFeaturescxx . . $ TBox#KBFeatures..hasSingletonscxx . . $ LogicFeatures#hasSingletons(50ce9a9e25b4a850).(); |
| 1129 | } |
| 1130 | /// check if the relevant part of KB contains top role |
| 1131 | bool testHasTopRolecxx . . $ TBox#testHasTopRole(50ce9a9e25b4a850). ( void ) const |
| 1132 | { |
| 1133 | if ( curFeaturecxx . . $ TBox#curFeature. != nullptr ) |
| 1134 | return curFeaturecxx . . $ TBox#curFeature.->hasTopRolecxx . . $ LogicFeatures#hasTopRole(50ce9a9e25b4a850).(); |
| 1135 | else |
| 1136 | return KBFeaturescxx . . $ TBox#KBFeatures..hasTopRolecxx . . $ LogicFeatures#hasTopRole(50ce9a9e25b4a850).(); |
| 1137 | } |
| 1138 | /// check if Sorted Reasoning is applicable |
| 1139 | bool canUseSortedReasoningcxx . . $ TBox#canUseSortedReasoning(50ce9a9e25b4a850). ( void ) const |
| 1140 | { return useSortedReasoningcxx . . $ TBox#useSortedReasoning. && !GCIscxx . . $ TBox#GCIs..isGCIcxx . . $ TKBFlags#isGCI(50ce9a9e25b4a850).() && !GCIscxx . . $ TBox#GCIs..isReflexivecxx . . $ TKBFlags#isReflexive(50ce9a9e25b4a850).(); } |
| 1141 | |
| 1142 | /// @return true iff individual C is known to be p-blocked by another one |
| 1143 | bool isBlockedIndcxx . . $ TBox#isBlockedInd(78140581f8900ef9). ( TConceptcxx . . $ TConcept#* C ) const { return SameIcxx . . $ TBox#SameI..findcxx . . $ std/map#find(7b3585bb5da8f7d).(C) !=cxx . . $ std/`operator!=`(7e1308a0738ea758). SameIcxx . . $ TBox#SameI..endcxx . . $ std/map#end(646659518938a4d6).(); } |
| 1144 | /// get individual that blocks C; works only for blocked individuals C |
| 1145 | TIndividualcxx . . $ TIndividual#* getBlockingIndcxx . . $ TBox#getBlockingInd(26bf38a14acccc37). ( TConceptcxx . . $ TConcept#* C ) const { return SameIcxx . . $ TBox#SameI..findcxx . . $ std/map#find(7b3585bb5da8f7d).(C)->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(1016ee5406d91ab9).secondcxx . . $ std/pair#second..firstcxx . . $ std/pair#first.; } |
| 1146 | /// @return true iff an individual blocks C deterministically |
| 1147 | bool isBlockingDetcxx . . $ TBox#isBlockingDet(78140581f8900ef9). ( TConceptcxx . . $ TConcept#* C ) const { return SameIcxx . . $ TBox#SameI..findcxx . . $ std/map#find(7b3585bb5da8f7d).(C)->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(1016ee5406d91ab9).secondcxx . . $ std/pair#second..secondcxx . . $ std/pair#second.; } |
| 1148 | |
| 1149 | //----------------------------------------------------------------------------- |
| 1150 | //-- public iterators |
| 1151 | //----------------------------------------------------------------------------- |
| 1152 | |
| 1153 | /// RO begin() for concepts |
| 1154 | c_const_iteratorcxx . . $ TBox#c_const_iterator# c_begincxx . . $ TBox#c_begin(b45ca211050fca7). ( void ) const { return Conceptscxx . . $ TBox#Concepts..begincxx . . $ TNECollection#begin(9be2c0f68cb6a3de).(); } |
| 1155 | /// RO end() for concepts |
| 1156 | c_const_iteratorcxx . . $ TBox#c_const_iterator# c_endcxx . . $ TBox#c_end(b45ca211050fca7). ( void ) const { return Conceptscxx . . $ TBox#Concepts..endcxx . . $ TNECollection#end(9be2c0f68cb6a3de).(); } |
| 1157 | |
| 1158 | /// RO begin() for individuals |
| 1159 | i_const_iteratorcxx . . $ TBox#i_const_iterator# i_begincxx . . $ TBox#i_begin(80d9d5fe67f36f59). ( void ) const { return Individualscxx . . $ TBox#Individuals..begincxx . . $ TNECollection#begin(9be2c0f68cb6a3de).(); } |
| 1160 | /// RO end() for individuals |
| 1161 | i_const_iteratorcxx . . $ TBox#i_const_iterator# i_endcxx . . $ TBox#i_end(80d9d5fe67f36f59). ( void ) const { return Individualscxx . . $ TBox#Individuals..endcxx . . $ TNECollection#end(9be2c0f68cb6a3de).(); } |
| 1162 | |
| 1163 | //----------------------------------------------------------------------------- |
| 1164 | //-- public reasoning interface |
| 1165 | //----------------------------------------------------------------------------- |
| 1166 | /// prepare to reasoning |
| 1167 | void prepareReasoningcxx . . $ TBox#prepareReasoning(49f6e7a06ebc5aa8). ( void ); |
| 1168 | /// perform classification (assuming KB is consistent) |
| 1169 | void performClassificationcxx . . $ TBox#performClassification(49f6e7a06ebc5aa8). ( void ) { createTaxonomycxx . . $ TBox#createTaxonomy(b45ddcbc8423892c). ( /*needIndividuals=*/false ); } |
| 1170 | /// perform realisation (assuming KB is consistent) |
| 1171 | void performRealisationcxx . . $ TBox#performRealisation(49f6e7a06ebc5aa8). ( void ) { createTaxonomycxx . . $ TBox#createTaxonomy(b45ddcbc8423892c). ( /*needIndividuals=*/true ); } |
| 1172 | /// reclassify taxonomy wrt changed sets |
| 1173 | void reclassifycxx . . $ TBox#reclassify(75cae9a303a37910). ( const stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*>& MPlus, const stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*>& MMinus ); |
| 1174 | |
| 1175 | /// get (READ-WRITE) access to internal Taxonomy of concepts |
| 1176 | Taxonomycxx . . $ Taxonomy#* getTaxonomycxx . . $ TBox#getTaxonomy(f40506d1380adb7f). ( void ) { return pTaxcxx . . $ TBox#pTax.; } |
| 1177 | |
| 1178 | /// set given structure as a progress monitor |
| 1179 | void setProgressMonitorcxx . . $ TBox#setProgressMonitor(192f8d731e56d7e3). ( TProgressMonitorcxx . . $ TProgressMonitor#* pMon ) { pMonitorcxx . . $ TBox#pMonitor. = pMon; } |
| 1180 | /// check that reasoning progress was cancelled by external application |
| 1181 | bool isCancelledcxx . . $ TBox#isCancelled(50ce9a9e25b4a850). ( void ) const { return pMonitorcxx . . $ TBox#pMonitor. != nullptr && pMonitorcxx . . $ TBox#pMonitor.->isCancelledcxx . . $ TProgressMonitor#isCancelled(c9857a73d68e59ba).(); } |
| 1182 | /// set verbose output (ie, default progress monitor, concept and role taxonomies) wrt given VALUE |
| 1183 | void setVerboseOutputcxx . . $ TBox#setVerboseOutput(b45ddcbc8423892c). ( bool value ) { verboseOutputcxx . . $ TBox#verboseOutput. = value; } |
| 1184 | |
| 1185 | /// create (and DAG-ify) query concept via its definition |
| 1186 | TConceptcxx . . $ TConcept#* createQueryConceptcxx . . $ TBox#createQueryConcept(a9db10ac0cf504ba). ( const DLTreecxx . . $ DLTree#* query ); |
| 1187 | /// preprocess query concept: put description into DAG |
| 1188 | void preprocessQueryConceptcxx . . $ TBox#preprocessQueryConcept(3f0281ca3ae282d4). ( TConceptcxx . . $ TConcept#* query ); |
| 1189 | /// classify query concept |
| 1190 | void classifyQueryConceptcxx . . $ TBox#classifyQueryConcept(49f6e7a06ebc5aa8). ( void ); |
| 1191 | /// delete all query-related stuff |
| 1192 | void clearQueryConceptcxx . . $ TBox#clearQueryConcept(49f6e7a06ebc5aa8). ( void ) { DLHeapcxx . . $ TBox#DLHeap..removeQuerycxx . . $ DLDag#removeQuery(49f6e7a06ebc5aa8).(); } |
| 1193 | /// @return true if the concept in question is a query concept |
| 1194 | bool isComplexQuerycxx . . $ TBox#isComplexQuery(b352c686bfa4bc3f). ( const TConceptcxx . . $ TConcept#* queryConcept ) const { return queryConcept == pQuerycxx . . $ TBox#pQuery.; } |
| 1195 | |
| 1196 | //----------------------------------------------------------------------------- |
| 1197 | //-- public reasoning interface |
| 1198 | //----------------------------------------------------------------------------- |
| 1199 | |
| 1200 | /// get status flag |
| 1201 | KBStatuscxx . . $ KBStatus# getStatuscxx . . $ TBox#getStatus(6b8689a3d707128a). ( void ) const { return Statuscxx . . $ TBox#Status.; } |
| 1202 | /// set consistency flag |
| 1203 | void setConsistencycxx . . $ TBox#setConsistency(b45ddcbc8423892c). ( bool val ) |
| 1204 | { |
| 1205 | Statuscxx . . $ TBox#Status. = kbCCheckedcxx . . $ kbCChecked.; |
| 1206 | Consistentcxx . . $ TBox#Consistent. = val; |
| 1207 | } |
| 1208 | /// check if the ontology is consistent |
| 1209 | bool isConsistentcxx . . $ TBox#isConsistent(c9857a73d68e59ba). ( void ) |
| 1210 | { |
| 1211 | if ( Statuscxx . . $ TBox#Status. < kbCCheckedcxx . . $ kbCChecked. ) |
| 1212 | { |
| 1213 | prepareReasoningcxx . . $ TBox#prepareReasoning(49f6e7a06ebc5aa8).(); |
| 1214 | if ( Statuscxx . . $ TBox#Status. < kbCCheckedcxx . . $ kbCChecked. && Consistentcxx . . $ TBox#Consistent. ) // we can detect inconsistency during preprocessing |
| 1215 | setConsistencycxx . . $ TBox#setConsistency(b45ddcbc8423892c).(performConsistencyCheckcxx . . $ TBox#performConsistencyCheck(c9857a73d68e59ba).()); |
| 1216 | } |
| 1217 | return Consistentcxx . . $ TBox#Consistent.; |
| 1218 | } |
| 1219 | /// check if a subsumption C [= D holds |
| 1220 | bool isSubHoldscxx . . $ TBox#isSubHolds(7e9f35c32394b4f5). ( const TConceptcxx . . $ TConcept#* C, const TConceptcxx . . $ TConcept#* D ); |
| 1221 | /// check if a concept C is satisfiable |
| 1222 | bool isSatisfiablecxx . . $ TBox#isSatisfiable(15d44b555a30180e). ( const TConceptcxx . . $ TConcept#* C ); |
| 1223 | /// check that 2 individuals are the same |
| 1224 | bool isSameIndividualscxx . . $ TBox#isSameIndividuals(3993f6531b750ef8). ( const TIndividualcxx . . $ TIndividual#* a, const TIndividualcxx . . $ TIndividual#* b ); |
| 1225 | /// check if 2 roles are disjoint |
| 1226 | bool isDisjointRolescxx . . $ TBox#isDisjointRoles(ee962dbb2fa027b9). ( const TRolecxx . . $ TRole#* R, const TRolecxx . . $ TRole#* S ); |
| 1227 | /// check if the role R is irreflexive |
| 1228 | bool isIrreflexivecxx . . $ TBox#isIrreflexive(f4c3e7633be50e77). ( const TRolecxx . . $ TRole#* R ); |
| 1229 | |
| 1230 | /// fills cache entry for given concept; SUB means that the concept is on the right side of a subsumption test |
| 1231 | const modelCacheInterfacecxx . . $ modelCacheInterface#* initCachecxx . . $ TBox#initCache(6e2e6147ec169214). ( const TConceptcxx . . $ TConcept#* pConcept, bool sub = false ); |
| 1232 | |
| 1233 | /// build a completion tree for a concept C (no caching as it breaks the idea of KE). @return the root node |
| 1234 | const DlCompletionTreecxx . . $ DlCompletionTree#* buildCompletionTreecxx . . $ TBox#buildCompletionTree(a413042f62b2ffcc). ( const TConceptcxx . . $ TConcept#* C ); |
| 1235 | |
| 1236 | /// test if 2 concept non-subsumption can be determined by cache merging |
| 1237 | enum modelCacheStatecxx . . $ modelCacheState# testCachedNonSubsumptioncxx . . $ TBox#testCachedNonSubsumption(88faddbc21e41e4b). ( const TConceptcxx . . $ TConcept#* p, const TConceptcxx . . $ TConcept#* q ); |
| 1238 | /// test if 2 concept non-subsumption can be determined by sorts checking |
| 1239 | bool testSortedNonSubsumptioncxx . . $ TBox#testSortedNonSubsumption(7e9f35c32394b4f5). ( const TConceptcxx . . $ TConcept#* p, const TConceptcxx . . $ TConcept#* q ) |
| 1240 | { |
| 1241 | // sorted reasoning doesn't work in presence of GCIs |
| 1242 | if ( !canUseSortedReasoningcxx . . $ TBox#canUseSortedReasoning(50ce9a9e25b4a850).() ) |
| 1243 | return false; |
| 1244 | // doesn't work for the SAT tests |
| 1245 | if ( q == nullptr ) |
| 1246 | return false; |
| 1247 | return !DLHeapcxx . . $ TBox#DLHeap..haveSameSortcxx . . $ DLDag#haveSameSort(88e30549ca55c866). ( p->pNamecxx . . $ TConcept#pName., q->pNamecxx . . $ TConcept#pName. ); |
| 1248 | } |
| 1249 | //----------------------------------------------------------------------------- |
| 1250 | //-- public output interface |
| 1251 | //----------------------------------------------------------------------------- |
| 1252 | |
| 1253 | /// dump query processing TIME, reasoning statistics and a (preprocessed) TBox |
| 1254 | void writeReasoningResultcxx . . $ TBox#writeReasoningResult(2d0f4d08371733d). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o, float time ) const; |
| 1255 | /// print TBox as a whole |
| 1256 | void Printcxx . . $ TBox#Print(490063bd7e6d8d5d). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) const |
| 1257 | { |
| 1258 | DLHeapcxx . . $ TBox#DLHeap..PrintStatcxx . . $ DLDag#PrintStat(490063bd7e6d8d5d).(o); |
| 1259 | ORMcxx . . $ TBox#ORM..Printcxx . . $ RoleMaster#Print(5a62ef92febfbe9). ( o, "Object" ); |
| 1260 | DRMcxx . . $ TBox#DRM..Printcxx . . $ RoleMaster#Print(5a62ef92febfbe9). ( o, "Data" ); |
| 1261 | PrintConceptscxx . . $ TBox#PrintConcepts(490063bd7e6d8d5d).(o); |
| 1262 | PrintIndividualscxx . . $ TBox#PrintIndividuals(490063bd7e6d8d5d).(o); |
| 1263 | PrintSimpleRulescxx . . $ TBox#PrintSimpleRules(490063bd7e6d8d5d).(o); |
| 1264 | PrintAxiomscxx . . $ TBox#PrintAxioms(490063bd7e6d8d5d).(o); |
| 1265 | DLHeapcxx . . $ TBox#DLHeap..Printcxx . . $ DLDag#Print(490063bd7e6d8d5d).(o); |
| 1266 | } |
| 1267 | |
| 1268 | /// create dump of relevant part of query using given method |
| 1269 | void dumpcxx . . $ TBox#dump(338ae63f5fd45b1b). ( dumpInterfacecxx . . $ dumpInterface#* dump ) const; |
| 1270 | |
| 1271 | //----------------------------------------------------------------------------- |
| 1272 | //-- save/load interface; implementation in SaveLoad.cpp |
| 1273 | //----------------------------------------------------------------------------- |
| 1274 | |
| 1275 | /// save the KB into the given stream |
| 1276 | void Savecxx . . $ TBox#Save(da67b8e43f9c9b96). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ); |
| 1277 | /// load the KB from given stream wrt STATUS |
| 1278 | void Loadcxx . . $ TBox#Load(488fc6160d398d6b). ( SaveLoadManagercxx . . $ SaveLoadManager#& m, KBStatuscxx . . $ KBStatus# status ); |
| 1279 | /// save taxonomy with names (used in the incremental) |
| 1280 | void SaveTaxonomycxx . . $ TBox#SaveTaxonomy(743aa3bb9dc93fde). ( SaveLoadManagercxx . . $ SaveLoadManager#& m, const stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntrycxx . . $ TNamedEntry#*>& excluded ); |
| 1281 | /// load taxonomy with names (used in the incremental) |
| 1282 | void LoadTaxonomycxx . . $ TBox#LoadTaxonomy(da67b8e43f9c9b96). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ); |
| 1283 | }; // TBox |
| 1284 | |
| 1285 | #endif |