| 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 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 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 KERNEL_H |
| 21 | #define KERNEL_Hcxx . . $ `Kernel/Kernel.h:21:9`! |
| 22 | |
| 23 | #include <string> |
| 24 | |
| 25 | #include "fpp_assert.h"cxx . . $ `<file>/Kernel/fpp_assert.h`/ |
| 26 | #include "eFPPInconsistentKB.h"cxx . . $ `<file>/Kernel/eFPPInconsistentKB.h`/ |
| 27 | #include "dlTBox.h"cxx . . $ `<file>/Kernel/dlTBox.h`/ |
| 28 | #include "ifOptions.h"cxx . . $ `<file>/Kernel/ifOptions.h`/ |
| 29 | #include "DLConceptTaxonomy.h"cxx . . $ `<file>/Kernel/DLConceptTaxonomy.h`/ // for getRelatives() |
| 30 | #include "tExpressionTranslator.h"cxx . . $ `<file>/Kernel/tExpressionTranslator.h`/ |
| 31 | #include "tOntology.h"cxx . . $ `<file>/Kernel/tOntology.h`/ |
| 32 | #include "KnowledgeExplorer.h"cxx . . $ `<file>/Kernel/KnowledgeExplorer.h`/ |
| 33 | #include "tOntologyAtom.h"cxx . . $ `<file>/Kernel/tOntologyAtom.h`/ // types for AD |
| 34 | #include "ModuleType.h"cxx . . $ `<file>/Kernel/ModuleType.h`/ |
| 35 | #include "ModuleMethod.h"cxx . . $ `<file>/Kernel/ModuleMethod.h`/ |
| 36 | |
| 37 | class OntologyBasedModularizercxx . . $ OntologyBasedModularizer#; |
| 38 | class AtomicDecomposercxx . . $ AtomicDecomposer#; |
| 39 | class TJNICachecxx . . $ TJNICache#; // cached JNI information |
| 40 | class SaveLoadManagercxx . . $ SaveLoadManager#; |
| 41 | |
| 42 | class ReasoningKernelcxx . . $ ReasoningKernel# |
| 43 | { |
| 44 | public: // types interface |
| 45 | /* |
| 46 | The type system for DL expressions used in the input language: |
| 47 | |
| 48 | TExpr; |
| 49 | TConceptExpr: TExpr; |
| 50 | TIndividualExpr : TExpr; |
| 51 | TRoleExpr: TExpr; |
| 52 | TORoleComplexExpr: TRoleExpr; |
| 53 | TORoleExpr: TORoleComplexExpr; |
| 54 | TDRoleExpr: TRoleExpr; |
| 55 | TDataExpr: TExpr; |
| 56 | TDataValueExpr: TDataExpr; |
| 57 | |
| 58 | Right now all the expressions are of the type DLTree*. |
| 59 | Later on the appropriate classes from tDlExpression.h |
| 60 | |
| 61 | As a transition step, the intermediate structure is introduced. |
| 62 | */ |
| 63 | |
| 64 | /// general expression |
| 65 | typedef const TDLExpressioncxx . . $ TDLExpression# TExprcxx . . $ ReasoningKernel#TExpr#; |
| 66 | /// concept expression |
| 67 | typedef const TDLConceptExpressioncxx . . $ TDLConceptExpression# TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#; |
| 68 | /// individual expression |
| 69 | typedef const TDLIndividualExpressioncxx . . $ TDLIndividualExpression# TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#; |
| 70 | /// role expression |
| 71 | typedef const TDLRoleExpressioncxx . . $ TDLRoleExpression# TRoleExprcxx . . $ ReasoningKernel#TRoleExpr#; |
| 72 | /// object role complex expression (including role chains and projections) |
| 73 | typedef const TDLObjectRoleComplexExpressioncxx . . $ TDLObjectRoleComplexExpression# TORoleComplexExprcxx . . $ ReasoningKernel#TORoleComplexExpr#; |
| 74 | /// object role expression |
| 75 | typedef const TDLObjectRoleExpressioncxx . . $ TDLObjectRoleExpression# TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#; |
| 76 | /// data role expression |
| 77 | typedef const TDLDataRoleExpressioncxx . . $ TDLDataRoleExpression# TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#; |
| 78 | /// data expression |
| 79 | typedef const TDLDataExpressioncxx . . $ TDLDataExpression# TDataExprcxx . . $ ReasoningKernel#TDataExpr#; |
| 80 | /// data type expression |
| 81 | typedef TDLDataTypeExpressioncxx . . $ TDLDataTypeExpression# TDataTypeExprcxx . . $ ReasoningKernel#TDataTypeExpr#; |
| 82 | /// data value expression |
| 83 | typedef const TDLDataValuecxx . . $ TDLDataValue# TDataValueExprcxx . . $ ReasoningKernel#TDataValueExpr#; |
| 84 | /// data facet expression |
| 85 | typedef const TDLFacetExpressioncxx . . $ TDLFacetExpression# TFacetExprcxx . . $ ReasoningKernel#TFacetExpr#; |
| 86 | |
| 87 | // name sets |
| 88 | |
| 89 | /// set of arbitrary named expressions |
| 90 | typedef stdcxx . . $ std/::vectorcxx . . $ std/vector#<const TNamedEntrycxx . . $ TNamedEntry#*> NamesVectorcxx . . $ ReasoningKernel#NamesVector#; |
| 91 | // IndividualSet is just set of named individual expressions |
| 92 | typedef NamesVectorcxx . . $ ReasoningKernel#NamesVector# IndividualSetcxx . . $ ReasoningKernel#IndividualSet#; |
| 93 | |
| 94 | /// typedef for intermediate instance related type |
| 95 | typedef TRelatedMapcxx . . $ TRelatedMap#::CIVeccxx . . $ TRelatedMap#CIVec# CIVeccxx . . $ ReasoningKernel#CIVec#; |
| 96 | |
| 97 | // types for knowledge exploration |
| 98 | |
| 99 | /// type for the node in the completion graph |
| 100 | typedef KnowledgeExplorercxx . . $ KnowledgeExplorer#::TCGNodecxx . . $ KnowledgeExplorer#TCGNode# TCGNodecxx . . $ ReasoningKernel#TCGNode#; |
| 101 | /// type for the node vector |
| 102 | typedef KnowledgeExplorercxx . . $ KnowledgeExplorer#::TCGNodeVeccxx . . $ KnowledgeExplorer#TCGNodeVec# TCGNodeVeccxx . . $ ReasoningKernel#TCGNodeVec#; |
| 103 | /// type for a set of role expressions (used in KE to return stuff) |
| 104 | typedef KnowledgeExplorercxx . . $ KnowledgeExplorer#::TCGRoleSetcxx . . $ KnowledgeExplorer#TCGRoleSet# TCGRoleSetcxx . . $ ReasoningKernel#TCGRoleSet#; |
| 105 | /// type for a vector of data/concept expressions (used in KE to return stuff) |
| 106 | typedef KnowledgeExplorercxx . . $ KnowledgeExplorer#::TCGItemVeccxx . . $ KnowledgeExplorer#TCGItemVec# TCGItemVeccxx . . $ ReasoningKernel#TCGItemVec#; |
| 107 | |
| 108 | protected: // types |
| 109 | /// arguments for property chain querying and friends |
| 110 | typedef const stdcxx . . $ std/::vectorcxx . . $ std/vector#<const TDLExpressioncxx . . $ TDLExpression#*> TExprVeccxx . . $ ReasoningKernel#TExprVec#; |
| 111 | /// names to module signature map |
| 112 | typedef TBoxcxx . . $ TBox#::NameSigMapcxx . . $ TBox#NameSigMap# NameSigMapcxx . . $ ReasoningKernel#NameSigMap#; |
| 113 | |
| 114 | public: // members |
| 115 | /// options for the kernel and all related substructures |
| 116 | ifOptionSetcxx . . $ ifOptionSet# KernelOptionscxx . . $ ReasoningKernel#KernelOptions.; |
| 117 | |
| 118 | private: // constants |
| 119 | static const char* Versioncxx . . $ ReasoningKernel#Version.; |
| 120 | static const char* SupportedDLcxx . . $ ReasoningKernel#SupportedDL.; |
| 121 | static const char* Copyrightcxx . . $ ReasoningKernel#Copyright.; |
| 122 | static const char* ReleaseDatecxx . . $ ReasoningKernel#ReleaseDate.; |
| 123 | /// header of the file with internal state; defined in SaveLoad.cpp |
| 124 | static const char* InternalStateFileHeadercxx . . $ ReasoningKernel#InternalStateFileHeader.; |
| 125 | |
| 126 | protected: // types |
| 127 | /// enumeration for the cache |
| 128 | enum cacheStatuscxx . . $ ReasoningKernel#cacheStatus# { csEmptycxx . . $ ReasoningKernel#csEmpty., csSatcxx . . $ ReasoningKernel#csSat., csClassifiedcxx . . $ ReasoningKernel#csClassified. }; |
| 129 | |
| 130 | protected: // members |
| 131 | /// local TBox (to be created) |
| 132 | TBoxcxx . . $ TBox#* pTBoxcxx . . $ ReasoningKernel#pTBox. = nullptr; |
| 133 | /// set of axioms |
| 134 | TOntologycxx . . $ TOntology# Ontologycxx . . $ ReasoningKernel#Ontology.; |
| 135 | /// expression translator to work with queries |
| 136 | TExpressionTranslatorcxx . . $ TExpressionTranslator#* pETcxx . . $ ReasoningKernel#pET. = nullptr; |
| 137 | /// name-signature map |
| 138 | NameSigMapcxx . . $ ReasoningKernel#NameSigMap# Name2Sigcxx . . $ ReasoningKernel#Name2Sig.; |
| 139 | /// ontology signature (used in incremental) |
| 140 | TSignaturecxx . . $ TSignature# OntoSigcxx . . $ ReasoningKernel#OntoSig.; |
| 141 | /// trace vector for the last operation (set from the TBox trace-sets) |
| 142 | AxiomVeccxx . . $ AxiomVec# TraceVeccxx . . $ ReasoningKernel#TraceVec.; |
| 143 | /// knowledge exploration support |
| 144 | KnowledgeExplorercxx . . $ KnowledgeExplorer#* KEcxx . . $ ReasoningKernel#KE. = nullptr; |
| 145 | /// atomic decomposer |
| 146 | AtomicDecomposercxx . . $ AtomicDecomposer#* ADcxx . . $ ReasoningKernel#AD. = nullptr; |
| 147 | /// syntactic locality based module extractor |
| 148 | OntologyBasedModularizercxx . . $ OntologyBasedModularizer#* ModSyncxx . . $ ReasoningKernel#ModSyn. = nullptr; |
| 149 | /// syntactic with counting locality based module extractor |
| 150 | OntologyBasedModularizercxx . . $ OntologyBasedModularizer#* ModSynCountcxx . . $ ReasoningKernel#ModSynCount. = nullptr; |
| 151 | /// semantic locality based module extractor |
| 152 | OntologyBasedModularizercxx . . $ OntologyBasedModularizer#* ModSemcxx . . $ ReasoningKernel#ModSem. = nullptr; |
| 153 | /// set to return by the locality checking procedure |
| 154 | AxiomVeccxx . . $ AxiomVec# Resultcxx . . $ ReasoningKernel#Result.; |
| 155 | /// JNI cache corresponding to a kernel. External, created and deleted outside |
| 156 | TJNICachecxx . . $ TJNICache#* JNICachecxx . . $ ReasoningKernel#JNICache. = nullptr; |
| 157 | /// name of an S/L context. do nothing if empty |
| 158 | SaveLoadManagercxx . . $ SaveLoadManager#* pSLManagercxx . . $ ReasoningKernel#pSLManager. = nullptr; |
| 159 | |
| 160 | // Top/Bottom role names: if set, they will appear in all hierarchy-related output |
| 161 | |
| 162 | /// top object role name |
| 163 | stdcxx . . $ std/::stringcxx . . $ std/string# TopORoleNamecxx . . $ ReasoningKernel#TopORoleName.; |
| 164 | /// bottom object role name |
| 165 | stdcxx . . $ std/::stringcxx . . $ std/string# BotORoleNamecxx . . $ ReasoningKernel#BotORoleName.; |
| 166 | /// top data role name |
| 167 | stdcxx . . $ std/::stringcxx . . $ std/string# TopDRoleNamecxx . . $ ReasoningKernel#TopDRoleName.; |
| 168 | /// bottom data role name |
| 169 | stdcxx . . $ std/::stringcxx . . $ std/string# BotDRoleNamecxx . . $ ReasoningKernel#BotDRoleName.; |
| 170 | |
| 171 | // values to propagate to the new KB in case of clearance |
| 172 | |
| 173 | /// progress monitor (if any) |
| 174 | TProgressMonitorcxx . . $ TProgressMonitor#* pMonitorcxx . . $ ReasoningKernel#pMonitor. = nullptr; |
| 175 | /// timeout value |
| 176 | unsigned long OpTimeoutcxx . . $ ReasoningKernel#OpTimeout. = 0; |
| 177 | /// tell reasoner to use verbose output |
| 178 | bool verboseOutputcxx . . $ ReasoningKernel#verboseOutput. = false; |
| 179 | /// allow reasoner to use undefined names in queries |
| 180 | bool useUndefinedNamescxx . . $ ReasoningKernel#useUndefinedNames. = true; |
| 181 | |
| 182 | // reasoning cache |
| 183 | |
| 184 | /// cache level |
| 185 | enum cacheStatuscxx . . $ ReasoningKernel#cacheStatus# cacheLevelcxx . . $ ReasoningKernel#cacheLevel. = csEmptycxx . . $ ReasoningKernel#csEmpty.; |
| 186 | /// cached query input description |
| 187 | TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* cachedQuerycxx . . $ ReasoningKernel#cachedQuery. = nullptr; |
| 188 | /// cached query concept description |
| 189 | DLTreecxx . . $ DLTree#* cachedQueryTreecxx . . $ ReasoningKernel#cachedQueryTree. = nullptr; |
| 190 | /// cached concept (either defConcept or existing one) |
| 191 | TConceptcxx . . $ TConcept#* cachedConceptcxx . . $ ReasoningKernel#cachedConcept. = nullptr; |
| 192 | /// cached query result (taxonomy position) |
| 193 | TaxonomyVertexcxx . . $ TaxonomyVertex#* cachedVertexcxx . . $ ReasoningKernel#cachedVertex. = nullptr; |
| 194 | |
| 195 | // internal flags |
| 196 | |
| 197 | /// set if TBox throws an exception during preprocessing/classification |
| 198 | bool reasoningFailedcxx . . $ ReasoningKernel#reasoningFailed. = false; |
| 199 | /// flag to gather trace information for the next reasoner's call |
| 200 | bool NeedTracingcxx . . $ ReasoningKernel#NeedTracing. = false; |
| 201 | /// ignore cache for the TExpr* (useful for semantic AD) |
| 202 | bool ignoreExprCachecxx . . $ ReasoningKernel#ignoreExprCache. = false; |
| 203 | /// use incremental reasoning |
| 204 | bool useIncrementalReasoningcxx . . $ ReasoningKernel#useIncrementalReasoning. = false; |
| 205 | /// flag to dump LISP-like ontology |
| 206 | bool dumpOntologycxx . . $ ReasoningKernel#dumpOntology. = false; |
| 207 | |
| 208 | protected: // methods |
| 209 | |
| 210 | // register all necessary options in local option set |
| 211 | bool initOptionscxx . . $ ReasoningKernel#initOptions(c9857a73d68e59ba). ( void ); |
| 212 | |
| 213 | /// get status of the KB |
| 214 | KBStatuscxx . . $ KBStatus# getStatuscxx . . $ ReasoningKernel#getStatus(6b8689a3d707128a). ( void ) const |
| 215 | { |
| 216 | if ( pTBoxcxx . . $ ReasoningKernel#pTBox. == nullptr ) |
| 217 | return kbEmptycxx . . $ kbEmpty.; |
| 218 | // if the ontology is changed, it needs to be reclassified |
| 219 | if ( Ontologycxx . . $ ReasoningKernel#Ontology..isChangedcxx . . $ TOntology#isChanged(50ce9a9e25b4a850).() ) |
| 220 | return kbLoadingcxx . . $ kbLoading.; |
| 221 | return pTBoxcxx . . $ ReasoningKernel#pTBox.->getStatuscxx . . $ TBox#getStatus(6b8689a3d707128a).(); |
| 222 | } |
| 223 | /// process KB wrt STATUS |
| 224 | void processKBcxx . . $ ReasoningKernel#processKB(9496fe1b27827f43). ( KBStatuscxx . . $ KBStatus# status ); |
| 225 | /// classify/realise KB only if it is impossible to load results |
| 226 | void ClassifyOrLoadcxx . . $ ReasoningKernel#ClassifyOrLoad(b45ddcbc8423892c). ( bool needIndividuals ); |
| 227 | |
| 228 | /// get DLTree corresponding to an expression EXPR |
| 229 | DLTreecxx . . $ DLTree#* ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a). ( const TExprcxx . . $ ReasoningKernel#TExpr#* expr ) |
| 230 | { |
| 231 | fpp_assertcxx . . $ EFPPAssertion#EFPPAssertion(85c52e162fed56f9). ( pET != nullptr ); |
| 232 | expr->acceptcxx . . $ TDLExpression#accept(8c3f5312553ddf9b).(*pETcxx . . $ ReasoningKernel#pET.); |
| 233 | return *pETcxx . . $ ReasoningKernel#pET.; |
| 234 | } |
| 235 | /// get fresh filled depending of a type of R |
| 236 | DLTreecxx . . $ DLTree#* getFreshFillercxx . . $ ReasoningKernel#getFreshFiller(aaeffdca15792530). ( const TRolecxx . . $ TRole#* R ) |
| 237 | { |
| 238 | if ( R->isDataRolecxx . . $ TRole#isDataRole(50ce9a9e25b4a850).() ) |
| 239 | return getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getDataTypeCentercxx . . $ TBox#getDataTypeCenter(dd641241804ece05).().getFreshDataTypecxx . . $ DataTypeCenter#getFreshDataType(7ba0ba2d2b26f6a8).(); |
| 240 | else |
| 241 | return getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getFreshConceptcxx . . $ TBox#getFreshConcept(7ba0ba2d2b26f6a8).(); |
| 242 | } |
| 243 | |
| 244 | //----------------------------------------------------------------------------- |
| 245 | //-- internal query cache manipulation |
| 246 | //----------------------------------------------------------------------------- |
| 247 | |
| 248 | /// clear query cache |
| 249 | void clearQueryCachecxx . . $ ReasoningKernel#clearQueryCache(49f6e7a06ebc5aa8). ( void ) |
| 250 | { |
| 251 | // clear cached query |
| 252 | cachedQuerycxx . . $ ReasoningKernel#cachedQuery. = nullptr; |
| 253 | deleteTreecxx . . $ deleteTree(c5beffd064a5e5b2).(cachedQueryTreecxx . . $ ReasoningKernel#cachedQueryTree.); |
| 254 | cachedQueryTreecxx . . $ ReasoningKernel#cachedQueryTree. = nullptr; |
| 255 | // clear the rest of cache |
| 256 | cacheLevelcxx . . $ ReasoningKernel#cacheLevel. = csEmptycxx . . $ ReasoningKernel#csEmpty.; |
| 257 | cachedConceptcxx . . $ ReasoningKernel#cachedConcept. = nullptr; |
| 258 | cachedVertexcxx . . $ ReasoningKernel#cachedVertex. = nullptr; |
| 259 | } |
| 260 | /// @return true if the cache is not set |
| 261 | bool isCacheEmptycxx . . $ ReasoningKernel#isCacheEmpty(50ce9a9e25b4a850). ( void ) const { return (cachedQuerycxx . . $ ReasoningKernel#cachedQuery. == nullptr) && (cachedQueryTreecxx . . $ ReasoningKernel#cachedQueryTree. == nullptr); } |
| 262 | /// set query cache value to QUERY |
| 263 | void setQueryCachecxx . . $ ReasoningKernel#setQueryCache(796585798ce1461a). ( TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* query ) { fpp_assertcxx . . $ `Kernel/fpp_assert.h:46:10`!(isCacheEmpty()); cachedQuerycxx . . $ ReasoningKernel#cachedQuery. = query; } |
| 264 | /// set query cache value to QUERY |
| 265 | void setQueryCachecxx . . $ ReasoningKernel#setQueryCache(edf821a2fc5509f9). ( DLTreecxx . . $ DLTree#* query ) { fpp_assertcxx . . $ ReasoningKernel#isCacheEmpty(50ce9a9e25b4a850).(isCacheEmpty()); cachedQueryTreecxx . . $ ReasoningKernel#cachedQueryTree. = query; } |
| 266 | /// check whether query cache is the same as QUERY |
| 267 | bool checkQueryCachecxx . . $ ReasoningKernel#checkQueryCache(cf84ffcdc9f1d9de). ( TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* query ) const { return ignoreExprCachecxx . . $ ReasoningKernel#ignoreExprCache. ? false : cachedQuerycxx . . $ ReasoningKernel#cachedQuery. == query; } |
| 268 | /// check whether query cache is the same as QUERY |
| 269 | bool checkQueryCachecxx . . $ ReasoningKernel#checkQueryCache(c0588540878f7a89). ( DLTreecxx . . $ DLTree#* query ) const { return ignoreExprCachecxx . . $ ReasoningKernel#ignoreExprCache. ? false : equalTreescxx . . $ equalTrees(d3c03bdc42525896). ( cachedQueryTreecxx . . $ ReasoningKernel#cachedQueryTree., query ); } |
| 270 | /// set the query concept |
| 271 | void setQueryConceptcxx . . $ ReasoningKernel#setQueryConcept(f4bd9ed7cc6f2913). ( const DLTreecxx . . $ DLTree#* query ) |
| 272 | { // setup cached concept depending on whether an entity is queries |
| 273 | cachedConceptcxx . . $ ReasoningKernel#cachedConcept. = isCNcxx . . $ isCN(937bda690ff1bb73).(query) ? getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getCIcxx . . $ TBox#getCI(a9db10ac0cf504ba).(query) : getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->createQueryConceptcxx . . $ TBox#createQueryConcept(a9db10ac0cf504ba).(query); |
| 274 | fpp_assertcxx . . $ ReasoningKernel#cachedConcept. ( cachedConcept != nullptr ); |
| 275 | // preprocess concept is necessary (fresh concept in query or complex one) |
| 276 | if ( !isValidcxx . . $ isValid(83c267b20bac841a).(cachedConceptcxx . . $ ReasoningKernel#cachedConcept.->pNamecxx . . $ TConcept#pName.) ) |
| 277 | getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->preprocessQueryConceptcxx . . $ TBox#preprocessQueryConcept(3f0281ca3ae282d4).(cachedConceptcxx . . $ ReasoningKernel#cachedConcept.); |
| 278 | } |
| 279 | /// classify query; cache is ready at the point |
| 280 | void classifyQuerycxx . . $ ReasoningKernel#classifyQuery(49f6e7a06ebc5aa8). ( void ); |
| 281 | /// set up cache for sat query |
| 282 | void setUpSatCachecxx . . $ ReasoningKernel#setUpSatCache(edf821a2fc5509f9). ( DLTreecxx . . $ DLTree#* query ); |
| 283 | /// set up cache for query, performing additional (re-)classification if necessary |
| 284 | void setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* query, cacheStatuscxx . . $ ReasoningKernel#cacheStatus# level ); |
| 285 | /// clear cache and flags |
| 286 | void initCacheAndFlagscxx . . $ ReasoningKernel#initCacheAndFlags(49f6e7a06ebc5aa8). ( void ) |
| 287 | { |
| 288 | clearQueryCachecxx . . $ ReasoningKernel#clearQueryCache(49f6e7a06ebc5aa8).(); |
| 289 | NeedTracingcxx . . $ ReasoningKernel#NeedTracing. = false; |
| 290 | } |
| 291 | |
| 292 | /// build and set a cache for an individual I wrt role R |
| 293 | CIVeccxx . . $ ReasoningKernel#CIVec# buildRelatedCachecxx . . $ ReasoningKernel#buildRelatedCache(9f1620c27b99c66d). ( TIndividualcxx . . $ TIndividual#* I, const TRolecxx . . $ TRole#* R ); |
| 294 | /// get related cache for an individual I |
| 295 | const CIVeccxx . . $ ReasoningKernel#CIVec#& getRelatedcxx . . $ ReasoningKernel#getRelated(f9d8316e028a611d). ( TIndividualcxx . . $ TIndividual#* I, const TRolecxx . . $ TRole#* R ) |
| 296 | { |
| 297 | if ( !I->hasRelatedCachecxx . . $ TIndividual#hasRelatedCache(81d69a9c8508a392).(R) ) |
| 298 | I->setRelatedCachecxx . . $ TIndividual#setRelatedCache(f6cb271f73b2b7b3). ( R, buildRelatedCachecxx . . $ ReasoningKernel#buildRelatedCache(9f1620c27b99c66d). ( I, R ) ); |
| 299 | return I->getRelatedCachecxx . . $ TIndividual#getRelatedCache(e8cb65e6fd10a881).(R); |
| 300 | } |
| 301 | |
| 302 | /// get role expression based on the R |
| 303 | TDLRoleExpressioncxx . . $ TDLRoleExpression#* Rolecxx . . $ ReasoningKernel#Role(84a0113ba4c53900). ( const TRolecxx . . $ TRole#* R ) |
| 304 | { |
| 305 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(R->isDataRole()) ) |
| 306 | return getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->DataRolecxx . . $ TExpressionManager#DataRole(850aa2aceb89231f).(Rcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).->getNamecxx . . $ TNamedEntry#getName(a9f41ea0e82d88cf).()); |
| 307 | else |
| 308 | return getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->ObjectRolecxx . . $ TExpressionManager#ObjectRole(9eb6018165b5acba).(Rcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).->getNamecxx . . $ TNamedEntry#getName(a9f41ea0e82d88cf).()); |
| 309 | } |
| 310 | |
| 311 | //----------------------------------------------------------------------------- |
| 312 | //-- internal reasoning methods |
| 313 | //----------------------------------------------------------------------------- |
| 314 | |
| 315 | /// @return true iff C is satisfiable |
| 316 | bool checkSatTreecxx . . $ ReasoningKernel#checkSatTree(38a18fab043f8799). ( DLTreecxx . . $ DLTree#* C ) |
| 317 | { |
| 318 | if ( unlikelycxx . . $ TLexeme#getToken(d71a1020745f3953).(C->Element().getToken() == TOP) ) |
| 319 | { |
| 320 | deleteTreecxx . . $ deleteTree(c5beffd064a5e5b2).(C); |
| 321 | return true; |
| 322 | } |
| 323 | if ( unlikelycxx . . $ TsTTree#Element(19b2b6f17af048b).(C->Element().getToken() == BOTTOM) ) |
| 324 | { |
| 325 | deleteTreecxx . . $ deleteTree(c5beffd064a5e5b2).(C); |
| 326 | return false; |
| 327 | } |
| 328 | setUpSatCachecxx . . $ ReasoningKernel#setUpSatCache(edf821a2fc5509f9).(C); |
| 329 | return getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->isSatisfiablecxx . . $ TBox#isSatisfiable(15d44b555a30180e).(cachedConceptcxx . . $ ReasoningKernel#cachedConcept.); |
| 330 | } |
| 331 | /// @return true iff C is satisfiable |
| 332 | bool checkSatcxx . . $ ReasoningKernel#checkSat(96881bbb97bd7038). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C ) |
| 333 | { |
| 334 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( C, csSatcxx . . $ ReasoningKernel#csSat. ); |
| 335 | return getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->isSatisfiablecxx . . $ TBox#isSatisfiable(15d44b555a30180e).(cachedConceptcxx . . $ ReasoningKernel#cachedConcept.); |
| 336 | } |
| 337 | /// @return true iff C [= D holds |
| 338 | bool checkSubcxx . . $ ReasoningKernel#checkSub(db5d378ba95a512d). ( TConceptcxx . . $ TConcept#* C, TConceptcxx . . $ TConcept#* D ); |
| 339 | /// helper; @return true iff C is either named concept of Top/Bot |
| 340 | static bool isNameOrConstcxx . . $ ReasoningKernel#isNameOrConst(96881bbb97bd7038). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C ) |
| 341 | { |
| 342 | return likelycxx . . $ `Kernel/globaldef.h:28:10`! ( dynamic_cast<const TDLConceptName*>(C) != nullptr ) || |
| 343 | unlikelycxx . . $ `Kernel/globaldef.h:29:10`! ( dynamic_cast<const TDLConceptTop*>(C) != nullptr ) || |
| 344 | unlikelycxx . . $ `Kernel/globaldef.h:29:10`! ( dynamic_cast<const TDLConceptBottom*>(C) != nullptr ); |
| 345 | } |
| 346 | |
| 347 | // helper methods to query properties of roles |
| 348 | |
| 349 | /// @return true if R is functional wrt ontology |
| 350 | bool checkFunctionalitycxx . . $ ReasoningKernel#checkFunctionality(c325380d1afc00f8). ( TRolecxx . . $ TRole#* R ) |
| 351 | { |
| 352 | // R is transitive iff \ER.C and \ER.\not C is unsatisfiable |
| 353 | DLTreecxx . . $ DLTree#* tmp = createSNFExistscxx . . $ createSNFExists(f2877343b7b69ea7). ( createRolecxx . . $ createRole(6ab896d6f1aa3781).(R), createSNFNotcxx . . $ createSNFNot(1bf715d485c1268).(getFreshFillercxx . . $ ReasoningKernel#getFreshFiller(aaeffdca15792530).(R)) ); |
| 354 | tmp = createSNFAndcxx . . $ createSNFAnd(f2877343b7b69ea7). ( tmp, createSNFExistscxx . . $ createSNFExists(f2877343b7b69ea7). ( createRolecxx . . $ createRole(6ab896d6f1aa3781).(R), getFreshFillercxx . . $ ReasoningKernel#getFreshFiller(aaeffdca15792530).(R) ) ); |
| 355 | return !checkSatTreecxx . . $ ReasoningKernel#checkSatTree(38a18fab043f8799).(tmp); |
| 356 | } |
| 357 | /// @return true if R is functional; set the value for R if necessary |
| 358 | bool getFunctionalitycxx . . $ ReasoningKernel#getFunctionality(c325380d1afc00f8). ( TRolecxx . . $ TRole#* R ) |
| 359 | { |
| 360 | if ( !R->isFunctionalityKnowncxx . . $ TRole#isFunctionalityKnown(50ce9a9e25b4a850).() ) // calculate functionality |
| 361 | R->setFunctionalcxx . . $ TRole#setFunctional(b45ddcbc8423892c).(checkFunctionalitycxx . . $ ReasoningKernel#checkFunctionality(c325380d1afc00f8).(R)); |
| 362 | return R->isFunctionalcxx . . $ TRole#isFunctional(50ce9a9e25b4a850).(); |
| 363 | } |
| 364 | /// @return true if R is transitive wrt ontology |
| 365 | bool checkTransitivitycxx . . $ ReasoningKernel#checkTransitivity(38a18fab043f8799). ( DLTreecxx . . $ DLTree#* R ) |
| 366 | { |
| 367 | // R is transitive iff \ER.\ER.C and \AR.\not C is unsatisfiable |
| 368 | DLTreecxx . . $ DLTree#* tmp = createSNFExistscxx . . $ createSNFExists(f2877343b7b69ea7). ( clonecxx . . $ clone(ec41a33c52a5614b).(R), createSNFNotcxx . . $ createSNFNot(1bf715d485c1268).(getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getFreshConceptcxx . . $ TBox#getFreshConcept(7ba0ba2d2b26f6a8).()) ); |
| 369 | tmp = createSNFExistscxx . . $ createSNFExists(f2877343b7b69ea7). ( clonecxx . . $ clone(ec41a33c52a5614b).(R), tmp ); |
| 370 | tmp = createSNFAndcxx . . $ createSNFAnd(f2877343b7b69ea7). ( tmp, createSNFForallcxx . . $ createSNFForall(f2877343b7b69ea7). ( R, getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getFreshConceptcxx . . $ TBox#getFreshConcept(7ba0ba2d2b26f6a8).() ) ); |
| 371 | return !checkSatTreecxx . . $ ReasoningKernel#checkSatTree(38a18fab043f8799).(tmp); |
| 372 | } |
| 373 | /// @return true if R is symmetric wrt ontology |
| 374 | bool checkSymmetrycxx . . $ ReasoningKernel#checkSymmetry(38a18fab043f8799). ( DLTreecxx . . $ DLTree#* R ) |
| 375 | { |
| 376 | // R is symmetric iff C and \ER.\AR.(not C) is unsatisfiable |
| 377 | DLTreecxx . . $ DLTree#* tmp = createSNFForallcxx . . $ createSNFForall(f2877343b7b69ea7). ( clonecxx . . $ clone(ec41a33c52a5614b).(R), createSNFNotcxx . . $ createSNFNot(1bf715d485c1268).(getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getFreshConceptcxx . . $ TBox#getFreshConcept(7ba0ba2d2b26f6a8).()) ); |
| 378 | tmp = createSNFAndcxx . . $ createSNFAnd(f2877343b7b69ea7). ( getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getFreshConceptcxx . . $ TBox#getFreshConcept(7ba0ba2d2b26f6a8).(), createSNFExistscxx . . $ createSNFExists(f2877343b7b69ea7). ( R, tmp ) ); |
| 379 | return !checkSatTreecxx . . $ ReasoningKernel#checkSatTree(38a18fab043f8799).(tmp); |
| 380 | } |
| 381 | /// @return true if R is reflexive wrt ontology |
| 382 | bool checkReflexivitycxx . . $ ReasoningKernel#checkReflexivity(38a18fab043f8799). ( DLTreecxx . . $ DLTree#* R ) |
| 383 | { |
| 384 | // R is reflexive iff C and \AR.(not C) is unsatisfiable |
| 385 | DLTreecxx . . $ DLTree#* tmp = createSNFForallcxx . . $ createSNFForall(f2877343b7b69ea7). ( R, createSNFNotcxx . . $ createSNFNot(1bf715d485c1268).(getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getFreshConceptcxx . . $ TBox#getFreshConcept(7ba0ba2d2b26f6a8).()) ); |
| 386 | tmp = createSNFAndcxx . . $ createSNFAnd(f2877343b7b69ea7). ( getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getFreshConceptcxx . . $ TBox#getFreshConcept(7ba0ba2d2b26f6a8).(), tmp ); |
| 387 | return !checkSatTreecxx . . $ ReasoningKernel#checkSatTree(38a18fab043f8799).(tmp); |
| 388 | } |
| 389 | /// @return true if R [= S wrt ontology |
| 390 | bool checkRoleSubsumptioncxx . . $ ReasoningKernel#checkRoleSubsumption(b603d592d189a67b). ( TRolecxx . . $ TRole#* R, TRolecxx . . $ TRole#* S ) |
| 391 | { |
| 392 | if ( unlikelycxx . . $ TRole#isDataRole(50ce9a9e25b4a850). ( R->isDataRole() != S->isDataRole() ) ) |
| 393 | return false; |
| 394 | // R [= S iff \ER.C and \AS.(not C) is unsatisfiable |
| 395 | DLTreecxx . . $ DLTree#* tmp = createSNFForallcxx . . $ createSNFForall(f2877343b7b69ea7). ( createRolecxx . . $ createRole(6ab896d6f1aa3781).(S), createSNFNotcxx . . $ createSNFNot(1bf715d485c1268).(getFreshFillercxx . . $ ReasoningKernel#getFreshFiller(aaeffdca15792530).(S)) ); |
| 396 | tmp = createSNFAndcxx . . $ createSNFAnd(f2877343b7b69ea7). ( createSNFExistscxx . . $ createSNFExists(f2877343b7b69ea7). ( createRolecxx . . $ createRole(6ab896d6f1aa3781).(R), getFreshFillercxx . . $ ReasoningKernel#getFreshFiller(aaeffdca15792530).(R) ), tmp ); |
| 397 | return !checkSatTreecxx . . $ ReasoningKernel#checkSatTree(38a18fab043f8799).(tmp); |
| 398 | } |
| 399 | /// @return true iff the chain contained in the arg-list is a sub-property of R |
| 400 | bool checkSubChaincxx . . $ ReasoningKernel#checkSubChain(5cff2ecb4cbf8882). ( const TExprVeccxx . . $ ReasoningKernel#TExprVec#& Chain, TRolecxx . . $ TRole#* R ) |
| 401 | { |
| 402 | // R1 o ... o Rn [= R iff \ER1.\ER2....\ERn.(notC) and AR.C is unsatisfiable |
| 403 | DLTreecxx . . $ DLTree#* tmp = createSNFNotcxx . . $ createSNFNot(1bf715d485c1268).(getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getFreshConceptcxx . . $ TBox#getFreshConcept(7ba0ba2d2b26f6a8).()); |
| 404 | for ( TExprVeccxx . . $ ReasoningKernel#TExprVec#::const_reverse_iteratorcxx . . $ std/vector#const_reverse_iterator# p = Chaincxx . . $ std/reverse_iterator#reverse_iterator(e2d883c4bd185f58)..rbegincxx . . $ std/vector#rbegin(93c341aad09a535d).(), p_end = Chaincxx . . $ std/reverse_iterator#reverse_iterator(e2d883c4bd185f58)..rendcxx . . $ std/vector#rend(93c341aad09a535d).(); p !=cxx . . $ std/`operator!=`(c2ad8cf295ccec45). p_end; ++cxx . . $ std/reverse_iterator#operator++(b4fad7494eaaab68).p ) |
| 405 | if ( TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* Ri = dynamic_cast<TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#*>(*cxx . . $ std/reverse_iterator#`operator*`(c076846f881f3e7e).p) ) |
| 406 | { |
| 407 | TRolecxx . . $ TRole#* S = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( Ri, "Role expression expected in chain of isSubChain()" ); |
| 408 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(S->isBottom()) ) // bottom in a chain makes it super of any role |
| 409 | { |
| 410 | deleteTreecxx . . $ deleteTree(c5beffd064a5e5b2).(tmp); |
| 411 | return true; |
| 412 | } |
| 413 | tmp = createSNFExistscxx . . $ createSNFExists(f2877343b7b69ea7). ( createRolecxx . . $ createRole(6ab896d6f1aa3781).(S), tmp ); |
| 414 | } |
| 415 | else |
| 416 | throw EFaCTPlusPluscxx . . $ EFaCTPlusPlus#EFaCTPlusPlus(85c52e162fed56f9).("Role expression expected in the role chain construct"); |
| 417 | |
| 418 | tmp = createSNFAndcxx . . $ createSNFAnd(f2877343b7b69ea7). ( tmp, createSNFForallcxx . . $ createSNFForall(f2877343b7b69ea7). ( createEntrycxx . . $ createEntry(21bce954c2c882e2).(RNAMEcxx . . $ RNAME.,R), getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getFreshConceptcxx . . $ TBox#getFreshConcept(7ba0ba2d2b26f6a8).() ) ); |
| 419 | return !checkSatTreecxx . . $ ReasoningKernel#checkSatTree(38a18fab043f8799).(tmp); |
| 420 | } |
| 421 | |
| 422 | // get access to internal structures |
| 423 | |
| 424 | /// @throw an exception if no TBox found |
| 425 | void checkTBoxcxx . . $ ReasoningKernel#checkTBox(83f5f38750778ac8). ( void ) const |
| 426 | { |
| 427 | if ( pTBoxcxx . . $ ReasoningKernel#pTBox. == nullptr ) |
| 428 | throw EFaCTPlusPluscxx . . $ EFaCTPlusPlus#("FaCT++ Kernel: KB Not Initialised"); |
| 429 | } |
| 430 | /// clear TBox and related structures; keep ontology in place |
| 431 | void clearTBoxcxx . . $ ReasoningKernel#clearTBox(49f6e7a06ebc5aa8). ( void ); |
| 432 | |
| 433 | /// get RW access to Object RoleMaster from TBox |
| 434 | RoleMastercxx . . $ RoleMaster#& getORMcxx . . $ ReasoningKernel#getORM(94330852db6e789a). ( void ) { return getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getORMcxx . . $ TBox#getORM(94330852db6e789a).(); } |
| 435 | /// get RO access to Object RoleMaster from TBox |
| 436 | const RoleMastercxx . . $ RoleMaster#& getORMcxx . . $ ReasoningKernel#getORM(f53ea36832a88d52). ( void ) const { return getTBoxcxx . . $ ReasoningKernel#getTBox(996447d18c446891).()->getORMcxx . . $ TBox#getORM(f53ea36832a88d52).(); } |
| 437 | /// get RW access to Data RoleMaster from TBox |
| 438 | RoleMastercxx . . $ RoleMaster#& getDRMcxx . . $ ReasoningKernel#getDRM(94330852db6e789a). ( void ) { return getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getDRMcxx . . $ TBox#getDRM(94330852db6e789a).(); } |
| 439 | /// get RO access to Data RoleMaster from TBox |
| 440 | const RoleMastercxx . . $ RoleMaster#& getDRMcxx . . $ ReasoningKernel#getDRM(f53ea36832a88d52). ( void ) const { return getTBoxcxx . . $ ReasoningKernel#getTBox(996447d18c446891).()->getDRMcxx . . $ TBox#getDRM(f53ea36832a88d52).(); } |
| 441 | |
| 442 | /// get access to the concept hierarchy |
| 443 | Taxonomycxx . . $ Taxonomy#* getCTaxonomycxx . . $ ReasoningKernel#getCTaxonomy(f40506d1380adb7f). ( void ) |
| 444 | { |
| 445 | // if ( !isKBClassified() ) |
| 446 | // throw EFaCTPlusPlus("No access to concept taxonomy: ontology not classified"); |
| 447 | return getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getTaxonomycxx . . $ TBox#getTaxonomy(f40506d1380adb7f).(); |
| 448 | } |
| 449 | /// get access to the object role hierarchy |
| 450 | Taxonomycxx . . $ Taxonomy#* getORTaxonomycxx . . $ ReasoningKernel#getORTaxonomy(f40506d1380adb7f). ( void ) |
| 451 | { |
| 452 | if ( !isKBPreprocessedcxx . . $ ReasoningKernel#isKBPreprocessed(50ce9a9e25b4a850).() ) |
| 453 | throw EFaCTPlusPluscxx . . $ EFaCTPlusPlus#EFaCTPlusPlus(85c52e162fed56f9).("No access to the object role taxonomy: ontology not preprocessed"); |
| 454 | return getORMcxx . . $ ReasoningKernel#getORM(94330852db6e789a).().getTaxonomycxx . . $ RoleMaster#getTaxonomy(f8112ea4e715bb99).(); |
| 455 | } |
| 456 | /// get access to the data role hierarchy |
| 457 | Taxonomycxx . . $ Taxonomy#* getDRTaxonomycxx . . $ ReasoningKernel#getDRTaxonomy(f40506d1380adb7f). ( void ) |
| 458 | { |
| 459 | if ( !isKBPreprocessedcxx . . $ ReasoningKernel#isKBPreprocessed(50ce9a9e25b4a850).() ) |
| 460 | throw EFaCTPlusPluscxx . . $ EFaCTPlusPlus#("No access to the data role taxonomy: ontology not preprocessed"); |
| 461 | return getDRMcxx . . $ ReasoningKernel#getDRM(94330852db6e789a).().getTaxonomycxx . . $ RoleMaster#getTaxonomy(f8112ea4e715bb99).(); |
| 462 | } |
| 463 | |
| 464 | // transformation methods |
| 465 | |
| 466 | /// get concept by the TConceptExpr |
| 467 | TConceptcxx . . $ TConcept#* getConceptcxx . . $ ReasoningKernel#getConcept(bc6ff9799e2bd498). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* i, const char* reason ) |
| 468 | { |
| 469 | try { return static_cast<TConceptcxx . . $ TConcept#*>(getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getCIcxx . . $ TBox#getCI(a9db10ac0cf504ba).(TreeDeletercxx . . $ TreeDeleter#TreeDeleter(edf821a2fc5509f9).(ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(i)))); } |
| 470 | catch(...) { throw EFaCTPlusPluscxx . . $ EFaCTPlusPlus#EFaCTPlusPlus(85c52e162fed56f9).(reason); } |
| 471 | } |
| 472 | /// get individual by the TIndividualExpr |
| 473 | TIndividualcxx . . $ TIndividual#* getIndividualcxx . . $ ReasoningKernel#getIndividual(d410642517b2f838). ( const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* i, const char* reason ) |
| 474 | { |
| 475 | try { return static_cast<TIndividualcxx . . $ TIndividual#*>(getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getCIcxx . . $ TBox#getCI(a9db10ac0cf504ba).(TreeDeletercxx . . $ TreeDeleter#TreeDeleter(edf821a2fc5509f9).(ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(i)))); } |
| 476 | catch(...) { throw EFaCTPlusPluscxx . . $ EFaCTPlusPlus#(reason); } |
| 477 | } |
| 478 | /// get role by the TRoleExpr |
| 479 | TRolecxx . . $ TRole#* getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( const TRoleExprcxx . . $ ReasoningKernel#TRoleExpr#* r, const char* reason ) |
| 480 | { |
| 481 | try { return resolveRolecxx . . $ resolveRole(c256d257f6e22050).(TreeDeletercxx . . $ TreeDeleter#TreeDeleter(edf821a2fc5509f9).(ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(r))); } |
| 482 | catch(...) { throw EFaCTPlusPluscxx . . $ EFaCTPlusPlus#EFaCTPlusPlus(85c52e162fed56f9).(reason); } |
| 483 | } |
| 484 | |
| 485 | /// get taxonomy of the property wrt it's name |
| 486 | Taxonomycxx . . $ Taxonomy#* getTaxonomycxx . . $ ReasoningKernel#getTaxonomy(67c0bce5411888b7). ( TRolecxx . . $ TRole#* R ) |
| 487 | { |
| 488 | return R->isDataRolecxx . . $ TRole#isDataRole(50ce9a9e25b4a850).() ? getDRTaxonomycxx . . $ ReasoningKernel#getDRTaxonomy(f40506d1380adb7f).() : getORTaxonomycxx . . $ ReasoningKernel#getORTaxonomy(f40506d1380adb7f).(); |
| 489 | } |
| 490 | /// get taxonomy vertex of the property wrt it's name |
| 491 | TaxonomyVertexcxx . . $ TaxonomyVertex#* getTaxVertexcxx . . $ ReasoningKernel#getTaxVertex(cee714f1a59d963b). ( TRolecxx . . $ TRole#* R ) |
| 492 | { |
| 493 | return R->getTaxVertexcxx . . $ ClassifiableEntry#getTaxVertex(16f9ca5fa66f7d36).(); |
| 494 | } |
| 495 | |
| 496 | /// check whether it is necessary to reload the ontology |
| 497 | bool needForceReloadcxx . . $ ReasoningKernel#needForceReload(50ce9a9e25b4a850). ( void ) const; |
| 498 | /// force the re-classification of the changed ontology |
| 499 | void forceReloadcxx . . $ ReasoningKernel#forceReload(49f6e7a06ebc5aa8). ( void ); |
| 500 | |
| 501 | //---------------------------------------------- |
| 502 | //-- incremental reasoning support; implementation in Incremental.cpp |
| 503 | //---------------------------------------------- |
| 504 | |
| 505 | /// setup Name2Sig for a given ENTITY |
| 506 | void setupSigcxx . . $ ReasoningKernel#setupSig(97eebc1956244cf1). ( const TNamedEntitycxx . . $ TNamedEntity#* entity, const AxiomVeccxx . . $ AxiomVec#& Module ); |
| 507 | /// setup Name2Sig for a given ENTITY |
| 508 | void setupSigcxx . . $ ReasoningKernel#setupSig(70f9d3c046cd5911). ( const TNamedEntitycxx . . $ TNamedEntity#* entity ) { setupSigcxx . . $ ReasoningKernel#setupSig(97eebc1956244cf1). ( entity, Ontologycxx . . $ ReasoningKernel#Ontology..getAxiomscxx . . $ TOntology#getAxioms(791b20285504d2d7).() ); } |
| 509 | /// build signature for ENTITY and all dependent entities from toProcess; look for modules in Module; |
| 510 | void buildSignaturecxx . . $ ReasoningKernel#buildSignature(e6d1c02eaefc582f). ( const TNamedEntitycxx . . $ TNamedEntity#* entity, const AxiomVeccxx . . $ AxiomVec#& Module, stdcxx . . $ std/::setcxx . . $ std/set#<const TNamedEntitycxx . . $ TNamedEntity#*>& toProcess ); |
| 511 | /// initialise the incremental bits on full reload |
| 512 | void initIncrementalcxx . . $ ReasoningKernel#initIncremental(49f6e7a06ebc5aa8). ( void ); |
| 513 | /// incrementally classify changes |
| 514 | void doIncrementalcxx . . $ ReasoningKernel#doIncremental(49f6e7a06ebc5aa8). ( void ); |
| 515 | |
| 516 | //---------------------------------------------- |
| 517 | //-- save/load support; implementation in SaveLoad.cpp |
| 518 | //---------------------------------------------- |
| 519 | |
| 520 | /// save the header of the kernel |
| 521 | void SaveHeadercxx . . $ ReasoningKernel#SaveHeader(aaac402dd6f8bcf7). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ) const; |
| 522 | /// save the set of Kernel's options |
| 523 | void SaveOptionscxx . . $ ReasoningKernel#SaveOptions(aaac402dd6f8bcf7). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ) const; |
| 524 | /// save the status of the KB and the appropriate part of KB |
| 525 | void SaveKBcxx . . $ ReasoningKernel#SaveKB(da67b8e43f9c9b96). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ); |
| 526 | /// save incremental |
| 527 | void SaveIncrementalcxx . . $ ReasoningKernel#SaveIncremental(aaac402dd6f8bcf7). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ) const; |
| 528 | /// load the header for the kernel |
| 529 | void LoadHeadercxx . . $ ReasoningKernel#LoadHeader(da67b8e43f9c9b96). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ); |
| 530 | /// load the set of Kernel's options |
| 531 | void LoadOptionscxx . . $ ReasoningKernel#LoadOptions(da67b8e43f9c9b96). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ); |
| 532 | /// load the status of the KB and the appropriate part of KB |
| 533 | void LoadKBcxx . . $ ReasoningKernel#LoadKB(da67b8e43f9c9b96). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ); |
| 534 | /// load incremental |
| 535 | void LoadIncrementalcxx . . $ ReasoningKernel#LoadIncremental(da67b8e43f9c9b96). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ); |
| 536 | /// save internal state of the Kernel to a file NAME |
| 537 | void Savecxx . . $ ReasoningKernel#Save(da67b8e43f9c9b96). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ); |
| 538 | /// load internal state of the Kernel from a file NAME |
| 539 | void Loadcxx . . $ ReasoningKernel#Load(da67b8e43f9c9b96). ( SaveLoadManagercxx . . $ SaveLoadManager#& m ); |
| 540 | /// save internal state of the Kernel using S/L Manager |
| 541 | void Savecxx . . $ ReasoningKernel#Save(49f6e7a06ebc5aa8). ( void ); |
| 542 | /// load internal state of the Kernel using S/L Manager |
| 543 | void Loadcxx . . $ ReasoningKernel#Load(49f6e7a06ebc5aa8). ( void ); |
| 544 | |
| 545 | //---------------------------------------------------------------------------------- |
| 546 | // knowledge exploration queries |
| 547 | //---------------------------------------------------------------------------------- |
| 548 | |
| 549 | /// @return a pointer to a modularizer according to given method |
| 550 | OntologyBasedModularizercxx . . $ OntologyBasedModularizer#*& getModPointercxx . . $ ReasoningKernel#getModPointer(f1a752d313dbd853). ( ModuleMethodcxx . . $ ModuleMethod# moduleMethod ) |
| 551 | { |
| 552 | switch ( moduleMethod ) |
| 553 | { |
| 554 | case SYN_LOC_STDcxx . . $ SYN_LOC_STD.: return ModSyncxx . . $ ReasoningKernel#ModSyn.; |
| 555 | case SYN_LOC_COUNTcxx . . $ SYN_LOC_COUNT.: return ModSynCountcxx . . $ ReasoningKernel#ModSynCount.; |
| 556 | case SEM_LOCcxx . . $ SEM_LOC.: return ModSemcxx . . $ ReasoningKernel#ModSem.; |
| 557 | default: fpp_unreachablecxx . . $ EFPPAssertion#EFPPAssertion(85c52e162fed56f9).(); |
| 558 | } |
| 559 | } |
| 560 | /// check whether the modularizer need initialisation, init it and return a proper one |
| 561 | OntologyBasedModularizercxx . . $ OntologyBasedModularizer#* getModExtractorcxx . . $ ReasoningKernel#getModExtractor(4d297ab93f9ba51d). ( ModuleMethodcxx . . $ ModuleMethod# moduleMethod ); |
| 562 | |
| 563 | public: // interface |
| 564 | /// default c'tor |
| 565 | ReasoningKernelcxx . . $ ReasoningKernel#ReasoningKernel(49f6e7a06ebc5aa8). ( void ); |
| 566 | /// no copy c'tor |
| 567 | ReasoningKernelcxx . . $ ReasoningKernel#ReasoningKernel(b13aa4f516d4366d). ( const ReasoningKernelcxx . . $ ReasoningKernel#& ) = delete; |
| 568 | /// no assignment |
| 569 | ReasoningKernelcxx . . $ ReasoningKernel#& operatorcxx . . $ ReasoningKernel#`operator=`(5ab6ad70045e4823). = ( const ReasoningKernelcxx . . $ ReasoningKernel#& ) = delete; |
| 570 | /// d'tor |
| 571 | ~cxx . . $ ReasoningKernel#`~ReasoningKernel`(49f6e7a06ebc5aa8).ReasoningKernelcxx . . $ ReasoningKernel#(); |
| 572 | |
| 573 | ifOptionSetcxx . . $ ifOptionSet#* getOptionscxx . . $ ReasoningKernel#getOptions(d018531a31ef00c8). ( void ) { return &KernelOptionscxx . . $ ReasoningKernel#KernelOptions.; } |
| 574 | const ifOptionSetcxx . . $ ifOptionSet#* getOptionscxx . . $ ReasoningKernel#getOptions(ea4e25fb0df721c7). ( void ) const { return &KernelOptionscxx . . $ ReasoningKernel#KernelOptions.; } |
| 575 | |
| 576 | static const char* getVersioncxx . . $ ReasoningKernel#getVersion(33a1f659e94feb42). ( void ) { return Versioncxx . . $ ReasoningKernel#Version.; } |
| 577 | |
| 578 | /// return classification status of KB |
| 579 | bool isKBPreprocessedcxx . . $ ReasoningKernel#isKBPreprocessed(50ce9a9e25b4a850). ( void ) const { return getStatuscxx . . $ ReasoningKernel#getStatus(6b8689a3d707128a).() >= kbCCheckedcxx . . $ kbCChecked.; } |
| 580 | /// return classification status of KB |
| 581 | bool isKBClassifiedcxx . . $ ReasoningKernel#isKBClassified(50ce9a9e25b4a850). ( void ) const { return getStatuscxx . . $ ReasoningKernel#getStatus(6b8689a3d707128a).() >= kbClassifiedcxx . . $ kbClassified.; } |
| 582 | /// return realisation status of KB |
| 583 | bool isKBRealisedcxx . . $ ReasoningKernel#isKBRealised(50ce9a9e25b4a850). ( void ) const { return getStatuscxx . . $ ReasoningKernel#getStatus(6b8689a3d707128a).() >= kbRealisedcxx . . $ kbRealised.; } |
| 584 | |
| 585 | /// set Progress monitor to control the classification process |
| 586 | void setProgressMonitorcxx . . $ ReasoningKernel#setProgressMonitor(192f8d731e56d7e3). ( TProgressMonitorcxx . . $ TProgressMonitor#* pMon ) |
| 587 | { |
| 588 | delete pMonitorcxx . . $ ReasoningKernel#pMonitor.; |
| 589 | pMonitorcxx . . $ ReasoningKernel#pMonitor. = pMon; |
| 590 | if ( pTBoxcxx . . $ ReasoningKernel#pTBox. != nullptr ) |
| 591 | pTBoxcxx . . $ ReasoningKernel#pTBox.->setProgressMonitorcxx . . $ TBox#setProgressMonitor(192f8d731e56d7e3).(pMon); |
| 592 | } |
| 593 | /// set verbose output (ie, concept and role taxonomies) wrt given VALUE |
| 594 | void setVerboseOutputcxx . . $ ReasoningKernel#setVerboseOutput(b45ddcbc8423892c). ( bool value ) |
| 595 | { |
| 596 | verboseOutputcxx . . $ ReasoningKernel#verboseOutput. = value; |
| 597 | if ( pTBoxcxx . . $ ReasoningKernel#pTBox. != nullptr ) |
| 598 | pTBoxcxx . . $ ReasoningKernel#pTBox.->setVerboseOutputcxx . . $ TBox#setVerboseOutput(b45ddcbc8423892c).(value); |
| 599 | } |
| 600 | /// (dis-)allow reasoner to use the undefined names in queries |
| 601 | void setUseUndefinedNamescxx . . $ ReasoningKernel#setUseUndefinedNames(b45ddcbc8423892c). ( bool value ) |
| 602 | { |
| 603 | useUndefinedNamescxx . . $ ReasoningKernel#useUndefinedNames. = value; |
| 604 | if ( pTBoxcxx . . $ ReasoningKernel#pTBox. != nullptr ) |
| 605 | pTBoxcxx . . $ ReasoningKernel#pTBox.->setUseUndefinedNamescxx . . $ TBox#setUseUndefinedNames(b45ddcbc8423892c).(value); |
| 606 | } |
| 607 | |
| 608 | TaxonomyVertexcxx . . $ TaxonomyVertex# *setUpCachecxx . . $ ReasoningKernel#setUpCache(fe31c03579dbb287). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr# *C ) |
| 609 | { |
| 610 | realiseKBcxx . . $ ReasoningKernel#realiseKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 611 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( C, csClassifiedcxx . . $ ReasoningKernel#csClassified. ); |
| 612 | return cachedVertexcxx . . $ ReasoningKernel#cachedVertex.; |
| 613 | } |
| 614 | |
| 615 | /// set top/bottom role names to use them in the related output |
| 616 | void setTopBottomRoleNamescxx . . $ ReasoningKernel#setTopBottomRoleNames(292f14abfe735e66). ( const char* topORoleName, const char* botORoleName, const char* topDRoleName, const char* botDRoleName ) |
| 617 | { |
| 618 | TopORoleNamecxx . . $ ReasoningKernel#TopORoleName. =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). topORoleName; |
| 619 | BotORoleNamecxx . . $ ReasoningKernel#BotORoleName. =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). botORoleName; |
| 620 | TopDRoleNamecxx . . $ ReasoningKernel#TopDRoleName. =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). topDRoleName; |
| 621 | BotDRoleNamecxx . . $ ReasoningKernel#BotDRoleName. =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). botDRoleName; |
| 622 | // make sure expression manager knows the top/bot names |
| 623 | Ontologycxx . . $ ReasoningKernel#Ontology..getExpressionManagercxx . . $ TOntology#getExpressionManager(867f96a8caac8aab).()->setTopBottomRolescxx . . $ TExpressionManager#setTopBottomRoles(292f14abfe735e66). ( topORoleName, botORoleName,topDRoleName, botDRoleName ); |
| 624 | } |
| 625 | |
| 626 | /// dump query processing TIME, reasoning statistics and a (preprocessed) TBox |
| 627 | void writeReasoningResultcxx . . $ ReasoningKernel#writeReasoningResult(6d452f970b0e0b13). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o, float time ) |
| 628 | { |
| 629 | getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->clearQueryConceptcxx . . $ TBox#clearQueryConcept(49f6e7a06ebc5aa8).(); // get rid of the query leftovers |
| 630 | getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->writeReasoningResultcxx . . $ TBox#writeReasoningResult(2d0f4d08371733d). ( o, time ); |
| 631 | } |
| 632 | |
| 633 | /// set timeout value to VALUE |
| 634 | void setOperationTimeoutcxx . . $ ReasoningKernel#setOperationTimeout(2c44cd906ae4e829). ( unsigned long value ) |
| 635 | { |
| 636 | OpTimeoutcxx . . $ ReasoningKernel#OpTimeout. = value; |
| 637 | if ( pTBoxcxx . . $ ReasoningKernel#pTBox. != nullptr ) |
| 638 | pTBoxcxx . . $ ReasoningKernel#pTBox.->setTestTimeoutcxx . . $ TBox#setTestTimeout(2c44cd906ae4e829).(value); |
| 639 | } |
| 640 | /// choose whether TExpr cache should be ignored |
| 641 | void setIgnoreExprCachecxx . . $ ReasoningKernel#setIgnoreExprCache(b45ddcbc8423892c). ( bool value ) { ignoreExprCachecxx . . $ ReasoningKernel#ignoreExprCache. = value; } |
| 642 | /// choose whether incremental reasoning should be used |
| 643 | void setUseIncrementalReasoningcxx . . $ ReasoningKernel#setUseIncrementalReasoning(b45ddcbc8423892c). ( bool value ) { useIncrementalReasoningcxx . . $ ReasoningKernel#useIncrementalReasoning. = value; } |
| 644 | /// set the signature of the expression translator |
| 645 | void setSignaturecxx . . $ ReasoningKernel#setSignature(63821116a1afc694). ( const TSignaturecxx . . $ TSignature#* sig ) { if ( pETcxx . . $ ReasoningKernel#pET. != nullptr ) pETcxx . . $ ReasoningKernel#pET.->setSignaturecxx . . $ TExpressionTranslator#setSignature(63821116a1afc694).(sig); } |
| 646 | /// choose whether the loaded ontology should be dumped as a LISP one |
| 647 | void setDumpOntologycxx . . $ ReasoningKernel#setDumpOntology(b45ddcbc8423892c). ( bool value ) { dumpOntologycxx . . $ ReasoningKernel#dumpOntology. = value; } |
| 648 | |
| 649 | /// dump ontology as a LISP one |
| 650 | void dumpLISPcxx . . $ ReasoningKernel#dumpLISP(f7f45734e6842120). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& ); |
| 651 | |
| 652 | //---------------------------------------------- |
| 653 | //-- Tracing support |
| 654 | //---------------------------------------------- |
| 655 | |
| 656 | /// tells reasoner that the next reasoning operation shall gather the trace |
| 657 | void needTracingcxx . . $ ReasoningKernel#needTracing(49f6e7a06ebc5aa8). ( void ) { NeedTracingcxx . . $ ReasoningKernel#NeedTracing. = true; } |
| 658 | /// @return the trace-set of the last reasoning operation |
| 659 | const AxiomVeccxx . . $ AxiomVec#& getTracecxx . . $ ReasoningKernel#getTrace(79ac1a314ac30759). ( void ) |
| 660 | { |
| 661 | TraceVeccxx . . $ ReasoningKernel#TraceVec..clearcxx . . $ std/vector#clear(49f6e7a06ebc5aa8).(); |
| 662 | return TraceVeccxx . . $ ReasoningKernel#TraceVec.; |
| 663 | } |
| 664 | |
| 665 | /// get access to an expression manager |
| 666 | TExpressionManagercxx . . $ TExpressionManager#* getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab). ( void ) { return Ontologycxx . . $ ReasoningKernel#Ontology..getExpressionManagercxx . . $ TOntology#getExpressionManager(867f96a8caac8aab).(); } |
| 667 | /// get RW access to the ontology |
| 668 | TOntologycxx . . $ TOntology#& getOntologycxx . . $ ReasoningKernel#getOntology(df3ff36553523908). ( void ) { return Ontologycxx . . $ ReasoningKernel#Ontology.; } |
| 669 | /// get RO access to the ontology |
| 670 | const TOntologycxx . . $ TOntology#& getOntologycxx . . $ ReasoningKernel#getOntology(173fe9f0c1357e56). ( void ) const { return Ontologycxx . . $ ReasoningKernel#Ontology.; } |
| 671 | |
| 672 | /// set JNI cache |
| 673 | void setJNICachecxx . . $ ReasoningKernel#setJNICache(b98b8f62a7620642). ( TJNICachecxx . . $ TJNICache#* cache ) { JNICachecxx . . $ ReasoningKernel#JNICache. = cache; } |
| 674 | /// get JNI cache |
| 675 | TJNICachecxx . . $ TJNICache#* getJNICachecxx . . $ ReasoningKernel#getJNICache(df3524cd6bc4c4bc). ( void ) const { return JNICachecxx . . $ ReasoningKernel#JNICache.; } |
| 676 | |
| 677 | public: |
| 678 | //****************************************** |
| 679 | //* KB Management |
| 680 | //****************************************** |
| 681 | |
| 682 | /// create new KB |
| 683 | bool newKBcxx . . $ ReasoningKernel#newKB(c9857a73d68e59ba). ( void ) |
| 684 | { |
| 685 | if ( pTBoxcxx . . $ ReasoningKernel#pTBox. != nullptr ) |
| 686 | return true; |
| 687 | |
| 688 | pTBoxcxx . . $ ReasoningKernel#pTBox. = new TBoxcxx . . $ TBox#TBox(da4a163a7cd92f4d). ( getOptionscxx . . $ ReasoningKernel#getOptions(d018531a31ef00c8).(), TopORoleNamecxx . . $ ReasoningKernel#TopORoleName., BotORoleNamecxx . . $ ReasoningKernel#BotORoleName., TopDRoleNamecxx . . $ ReasoningKernel#TopDRoleName., BotDRoleNamecxx . . $ ReasoningKernel#BotDRoleName. ); |
| 689 | pTBoxcxx . . $ ReasoningKernel#pTBox.->setTestTimeoutcxx . . $ TBox#setTestTimeout(2c44cd906ae4e829).(OpTimeoutcxx . . $ ReasoningKernel#OpTimeout.); |
| 690 | pTBoxcxx . . $ ReasoningKernel#pTBox.->setProgressMonitorcxx . . $ TBox#setProgressMonitor(192f8d731e56d7e3).(pMonitorcxx . . $ ReasoningKernel#pMonitor.); |
| 691 | pTBoxcxx . . $ ReasoningKernel#pTBox.->setVerboseOutputcxx . . $ TBox#setVerboseOutput(b45ddcbc8423892c).(verboseOutputcxx . . $ ReasoningKernel#verboseOutput.); |
| 692 | pTBoxcxx . . $ ReasoningKernel#pTBox.->setUseUndefinedNamescxx . . $ TBox#setUseUndefinedNames(b45ddcbc8423892c).(useUndefinedNamescxx . . $ ReasoningKernel#useUndefinedNames.); |
| 693 | pETcxx . . $ ReasoningKernel#pET. = new TExpressionTranslatorcxx . . $ TExpressionTranslator#(*pTBoxcxx . . $ ReasoningKernel#pTBox.); |
| 694 | initCacheAndFlagscxx . . $ ReasoningKernel#initCacheAndFlags(49f6e7a06ebc5aa8).(); |
| 695 | return false; |
| 696 | } |
| 697 | /// delete existed KB |
| 698 | bool releaseKBcxx . . $ ReasoningKernel#releaseKB(c9857a73d68e59ba). ( void ) |
| 699 | { |
| 700 | clearTBoxcxx . . $ ReasoningKernel#clearTBox(49f6e7a06ebc5aa8).(); |
| 701 | Ontologycxx . . $ ReasoningKernel#Ontology..clearcxx . . $ TOntology#clear(49f6e7a06ebc5aa8).(); |
| 702 | // the new KB is coming so the failures of the precious one doesn't matter |
| 703 | reasoningFailedcxx . . $ ReasoningKernel#reasoningFailed. = false; |
| 704 | |
| 705 | return false; |
| 706 | } |
| 707 | /// reset current KB |
| 708 | bool clearKBcxx . . $ ReasoningKernel#clearKB(c9857a73d68e59ba). ( void ) |
| 709 | { |
| 710 | if ( pTBoxcxx . . $ ReasoningKernel#pTBox. == nullptr ) |
| 711 | return true; |
| 712 | return releaseKBcxx . . $ ReasoningKernel#releaseKB(c9857a73d68e59ba). () || newKBcxx . . $ ReasoningKernel#newKB(c9857a73d68e59ba). (); |
| 713 | } |
| 714 | |
| 715 | /// get RW access to TBox |
| 716 | TBoxcxx . . $ TBox#* getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).(void) |
| 717 | { |
| 718 | checkTBoxcxx . . $ ReasoningKernel#checkTBox(83f5f38750778ac8).(); return pTBoxcxx . . $ ReasoningKernel#pTBox.; |
| 719 | } |
| 720 | /// get RO access to TBox |
| 721 | const TBoxcxx . . $ TBox#* getTBoxcxx . . $ ReasoningKernel#getTBox(996447d18c446891).(void) const |
| 722 | { |
| 723 | checkTBoxcxx . . $ ReasoningKernel#checkTBox(83f5f38750778ac8).(); return pTBoxcxx . . $ ReasoningKernel#pTBox.; |
| 724 | } |
| 725 | |
| 726 | //---------------------------------------------------- |
| 727 | // TELLS interface |
| 728 | //---------------------------------------------------- |
| 729 | |
| 730 | // Declaration axioms |
| 731 | |
| 732 | /// axiom declare(x) |
| 733 | TDLAxiomcxx . . $ TDLAxiom#* declarecxx . . $ ReasoningKernel#declare(6ee6f6ac494558bc). ( TExprcxx . . $ ReasoningKernel#TExpr#* C ) { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb).(new TDLAxiomDeclarationcxx . . $ TDLAxiomDeclaration#TDLAxiomDeclaration(ca1ea7df707d7472).(C)); } |
| 734 | |
| 735 | // Concept axioms |
| 736 | |
| 737 | /// axiom C [= D |
| 738 | TDLAxiomcxx . . $ TDLAxiom#* impliesConceptscxx . . $ ReasoningKernel#impliesConcepts(9ddbe9740182b8be). ( TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C, TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* D ) |
| 739 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomConceptInclusioncxx . . $ TDLAxiomConceptInclusion#TDLAxiomConceptInclusion(cea5631087b55cdd). ( C, D ) ); } |
| 740 | /// axiom C1 = ... = Cn |
| 741 | TDLAxiomcxx . . $ TDLAxiom#* equalConceptscxx . . $ ReasoningKernel#equalConcepts(a85f767f1601b331). ( void ) |
| 742 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomEquivalentConceptscxx . . $ TDLAxiomEquivalentConcepts#TDLAxiomEquivalentConcepts(d9b6f75bcac4e62b).(getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->getArgListcxx . . $ TExpressionManager#getArgList(ea12e55bef799de0).()) ); } |
| 743 | /// axiom C1 != ... != Cn |
| 744 | TDLAxiomcxx . . $ TDLAxiom#* disjointConceptscxx . . $ ReasoningKernel#disjointConcepts(a85f767f1601b331). ( void ) |
| 745 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomDisjointConceptscxx . . $ TDLAxiomDisjointConcepts#TDLAxiomDisjointConcepts(d9b6f75bcac4e62b).(getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->getArgListcxx . . $ TExpressionManager#getArgList(ea12e55bef799de0).()) ); } |
| 746 | /// axiom C = C1 or ... or Cn; C1 != ... != Cn |
| 747 | TDLAxiomcxx . . $ TDLAxiom#* disjointUnioncxx . . $ ReasoningKernel#disjointUnion(3872582c9feb4622). ( TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C ) |
| 748 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomDisjointUnioncxx . . $ TDLAxiomDisjointUnion#TDLAxiomDisjointUnion(3504b3f486c42056). ( C, getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->getArgListcxx . . $ TExpressionManager#getArgList(ea12e55bef799de0).() ) ); } |
| 749 | |
| 750 | |
| 751 | // Role axioms |
| 752 | |
| 753 | /// R = Inverse(S) |
| 754 | TDLAxiomcxx . . $ TDLAxiom#* setInverseRolescxx . . $ ReasoningKernel#setInverseRoles(2f1b9e1d366167c7). ( TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R, TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* S ) |
| 755 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomRoleInversecxx . . $ TDLAxiomRoleInverse#TDLAxiomRoleInverse(9e5cc97aabeb9892).(R,S) ); } |
| 756 | /// axiom (R [= S) |
| 757 | TDLAxiomcxx . . $ TDLAxiom#* impliesORolescxx . . $ ReasoningKernel#impliesORoles(fbb992326ec74be0). ( TORoleComplexExprcxx . . $ ReasoningKernel#TORoleComplexExpr#* R, TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* S ) |
| 758 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomORoleSubsumptioncxx . . $ TDLAxiomORoleSubsumption#TDLAxiomORoleSubsumption(79146013c135ae6f). ( R, S ) ); } |
| 759 | /// axiom (R [= S) |
| 760 | TDLAxiomcxx . . $ TDLAxiom#* impliesDRolescxx . . $ ReasoningKernel#impliesDRoles(d0244c75cc050b68). ( TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* R, TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* S ) |
| 761 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomDRoleSubsumptioncxx . . $ TDLAxiomDRoleSubsumption#TDLAxiomDRoleSubsumption(dc9d1d1baf3f78c1). ( R, S ) ); } |
| 762 | /// axiom R1 = R2 = ... |
| 763 | TDLAxiomcxx . . $ TDLAxiom#* equalORolescxx . . $ ReasoningKernel#equalORoles(a85f767f1601b331). ( void ) |
| 764 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomEquivalentORolescxx . . $ TDLAxiomEquivalentORoles#TDLAxiomEquivalentORoles(d9b6f75bcac4e62b).(getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->getArgListcxx . . $ TExpressionManager#getArgList(ea12e55bef799de0).()) ); } |
| 765 | /// axiom R1 = R2 = ... |
| 766 | TDLAxiomcxx . . $ TDLAxiom#* equalDRolescxx . . $ ReasoningKernel#equalDRoles(a85f767f1601b331). ( void ) |
| 767 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomEquivalentDRolescxx . . $ TDLAxiomEquivalentDRoles#TDLAxiomEquivalentDRoles(d9b6f75bcac4e62b).(getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->getArgListcxx . . $ TExpressionManager#getArgList(ea12e55bef799de0).()) ); } |
| 768 | /// axiom R1 != R2 != ... |
| 769 | TDLAxiomcxx . . $ TDLAxiom#* disjointORolescxx . . $ ReasoningKernel#disjointORoles(a85f767f1601b331). ( void ) |
| 770 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomDisjointORolescxx . . $ TDLAxiomDisjointORoles#TDLAxiomDisjointORoles(d9b6f75bcac4e62b).(getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->getArgListcxx . . $ TExpressionManager#getArgList(ea12e55bef799de0).()) ); } |
| 771 | /// axiom R1 != R2 != ... |
| 772 | TDLAxiomcxx . . $ TDLAxiom#* disjointDRolescxx . . $ ReasoningKernel#disjointDRoles(a85f767f1601b331). ( void ) |
| 773 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomDisjointDRolescxx . . $ TDLAxiomDisjointDRoles#TDLAxiomDisjointDRoles(d9b6f75bcac4e62b).(getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->getArgListcxx . . $ TExpressionManager#getArgList(ea12e55bef799de0).()) ); } |
| 774 | |
| 775 | /// Domain (R C) |
| 776 | TDLAxiomcxx . . $ TDLAxiom#* setODomaincxx . . $ ReasoningKernel#setODomain(c79d55885bb7c543). ( TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R, TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C ) |
| 777 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomORoleDomaincxx . . $ TDLAxiomORoleDomain#TDLAxiomORoleDomain(609642eea48c4756). ( R, C ) ); } |
| 778 | /// Domain (R C) |
| 779 | TDLAxiomcxx . . $ TDLAxiom#* setDDomaincxx . . $ ReasoningKernel#setDDomain(e6d691fd9fca005). ( TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* R, TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C ) |
| 780 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomDRoleDomaincxx . . $ TDLAxiomDRoleDomain#TDLAxiomDRoleDomain(74b77535b23c0ee1). ( R, C ) ); } |
| 781 | /// Range (R C) |
| 782 | TDLAxiomcxx . . $ TDLAxiom#* setORangecxx . . $ ReasoningKernel#setORange(c79d55885bb7c543). ( TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R, TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C ) |
| 783 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomORoleRangecxx . . $ TDLAxiomORoleRange#TDLAxiomORoleRange(609642eea48c4756). ( R, C ) ); } |
| 784 | /// Range (R E) |
| 785 | TDLAxiomcxx . . $ TDLAxiom#* setDRangecxx . . $ ReasoningKernel#setDRange(53740e2aac823450). ( TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* R, TDataExprcxx . . $ ReasoningKernel#TDataExpr#* E ) |
| 786 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomDRoleRangecxx . . $ TDLAxiomDRoleRange#TDLAxiomDRoleRange(8674b0a595b76b2d). ( R, E ) ); } |
| 787 | |
| 788 | /// Transitive (R) |
| 789 | TDLAxiomcxx . . $ TDLAxiom#* setTransitivecxx . . $ ReasoningKernel#setTransitive(de8740941eccd406). ( TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 790 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomRoleTransitivecxx . . $ TDLAxiomRoleTransitive#TDLAxiomRoleTransitive(4301d0bef5e81149).(R) ); } |
| 791 | /// Reflexive (R) |
| 792 | TDLAxiomcxx . . $ TDLAxiom#* setReflexivecxx . . $ ReasoningKernel#setReflexive(de8740941eccd406). ( TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 793 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomRoleReflexivecxx . . $ TDLAxiomRoleReflexive#TDLAxiomRoleReflexive(4301d0bef5e81149).(R) ); } |
| 794 | /// Irreflexive (R): Domain(R) = \neg ER.Self |
| 795 | TDLAxiomcxx . . $ TDLAxiom#* setIrreflexivecxx . . $ ReasoningKernel#setIrreflexive(de8740941eccd406). ( TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 796 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomRoleIrreflexivecxx . . $ TDLAxiomRoleIrreflexive#TDLAxiomRoleIrreflexive(4301d0bef5e81149).(R) ); } |
| 797 | /// Symmetric (R): R [= R^- |
| 798 | TDLAxiomcxx . . $ TDLAxiom#* setSymmetriccxx . . $ ReasoningKernel#setSymmetric(de8740941eccd406). ( TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 799 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomRoleSymmetriccxx . . $ TDLAxiomRoleSymmetric#TDLAxiomRoleSymmetric(4301d0bef5e81149).(R) ); } |
| 800 | /// Asymmetric (R): disjoint(R,R^-) |
| 801 | TDLAxiomcxx . . $ TDLAxiom#* setAsymmetriccxx . . $ ReasoningKernel#setAsymmetric(de8740941eccd406). ( TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 802 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomRoleAsymmetriccxx . . $ TDLAxiomRoleAsymmetric#TDLAxiomRoleAsymmetric(4301d0bef5e81149).(R) ); } |
| 803 | /// Functional (R) |
| 804 | TDLAxiomcxx . . $ TDLAxiom#* setOFunctionalcxx . . $ ReasoningKernel#setOFunctional(de8740941eccd406). ( TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 805 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomORoleFunctionalcxx . . $ TDLAxiomORoleFunctional#TDLAxiomORoleFunctional(4301d0bef5e81149).(R) ); } |
| 806 | /// Functional (R) |
| 807 | TDLAxiomcxx . . $ TDLAxiom#* setDFunctionalcxx . . $ ReasoningKernel#setDFunctional(6ede7e710a8dc4ea). ( TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* R ) |
| 808 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomDRoleFunctionalcxx . . $ TDLAxiomDRoleFunctional#TDLAxiomDRoleFunctional(9eb5227bbe3ab2ee).(R) ); } |
| 809 | /// InverseFunctional (R) |
| 810 | TDLAxiomcxx . . $ TDLAxiom#* setInverseFunctionalcxx . . $ ReasoningKernel#setInverseFunctional(de8740941eccd406). ( TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 811 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomRoleInverseFunctionalcxx . . $ TDLAxiomRoleInverseFunctional#TDLAxiomRoleInverseFunctional(4301d0bef5e81149).(R) ); } |
| 812 | |
| 813 | |
| 814 | // Individual axioms |
| 815 | |
| 816 | /// axiom I e C |
| 817 | TDLAxiomcxx . . $ TDLAxiom#* instanceOfcxx . . $ ReasoningKernel#instanceOf(6f0498ee11afa2a2). ( TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C ) |
| 818 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomInstanceOfcxx . . $ TDLAxiomInstanceOf#TDLAxiomInstanceOf(71e48d85c73e08ad).(I,C) ); } |
| 819 | /// axiom <I,J>:R |
| 820 | TDLAxiomcxx . . $ TDLAxiom#* relatedTocxx . . $ ReasoningKernel#relatedTo(463e07427a10fcd0). ( TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R, TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* J ) |
| 821 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomRelatedTocxx . . $ TDLAxiomRelatedTo#TDLAxiomRelatedTo(63c3acd70b9eac0f).(I,R,J) ); } |
| 822 | /// axiom <I,J>:\neg R |
| 823 | TDLAxiomcxx . . $ TDLAxiom#* relatedToNotcxx . . $ ReasoningKernel#relatedToNot(463e07427a10fcd0). ( TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R, TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* J ) |
| 824 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomRelatedToNotcxx . . $ TDLAxiomRelatedToNot#TDLAxiomRelatedToNot(63c3acd70b9eac0f).(I,R,J) ); } |
| 825 | /// axiom (value I A V) |
| 826 | TDLAxiomcxx . . $ TDLAxiom#* valueOfcxx . . $ ReasoningKernel#valueOf(37daa01f957a95bc). ( TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* A, TDataValueExprcxx . . $ ReasoningKernel#TDataValueExpr#* V ) |
| 827 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomValueOfcxx . . $ TDLAxiomValueOf#TDLAxiomValueOf(187f3ad1159feac8).(I,A,V) ); } |
| 828 | /// axiom <I,V>:\neg A |
| 829 | TDLAxiomcxx . . $ TDLAxiom#* valueOfNotcxx . . $ ReasoningKernel#valueOfNot(37daa01f957a95bc). ( TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* A, TDataValueExprcxx . . $ ReasoningKernel#TDataValueExpr#* V ) |
| 830 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomValueOfNotcxx . . $ TDLAxiomValueOfNot#TDLAxiomValueOfNot(187f3ad1159feac8).(I,A,V) ); } |
| 831 | /// same individuals |
| 832 | TDLAxiomcxx . . $ TDLAxiom#* processSamecxx . . $ ReasoningKernel#processSame(a85f767f1601b331). ( void ) |
| 833 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomSameIndividualscxx . . $ TDLAxiomSameIndividuals#TDLAxiomSameIndividuals(d9b6f75bcac4e62b).(getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->getArgListcxx . . $ TExpressionManager#getArgList(ea12e55bef799de0).()) ); } |
| 834 | /// different individuals |
| 835 | TDLAxiomcxx . . $ TDLAxiom#* processDifferentcxx . . $ ReasoningKernel#processDifferent(a85f767f1601b331). ( void ) |
| 836 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomDifferentIndividualscxx . . $ TDLAxiomDifferentIndividuals#TDLAxiomDifferentIndividuals(d9b6f75bcac4e62b).(getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->getArgListcxx . . $ TExpressionManager#getArgList(ea12e55bef799de0).()) ); } |
| 837 | /// let all concept expressions in the ArgQueue to be fairness constraints |
| 838 | TDLAxiomcxx . . $ TDLAxiom#* setFairnessConstraintcxx . . $ ReasoningKernel#setFairnessConstraint(a85f767f1601b331). ( void ) |
| 839 | { return Ontologycxx . . $ ReasoningKernel#Ontology..addcxx . . $ TOntology#add(c8492b07f0d2e9fb). ( new TDLAxiomFairnessConstraintcxx . . $ TDLAxiomFairnessConstraint#TDLAxiomFairnessConstraint(d9b6f75bcac4e62b).(getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->getArgListcxx . . $ TExpressionManager#getArgList(ea12e55bef799de0).()) ); } |
| 840 | |
| 841 | /// retract an axiom |
| 842 | void retractcxx . . $ ReasoningKernel#retract(ade74f2f8b540a23). ( TDLAxiomcxx . . $ TDLAxiom#* axiom ) { Ontologycxx . . $ ReasoningKernel#Ontology..retractcxx . . $ TOntology#retract(ade74f2f8b540a23).(axiom); } |
| 843 | |
| 844 | //****************************************** |
| 845 | //* ASK part |
| 846 | //****************************************** |
| 847 | |
| 848 | /* |
| 849 | * Before execution of any query the Kernel make sure that the KB is in an appropriate |
| 850 | * state: Preprocessed, Classified or Realised. If the ontology was changed between asks, |
| 851 | * incremental classification is performed and the corrected result is returned. |
| 852 | */ |
| 853 | |
| 854 | /// return consistency status of KB |
| 855 | bool isKBConsistentcxx . . $ ReasoningKernel#isKBConsistent(c9857a73d68e59ba). ( void ) |
| 856 | { |
| 857 | try { |
| 858 | if ( getStatuscxx . . $ ReasoningKernel#getStatus(6b8689a3d707128a).() <= kbLoadingcxx . . $ kbLoading. ) |
| 859 | processKBcxx . . $ ReasoningKernel#processKB(9496fe1b27827f43).(kbCCheckedcxx . . $ kbCChecked.); |
| 860 | return getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->isConsistentcxx . . $ TBox#isConsistent(c9857a73d68e59ba).(); |
| 861 | } |
| 862 | catch ( const EFPPInconsistentKBcxx . . $ EFPPInconsistentKB#& ) |
| 863 | { return false; } |
| 864 | } |
| 865 | /// ensure that KB is preprocessed/consistence checked |
| 866 | void preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8). ( void ) |
| 867 | { |
| 868 | if ( !isKBConsistentcxx . . $ ReasoningKernel#isKBConsistent(c9857a73d68e59ba).() ) |
| 869 | throw EFPPInconsistentKBcxx . . $ EFPPInconsistentKB#EFPPInconsistentKB(49f6e7a06ebc5aa8).(); |
| 870 | } |
| 871 | /// ensure that KB is classified |
| 872 | void classifyKBcxx . . $ ReasoningKernel#classifyKB(49f6e7a06ebc5aa8). ( void ) |
| 873 | { |
| 874 | if ( !isKBClassifiedcxx . . $ ReasoningKernel#isKBClassified(50ce9a9e25b4a850).() ) |
| 875 | processKBcxx . . $ ReasoningKernel#processKB(9496fe1b27827f43).(kbClassifiedcxx . . $ kbClassified.); |
| 876 | if ( !isKBConsistentcxx . . $ ReasoningKernel#isKBConsistent(c9857a73d68e59ba).() ) |
| 877 | throw EFPPInconsistentKBcxx . . $ EFPPInconsistentKB#EFPPInconsistentKB(49f6e7a06ebc5aa8).(); |
| 878 | } |
| 879 | /// ensure that KB is realised |
| 880 | void realiseKBcxx . . $ ReasoningKernel#realiseKB(49f6e7a06ebc5aa8). ( void ) |
| 881 | { |
| 882 | if ( !isKBRealisedcxx . . $ ReasoningKernel#isKBRealised(50ce9a9e25b4a850).() ) |
| 883 | processKBcxx . . $ ReasoningKernel#processKB(9496fe1b27827f43).(kbRealisedcxx . . $ kbRealised.); |
| 884 | if ( !isKBConsistentcxx . . $ ReasoningKernel#isKBConsistent(c9857a73d68e59ba).() ) |
| 885 | throw EFPPInconsistentKBcxx . . $ EFPPInconsistentKB#EFPPInconsistentKB(49f6e7a06ebc5aa8).(); |
| 886 | } |
| 887 | |
| 888 | // role info retrieval |
| 889 | |
| 890 | /// @return true iff object role is functional |
| 891 | bool isFunctionalcxx . . $ ReasoningKernel#isFunctional(8fc77c3492e4f36b). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 892 | { |
| 893 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 894 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isFunctional()" ); |
| 895 | if ( unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(r->isTop()) ) |
| 896 | return false; // universal role is not functional |
| 897 | if ( unlikelycxx . . $ TNamedEntry#isBottom(50ce9a9e25b4a850).(r->isBottom()) ) |
| 898 | return true; // empty role is functional |
| 899 | |
| 900 | return getFunctionalitycxx . . $ ReasoningKernel#getFunctionality(c325380d1afc00f8).(r); |
| 901 | } |
| 902 | /// @return true iff data role is functional |
| 903 | bool isFunctionalcxx . . $ ReasoningKernel#isFunctional(f368119995a8beee). ( const TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* R ) |
| 904 | { |
| 905 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 906 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isFunctional()" ); |
| 907 | if ( unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(r->isTop()) ) |
| 908 | return false; // universal role is not functional |
| 909 | if ( unlikelycxx . . $ TNamedEntry#isBottom(50ce9a9e25b4a850).(r->isBottom()) ) |
| 910 | return true; // empty role is functional |
| 911 | |
| 912 | return getFunctionalitycxx . . $ ReasoningKernel#getFunctionality(c325380d1afc00f8).(r); |
| 913 | } |
| 914 | /// @return true iff role is inverse-functional |
| 915 | bool isInverseFunctionalcxx . . $ ReasoningKernel#isInverseFunctional(8fc77c3492e4f36b). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 916 | { |
| 917 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 918 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isInverseFunctional()" )->inversecxx . . $ TRole#inverse(6cda9dc08d29302e).(); |
| 919 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(r->isTop()) ) |
| 920 | return false; // universal role is not functional |
| 921 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(r->isBottom()) ) |
| 922 | return true; // empty role is functional |
| 923 | |
| 924 | return getFunctionalitycxx . . $ ReasoningKernel#getFunctionality(c325380d1afc00f8).(r); |
| 925 | } |
| 926 | /// @return true iff role is transitive |
| 927 | bool isTransitivecxx . . $ ReasoningKernel#isTransitive(8fc77c3492e4f36b). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 928 | { |
| 929 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 930 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isTransitive()" ); |
| 931 | if ( unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(r->isTop()) ) |
| 932 | return true; // universal role is transitive |
| 933 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(r->isBottom()) ) |
| 934 | return true; // empty role is transitive |
| 935 | |
| 936 | if ( !r->isTransitivityKnowncxx . . $ TRole#isTransitivityKnown(50ce9a9e25b4a850).() ) // calculate transitivity |
| 937 | r->setTransitivecxx . . $ TRole#setTransitive(b45ddcbc8423892c).(checkTransitivitycxx . . $ ReasoningKernel#checkTransitivity(38a18fab043f8799).(ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(R))); |
| 938 | return r->isTransitivecxx . . $ TRole#isTransitive(50ce9a9e25b4a850).(); |
| 939 | } |
| 940 | /// @return true iff role is symmetric |
| 941 | bool isSymmetriccxx . . $ ReasoningKernel#isSymmetric(8fc77c3492e4f36b). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 942 | { |
| 943 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 944 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isSymmetric()" ); |
| 945 | if ( unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(r->isTop()) ) |
| 946 | return true; // universal role is symmetric |
| 947 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(r->isBottom()) ) |
| 948 | return true; // empty role is symmetric |
| 949 | |
| 950 | if ( !r->isSymmetryKnowncxx . . $ TRole#isSymmetryKnown(50ce9a9e25b4a850).() ) // calculate symmetry |
| 951 | r->setSymmetriccxx . . $ TRole#setSymmetric(b45ddcbc8423892c).(checkSymmetrycxx . . $ ReasoningKernel#checkSymmetry(38a18fab043f8799).(ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(R))); |
| 952 | return r->isSymmetriccxx . . $ TRole#isSymmetric(50ce9a9e25b4a850).(); |
| 953 | } |
| 954 | /// @return true iff role is asymmetric |
| 955 | bool isAsymmetriccxx . . $ ReasoningKernel#isAsymmetric(8fc77c3492e4f36b). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 956 | { |
| 957 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 958 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isAsymmetric()" ); |
| 959 | if ( unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(r->isTop()) ) |
| 960 | return false; // universal role is not asymmetric |
| 961 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(r->isBottom()) ) |
| 962 | return true; // empty role is asymmetric |
| 963 | |
| 964 | if ( !r->isAsymmetryKnowncxx . . $ TRole#isAsymmetryKnown(50ce9a9e25b4a850).() ) // calculate asymmetry |
| 965 | r->setAsymmetriccxx . . $ TRole#setAsymmetric(b45ddcbc8423892c).(getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->isDisjointRolescxx . . $ TBox#isDisjointRoles(ee962dbb2fa027b9).(r,r->inversecxx . . $ TRole#inverse(6cda9dc08d29302e).())); |
| 966 | return r->isAsymmetriccxx . . $ TRole#isAsymmetric(50ce9a9e25b4a850).(); |
| 967 | } |
| 968 | /// @return true iff role is reflexive |
| 969 | bool isReflexivecxx . . $ ReasoningKernel#isReflexive(8fc77c3492e4f36b). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 970 | { |
| 971 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 972 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isReflexive()" ); |
| 973 | if ( unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(r->isTop()) ) |
| 974 | return true; // universal role is reflexive |
| 975 | if ( unlikelycxx . . $ TNamedEntry#isBottom(50ce9a9e25b4a850).(r->isBottom()) ) |
| 976 | return false; // empty role is not reflexive |
| 977 | |
| 978 | if ( !r->isReflexivityKnowncxx . . $ TRole#isReflexivityKnown(50ce9a9e25b4a850).() ) // calculate reflexivity |
| 979 | r->setReflexivecxx . . $ TRole#setReflexive(b45ddcbc8423892c).(checkReflexivitycxx . . $ ReasoningKernel#checkReflexivity(38a18fab043f8799).(ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(R))); |
| 980 | return r->isReflexivecxx . . $ TRole#isReflexive(50ce9a9e25b4a850).(); |
| 981 | } |
| 982 | /// @return true iff role is irreflexive |
| 983 | bool isIrreflexivecxx . . $ ReasoningKernel#isIrreflexive(8fc77c3492e4f36b). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 984 | { |
| 985 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 986 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isIrreflexive()" ); |
| 987 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(r->isTop()) ) |
| 988 | return false; // universal role is not irreflexive |
| 989 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(r->isBottom()) ) |
| 990 | return true; // empty role is irreflexive |
| 991 | |
| 992 | if ( !r->isIrreflexivityKnowncxx . . $ TRole#isIrreflexivityKnown(50ce9a9e25b4a850).() ) // calculate irreflexivity |
| 993 | r->setIrreflexivecxx . . $ TRole#setIrreflexive(b45ddcbc8423892c).(getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->isIrreflexivecxx . . $ TBox#isIrreflexive(f4c3e7633be50e77).(r)); |
| 994 | return r->isIrreflexivecxx . . $ TRole#isIrreflexive(50ce9a9e25b4a850).(); |
| 995 | } |
| 996 | /// @return true if R is a sub-role of S |
| 997 | bool isSubRolescxx . . $ ReasoningKernel#isSubRoles(68b0dcd62a26d5fb). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R, const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* S ) |
| 998 | { |
| 999 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1000 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isSubRoles()" ); |
| 1001 | TRolecxx . . $ TRole#* s = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( S, "Role expression expected in isSubRoles()" ); |
| 1002 | if ( unlikelycxx . . $ TNamedEntry#isBottom(50ce9a9e25b4a850).(r->isBottom()) || unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(s->isTop()) ) |
| 1003 | return true; // \bot [= X [= \top |
| 1004 | if ( unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(r->isTop()) && unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(s->isBottom()) ) |
| 1005 | return false; // as \top [= \bot leads to inconsistent ontology |
| 1006 | |
| 1007 | // told case first |
| 1008 | if ( likelycxx . . $ TNamedEntry#isBottom(50ce9a9e25b4a850).(!r->isTop() && !s->isBottom()) ) |
| 1009 | { |
| 1010 | if ( *r <=cxx . . $ TRole#`operator<=`(f855a32f4b5dce26). *s ) |
| 1011 | return true; |
| 1012 | } |
| 1013 | // check the general case |
| 1014 | // FIXME!! cache it later |
| 1015 | return checkRoleSubsumptioncxx . . $ ReasoningKernel#checkRoleSubsumption(b603d592d189a67b). ( r, s ); |
| 1016 | } |
| 1017 | /// @return true if R is a sub-role of S |
| 1018 | bool isSubRolescxx . . $ ReasoningKernel#isSubRoles(1eccbaba8fe97673). ( const TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* R, const TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* S ) |
| 1019 | { |
| 1020 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1021 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isSubRoles()" ); |
| 1022 | TRolecxx . . $ TRole#* s = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( S, "Role expression expected in isSubRoles()" ); |
| 1023 | if ( unlikelycxx . . $ TNamedEntry#isBottom(50ce9a9e25b4a850).(r->isBottom()) || unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(s->isTop()) ) |
| 1024 | return true; // \bot [= X [= \top |
| 1025 | if ( unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(r->isTop()) && unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(s->isBottom()) ) |
| 1026 | return false; // as \top [= \bot leads to inconsistent ontology |
| 1027 | |
| 1028 | // told case first |
| 1029 | if ( likelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(!r->isTop() && !s->isBottom()) ) |
| 1030 | { |
| 1031 | if ( *r <=cxx . . $ TRole#`operator<=`(f855a32f4b5dce26). *s ) |
| 1032 | return true; |
| 1033 | } |
| 1034 | // check the general case |
| 1035 | // FIXME!! cache it later |
| 1036 | return checkRoleSubsumptioncxx . . $ ReasoningKernel#checkRoleSubsumption(b603d592d189a67b). ( r, s ); |
| 1037 | } |
| 1038 | /// @return true iff two roles are disjoint |
| 1039 | bool isDisjointRolescxx . . $ ReasoningKernel#isDisjointRoles(68b0dcd62a26d5fb). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R, const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* S ) |
| 1040 | { |
| 1041 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1042 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isDisjointRoles()" ); |
| 1043 | TRolecxx . . $ TRole#* s = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( S, "Role expression expected in isDisjointRoles()" ); |
| 1044 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(r->isTop()) || unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(s->isTop()) ) |
| 1045 | return false; // universal role is not disjoint with anything |
| 1046 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(r->isBottom()) || unlikelycxx . . $ TNamedEntry#isBottom(50ce9a9e25b4a850).(s->isBottom()) ) |
| 1047 | return true; // empty role is disjoint with everything |
| 1048 | return getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->isDisjointRolescxx . . $ TBox#isDisjointRoles(ee962dbb2fa027b9). ( r, s ); |
| 1049 | } |
| 1050 | /// @return true iff two roles are disjoint |
| 1051 | bool isDisjointRolescxx . . $ ReasoningKernel#isDisjointRoles(1eccbaba8fe97673). ( const TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* R, const TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* S ) |
| 1052 | { |
| 1053 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1054 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isDisjointRoles()" ); |
| 1055 | TRolecxx . . $ TRole#* s = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( S, "Role expression expected in isDisjointRoles()" ); |
| 1056 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(r->isTop()) || unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(s->isTop()) ) |
| 1057 | return false; // universal role is not disjoint with anything |
| 1058 | if ( unlikelycxx . . $ TNamedEntry#isBottom(50ce9a9e25b4a850).(r->isBottom()) || unlikelycxx . . $ TNamedEntry#isBottom(50ce9a9e25b4a850).(s->isBottom()) ) |
| 1059 | return true; // empty role is disjoint with everything |
| 1060 | return getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->isDisjointRolescxx . . $ TBox#isDisjointRoles(ee962dbb2fa027b9). ( r, s ); |
| 1061 | } |
| 1062 | /// @return true iff all the roles in a arg-list are pairwise disjoint |
| 1063 | bool isDisjointRolescxx . . $ ReasoningKernel#isDisjointRoles(c9857a73d68e59ba). ( void ); |
| 1064 | /// @return true if R is a super-role of a chain holding in the args |
| 1065 | bool isSubChaincxx . . $ ReasoningKernel#isSubChain(8fc77c3492e4f36b). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R ) |
| 1066 | { |
| 1067 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1068 | TRolecxx . . $ TRole#* r = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( R, "Role expression expected in isSubChain()" ); |
| 1069 | if ( unlikelycxx . . $ TNamedEntry#isTop(50ce9a9e25b4a850).(r->isTop()) ) |
| 1070 | return true; // universal role is a super of any chain |
| 1071 | return checkSubChaincxx . . $ ReasoningKernel#checkSubChain(5cff2ecb4cbf8882). ( getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->getArgListcxx . . $ TExpressionManager#getArgList(ea12e55bef799de0).(), r ); |
| 1072 | } |
| 1073 | |
| 1074 | // single satisfiability |
| 1075 | |
| 1076 | /// @return true iff C is satisfiable |
| 1077 | bool isSatisfiablecxx . . $ ReasoningKernel#isSatisfiable(96881bbb97bd7038). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C ) |
| 1078 | { |
| 1079 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); |
| 1080 | try { return checkSatcxx . . $ ReasoningKernel#checkSat(96881bbb97bd7038).(C); } |
| 1081 | catch ( const EFPPCantRegNamecxx . . $ EFPPCantRegName#& crn ) |
| 1082 | { |
| 1083 | if ( dynamic_cast<const TDLConceptNamecxx . . $ TDLConceptName#*>(C) != nullptr ) // this is an unknown concept |
| 1084 | return true; |
| 1085 | // complex expression, involving unknown names |
| 1086 | throw crn; |
| 1087 | } |
| 1088 | } |
| 1089 | /// @return true iff C [= D holds |
| 1090 | bool isSubsumedBycxx . . $ ReasoningKernel#isSubsumedBy(5fdff331daaf87aa). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C, const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* D ) |
| 1091 | { |
| 1092 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); |
| 1093 | if ( isNameOrConstcxx . . $ ReasoningKernel#isNameOrConst(96881bbb97bd7038).(D) && likelycxx . . $ `Kernel/globaldef.h:28:10`!(isNameOrConst(C)) ) |
| 1094 | return checkSubcxx . . $ ReasoningKernel#checkSub(db5d378ba95a512d). ( getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getCIcxx . . $ TBox#getCI(a9db10ac0cf504ba).(TreeDeletercxx . . $ TreeDeleter#TreeDeleter(edf821a2fc5509f9).(ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(C))), getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getCIcxx . . $ TBox#getCI(a9db10ac0cf504ba).(TreeDeletercxx . . $ TreeDeleter#(ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(D))) ); |
| 1095 | DLTreecxx . . $ DLTree#* nD = createSNFNotcxx . . $ createSNFNot(1bf715d485c1268).(ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(D)); |
| 1096 | return !checkSatTreecxx . . $ ReasoningKernel#checkSatTree(38a18fab043f8799). ( createSNFAndcxx . . $ createSNFAnd(f2877343b7b69ea7). (ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(C), nD) ); |
| 1097 | } |
| 1098 | /// @return true iff C is disjoint with D; that is, (C and D) is unsatisfiable |
| 1099 | bool isDisjointcxx . . $ ReasoningKernel#isDisjoint(5fdff331daaf87aa). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C, const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* D ) { return !isSatisfiablecxx . . $ ReasoningKernel#isSatisfiable(96881bbb97bd7038).(getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->Andcxx . . $ TExpressionManager#And(d906876d1fd42231).(C,D)); } |
| 1100 | /// @return true iff C is equivalent to D |
| 1101 | bool isEquivalentcxx . . $ ReasoningKernel#isEquivalent(5fdff331daaf87aa). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C, const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* D ) |
| 1102 | { |
| 1103 | if ( C == D ) // easy case |
| 1104 | return true; |
| 1105 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); |
| 1106 | if ( isKBClassifiedcxx . . $ ReasoningKernel#isKBClassified(50ce9a9e25b4a850).() ) |
| 1107 | { // try to detect C=D wrt named concepts |
| 1108 | if ( isNameOrConstcxx . . $ ReasoningKernel#isNameOrConst(96881bbb97bd7038).(D) && likelycxx . . $ `Kernel/globaldef.h:28:10`!(isNameOrConst(C)) ) |
| 1109 | { |
| 1110 | const TaxonomyVertexcxx . . $ TaxonomyVertex#* cV = getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getCIcxx . . $ TBox#getCI(a9db10ac0cf504ba).(TreeDeletercxx . . $ TreeDeleter#(ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(C)))->getTaxVertexcxx . . $ ClassifiableEntry#getTaxVertex(16f9ca5fa66f7d36).(); |
| 1111 | const TaxonomyVertexcxx . . $ TaxonomyVertex#* dV = getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->getCIcxx . . $ TBox#getCI(a9db10ac0cf504ba).(TreeDeletercxx . . $ TreeDeleter#TreeDeleter(edf821a2fc5509f9).(ecxx . . $ ReasoningKernel#e(b64a00ed5e9da28a).(D)))->getTaxVertexcxx . . $ ClassifiableEntry#getTaxVertex(16f9ca5fa66f7d36).(); |
| 1112 | if ( unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(cV == nullptr) && unlikelycxx . . $ `Kernel/globaldef.h:29:10`!(dV == nullptr) ) |
| 1113 | return false; // 2 different fresh names |
| 1114 | return cV == dV; |
| 1115 | } |
| 1116 | } |
| 1117 | // not classified or not named constants |
| 1118 | return isSubsumedBycxx . . $ ReasoningKernel#isSubsumedBy(5fdff331daaf87aa). ( C, D ) && isSubsumedBycxx . . $ ReasoningKernel#isSubsumedBy(5fdff331daaf87aa). ( D, C ); |
| 1119 | } |
| 1120 | // concept hierarchy |
| 1121 | |
| 1122 | /// apply actor::apply() to all DIRECT super-concepts of [complex] C |
| 1123 | template <typename Actor> |
| 1124 | void getSupConceptscxx . . $ ReasoningKernel#getSupConcepts(f2bd94c4840cdfac). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C, bool direct, Actor& actor, bool needCurrent = false ) |
| 1125 | { |
| 1126 | classifyKBcxx . . $ ReasoningKernel#classifyKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1127 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( C, csClassifiedcxx . . $ ReasoningKernel#csClassified. ); |
| 1128 | actor.clear(); |
| 1129 | Taxonomycxx . . $ Taxonomy#* tax = getCTaxonomycxx . . $ ReasoningKernel#getCTaxonomy(f40506d1380adb7f).(); |
| 1130 | if (direct) |
| 1131 | if (needCurrent) |
| 1132 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/true, /*upDirection=*/true>(cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor); |
| 1133 | else |
| 1134 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/false, /*onlyDirect=*/true, /*upDirection=*/true>(cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor); |
| 1135 | else |
| 1136 | if (needCurrent) |
| 1137 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/false, /*upDirection=*/true>(cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor); |
| 1138 | else |
| 1139 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/false, /*onlyDirect=*/false, /*upDirection=*/true>(cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor); |
| 1140 | } |
| 1141 | /// apply actor::apply() to all DIRECT sub-concepts of [complex] C |
| 1142 | template <typename Actor> |
| 1143 | void getSubConceptscxx . . $ ReasoningKernel#getSubConcepts(f2bd94c4840cdfac). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C, bool direct, Actor& actor, bool needCurrent = false) |
| 1144 | { |
| 1145 | classifyKBcxx . . $ ReasoningKernel#classifyKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1146 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( C, csClassifiedcxx . . $ ReasoningKernel#csClassified. ); |
| 1147 | actor.clear(); |
| 1148 | Taxonomycxx . . $ Taxonomy#* tax = getCTaxonomycxx . . $ ReasoningKernel#getCTaxonomy(f40506d1380adb7f).(); |
| 1149 | if (direct) |
| 1150 | if (needCurrent) |
| 1151 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/true, /*upDirection=*/false>(cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor); |
| 1152 | else |
| 1153 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/false, /*onlyDirect=*/true, /*upDirection=*/false>(cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor); |
| 1154 | else |
| 1155 | if (needCurrent) |
| 1156 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/false, /*upDirection=*/false>(cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor); |
| 1157 | else |
| 1158 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/false, /*onlyDirect=*/false, /*upDirection=*/false>(cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor); |
| 1159 | } |
| 1160 | /// apply actor::apply() to all synonyms of [complex] C |
| 1161 | template <typename Actor> |
| 1162 | void getEquivalentConceptscxx . . $ ReasoningKernel#getEquivalentConcepts(bfb43b18efbd3c83). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C, Actor& actor ) |
| 1163 | { |
| 1164 | classifyKBcxx . . $ ReasoningKernel#classifyKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1165 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( C, csClassifiedcxx . . $ ReasoningKernel#csClassified. ); |
| 1166 | actor.clear(); |
| 1167 | actor.apply(*cachedVertexcxx . . $ ReasoningKernel#cachedVertex.); |
| 1168 | } |
| 1169 | /// apply actor::apply() to all named concepts disjoint with [complex] C |
| 1170 | template <typename Actor> |
| 1171 | void getDisjointConceptscxx . . $ ReasoningKernel#getDisjointConcepts(bfb43b18efbd3c83). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C, Actor& actor ) |
| 1172 | { |
| 1173 | classifyKBcxx . . $ ReasoningKernel#classifyKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1174 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->Notcxx . . $ TExpressionManager#Not(a5147c10d6f77be7).(C), csClassifiedcxx . . $ ReasoningKernel#csClassified. ); |
| 1175 | actor.clear(); |
| 1176 | Taxonomycxx . . $ Taxonomy#* tax = getCTaxonomycxx . . $ ReasoningKernel#getCTaxonomy(f40506d1380adb7f).(); |
| 1177 | // we are looking for all sub-concepts of (not C) (including synonyms to it) |
| 1178 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/false, /*upDirection=*/false> ( cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor ); |
| 1179 | } |
| 1180 | |
| 1181 | // role hierarchy |
| 1182 | |
| 1183 | /// apply actor::apply() to all DIRECT super-roles of [complex] R |
| 1184 | template <typename Actor> |
| 1185 | void getSupRolescxx . . $ ReasoningKernel#getSupRoles(40dbfdfc57014d78). ( const TRoleExprcxx . . $ ReasoningKernel#TRoleExpr#* r, bool direct, Actor& actor ) |
| 1186 | { |
| 1187 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1188 | TRolecxx . . $ TRole#* R = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( r, "Role expression expected in getSupRoles()" ); |
| 1189 | actor.clear(); |
| 1190 | Taxonomycxx . . $ Taxonomy#* tax = getTaxonomycxx . . $ ReasoningKernel#getTaxonomy(67c0bce5411888b7).(R); |
| 1191 | if ( direct ) |
| 1192 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/false, /*onlyDirect=*/true, /*upDirection=*/true> ( getTaxVertexcxx . . $ ReasoningKernel#getTaxVertex(cee714f1a59d963b).(R), actor ); |
| 1193 | else |
| 1194 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/false, /*onlyDirect=*/false, /*upDirection=*/true> ( getTaxVertexcxx . . $ ReasoningKernel#getTaxVertex(cee714f1a59d963b).(R), actor ); |
| 1195 | } |
| 1196 | /// apply actor::apply() to all DIRECT sub-roles of [complex] R |
| 1197 | template <typename Actor> |
| 1198 | void getSubRolescxx . . $ ReasoningKernel#getSubRoles(40dbfdfc57014d78). ( const TRoleExprcxx . . $ ReasoningKernel#TRoleExpr#* r, bool direct, Actor& actor ) |
| 1199 | { |
| 1200 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1201 | TRolecxx . . $ TRole#* R = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( r, "Role expression expected in getSubRoles()" ); |
| 1202 | actor.clear(); |
| 1203 | Taxonomycxx . . $ Taxonomy#* tax = getTaxonomycxx . . $ ReasoningKernel#getTaxonomy(67c0bce5411888b7).(R); |
| 1204 | if ( direct ) |
| 1205 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/false, /*onlyDirect=*/true, /*upDirection=*/false> ( getTaxVertexcxx . . $ ReasoningKernel#getTaxVertex(cee714f1a59d963b).(R), actor ); |
| 1206 | else |
| 1207 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/false, /*onlyDirect=*/false, /*upDirection=*/false> ( getTaxVertexcxx . . $ ReasoningKernel#getTaxVertex(cee714f1a59d963b).(R), actor ); |
| 1208 | } |
| 1209 | /// apply actor::apply() to all synonyms of [complex] R |
| 1210 | template <typename Actor> |
| 1211 | void getEquivalentRolescxx . . $ ReasoningKernel#getEquivalentRoles(16c9744e53489a41). ( const TRoleExprcxx . . $ ReasoningKernel#TRoleExpr#* r, Actor& actor ) |
| 1212 | { |
| 1213 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1214 | TRolecxx . . $ TRole#* R = getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( r, "Role expression expected in getEquivalentRoles()" ); |
| 1215 | actor.clear(); |
| 1216 | actor.apply(*getTaxVertexcxx . . $ ReasoningKernel#getTaxVertex(cee714f1a59d963b).(R)); |
| 1217 | } |
| 1218 | |
| 1219 | // domain and range as a set of named concepts |
| 1220 | |
| 1221 | /// apply actor::apply() to all DIRECT NC that are in the domain of [complex] object role R |
| 1222 | template <typename Actor> |
| 1223 | void getORoleDomaincxx . . $ ReasoningKernel#getORoleDomain(493a91f9acb116f8). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* r, bool direct, Actor& actor ) |
| 1224 | { |
| 1225 | classifyKBcxx . . $ ReasoningKernel#classifyKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1226 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->Existscxx . . $ TExpressionManager#Exists(1977ffbf49b50255). ( r, getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->Topcxx . . $ TExpressionManager#Top(aac0c49b6bdfac38).() ), csClassifiedcxx . . $ ReasoningKernel#csClassified. ); |
| 1227 | actor.clear(); |
| 1228 | Taxonomycxx . . $ Taxonomy#* tax = getCTaxonomycxx . . $ ReasoningKernel#getCTaxonomy(f40506d1380adb7f).(); |
| 1229 | if ( direct ) // gets an exact domain is named concept; otherwise, set of the most specific concepts |
| 1230 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/true, /*upDirection=*/true> ( cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor ); |
| 1231 | else // gets all named classes that are in the domain of a role |
| 1232 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/false, /*upDirection=*/true> ( cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor ); |
| 1233 | } |
| 1234 | /// apply actor::apply() to all DIRECT NC that are in the domain of data role R |
| 1235 | template <typename Actor> |
| 1236 | void getDRoleDomaincxx . . $ ReasoningKernel#getDRoleDomain(3e2b3159debfbd0c). ( const TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* r, bool direct, Actor& actor ) |
| 1237 | { |
| 1238 | classifyKBcxx . . $ ReasoningKernel#classifyKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1239 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->Existscxx . . $ TExpressionManager#Exists(2a4ec6bc45376abb). ( r, getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->DataTopcxx . . $ TExpressionManager#DataTop(9f9fdff2273d849c).() ), csClassifiedcxx . . $ ReasoningKernel#csClassified. ); |
| 1240 | actor.clear(); |
| 1241 | Taxonomycxx . . $ Taxonomy#* tax = getCTaxonomycxx . . $ ReasoningKernel#getCTaxonomy(f40506d1380adb7f).(); |
| 1242 | if ( direct ) // gets an exact domain is named concept; otherwise, set of the most specific concepts |
| 1243 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/true, /*upDirection=*/true> ( cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor ); |
| 1244 | else // gets all named classes that are in the domain of a role |
| 1245 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/false, /*upDirection=*/true> ( cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor ); |
| 1246 | } |
| 1247 | /// apply actor::apply() to all DIRECT NC that are in the range of [complex] R |
| 1248 | template <typename Actor> |
| 1249 | void getRoleRangecxx . . $ ReasoningKernel#getRoleRange(493a91f9acb116f8). ( const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* r, bool direct, Actor& actor ) |
| 1250 | { getORoleDomaincxx . . $ ReasoningKernel#getORoleDomain(493a91f9acb116f8). ( getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->Inversecxx . . $ TExpressionManager#Inverse(c6736427cdccb407).(r), direct, actor ); } |
| 1251 | |
| 1252 | // instances |
| 1253 | |
| 1254 | /// apply actor::apply() to all direct instances of given [complex] C |
| 1255 | template <typename Actor> |
| 1256 | void getDirectInstancescxx . . $ ReasoningKernel#getDirectInstances(bfb43b18efbd3c83). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C, Actor& actor ) |
| 1257 | { |
| 1258 | realiseKBcxx . . $ ReasoningKernel#realiseKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1259 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( C, csClassifiedcxx . . $ ReasoningKernel#csClassified. ); |
| 1260 | actor.clear(); |
| 1261 | |
| 1262 | // implement 1-level check by hand |
| 1263 | |
| 1264 | // if the root vertex contains individuals -- we are done |
| 1265 | if ( actor.apply(*cachedVertexcxx . . $ ReasoningKernel#cachedVertex.) ) |
| 1266 | return; |
| 1267 | |
| 1268 | // if not, just go 1 level down and apply the actor regardless of what's found |
| 1269 | // FIXME!! check again after bucket-method will be implemented |
| 1270 | for ( TaxonomyVertexcxx . . $ TaxonomyVertex#::iteratorcxx . . $ TaxonomyVertex#iterator# p = cachedVertexcxx . . $ ReasoningKernel#cachedVertex.->begincxx . . $ TaxonomyVertex#begin(98265602f6db0361).(/*upDirection=*/false), |
| 1271 | p_end = cachedVertexcxx . . $ ReasoningKernel#cachedVertex.->endcxx . . $ TaxonomyVertex#end(98265602f6db0361).(/*upDirection=*/false); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 1272 | actor.apply(**cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p); |
| 1273 | } |
| 1274 | |
| 1275 | /// apply actor::apply() to all instances of given [complex] C |
| 1276 | template <typename Actor> |
| 1277 | void getInstancescxx . . $ ReasoningKernel#getInstances(bfb43b18efbd3c83). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C, Actor& actor ) |
| 1278 | { // FIXME!! check for Racer's/IS approach |
| 1279 | realiseKBcxx . . $ ReasoningKernel#realiseKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1280 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( C, csClassifiedcxx . . $ ReasoningKernel#csClassified. ); |
| 1281 | actor.clear(); |
| 1282 | Taxonomycxx . . $ Taxonomy#* tax = getCTaxonomycxx . . $ ReasoningKernel#getCTaxonomy(f40506d1380adb7f).(); |
| 1283 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/false, /*upDirection=*/false> ( cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor ); |
| 1284 | } |
| 1285 | |
| 1286 | /// apply actor::apply() to all DIRECT concepts that are types of an individual I |
| 1287 | template <typename Actor> |
| 1288 | void getTypescxx . . $ ReasoningKernel#getTypes(da4dca7a00b57945). ( const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, bool direct, Actor& actor ) |
| 1289 | { |
| 1290 | realiseKBcxx . . $ ReasoningKernel#realiseKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1291 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->OneOfcxx . . $ TExpressionManager#OneOf(c7c486251d40ba0d).(I), csClassifiedcxx . . $ ReasoningKernel#csClassified. ); |
| 1292 | actor.clear(); |
| 1293 | Taxonomycxx . . $ Taxonomy#* tax = getCTaxonomycxx . . $ ReasoningKernel#getCTaxonomy(f40506d1380adb7f).(); |
| 1294 | if ( direct ) |
| 1295 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/true, /*upDirection=*/true> ( cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor ); |
| 1296 | else |
| 1297 | tax->getRelativesInfocxx . . $ Taxonomy#getRelativesInfo(e811dd8058b26e1c).</*needCurrent=*/true, /*onlyDirect=*/false, /*upDirection=*/true> ( cachedVertexcxx . . $ ReasoningKernel#cachedVertex., actor ); |
| 1298 | } |
| 1299 | /// apply actor::apply() to all synonyms of an individual I |
| 1300 | template <typename Actor> |
| 1301 | void getSameAscxx . . $ ReasoningKernel#getSameAs(12f6e6d8ee406462). ( const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, Actor& actor ) |
| 1302 | { |
| 1303 | realiseKBcxx . . $ ReasoningKernel#realiseKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1304 | getEquivalentConceptscxx . . $ ReasoningKernel#getEquivalentConcepts(bfb43b18efbd3c83). ( getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->OneOfcxx . . $ TExpressionManager#OneOf(c7c486251d40ba0d).(I), actor ); |
| 1305 | } |
| 1306 | /// @return true iff I and J refer to the same individual |
| 1307 | bool isSameIndividualscxx . . $ ReasoningKernel#isSameIndividuals(3deb7925192e8b3). ( const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* J ) |
| 1308 | { |
| 1309 | realiseKBcxx . . $ ReasoningKernel#realiseKB(49f6e7a06ebc5aa8).(); |
| 1310 | TIndividualcxx . . $ TIndividual#* i = getIndividualcxx . . $ ReasoningKernel#getIndividual(d410642517b2f838). ( I, "Only known individuals are allowed in the isSameAs()" ); |
| 1311 | TIndividualcxx . . $ TIndividual#* j = getIndividualcxx . . $ ReasoningKernel#getIndividual(d410642517b2f838). ( J, "Only known individuals are allowed in the isSameAs()" ); |
| 1312 | return getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->isSameIndividualscxx . . $ TBox#isSameIndividuals(3993f6531b750ef8).(i,j); |
| 1313 | } |
| 1314 | /// @return true iff individual I is instance of given [complex] C |
| 1315 | bool isInstancecxx . . $ ReasoningKernel#isInstance(c3232ab85b187851). ( const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C ) |
| 1316 | { |
| 1317 | realiseKBcxx . . $ ReasoningKernel#realiseKB(49f6e7a06ebc5aa8).(); // ensure KB is ready to answer the query |
| 1318 | getIndividualcxx . . $ ReasoningKernel#getIndividual(d410642517b2f838). ( I, "individual name expected in the isInstance()" ); |
| 1319 | // FIXME!! this way a new concept is created; could be done more optimal |
| 1320 | return isSubsumedBycxx . . $ ReasoningKernel#isSubsumedBy(5fdff331daaf87aa). ( getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).()->OneOfcxx . . $ TExpressionManager#OneOf(c7c486251d40ba0d).(I), C ); |
| 1321 | } |
| 1322 | /// @return in Rs all (DATA)-roles R s.t. (I,x):R; add inverses if NEEDI is true |
| 1323 | void getRelatedRolescxx . . $ ReasoningKernel#getRelatedRoles(5b76d9c42e2bbb27). ( const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, NamesVectorcxx . . $ ReasoningKernel#NamesVector#& Rs, bool data, bool needI ); |
| 1324 | /// set RESULT into set of J's such that R(I,J) |
| 1325 | void getRoleFillerscxx . . $ ReasoningKernel#getRoleFillers(8ac4f9e00c6e6d). ( const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R, IndividualSetcxx . . $ ReasoningKernel#IndividualSet#& Result ); |
| 1326 | const CIVeccxx . . $ ReasoningKernel#CIVec#& getRoleFillerscxx . . $ ReasoningKernel#getRoleFillers(d32c27b9ce89eb2f). ( const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R); |
| 1327 | /// @return true iff R(I,J) holds |
| 1328 | bool isRelatedcxx . . $ ReasoningKernel#isRelated(d77eee90dc196fd7). ( const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, const TORoleExprcxx . . $ ReasoningKernel#TORoleExpr#* R, const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* J ); |
| 1329 | /// @return true iff A(I,V) holds |
| 1330 | bool isRelatedcxx . . $ ReasoningKernel#isRelated(5be7e6e2f58f529d). ( const TIndividualExprcxx . . $ ReasoningKernel#TIndividualExpr#* I, const TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* A, const TDataValueExprcxx . . $ ReasoningKernel#TDataValueExpr#* V ); |
| 1331 | |
| 1332 | /// set RESULT into set of individuals such that they do have data roles R and S, and R op S |
| 1333 | void getDataRelatedIndividualscxx . . $ ReasoningKernel#getDataRelatedIndividuals(919cd40eaba59545). ( TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* R, TDRoleExprcxx . . $ ReasoningKernel#TDRoleExpr#* S, int op, IndividualSetcxx . . $ ReasoningKernel#IndividualSet#& Result ); |
| 1334 | |
| 1335 | TDLConceptExpressioncxx . . $ TDLConceptExpression#* parseConceptcxx . . $ ReasoningKernel#parseConcept(8612cd067d6f1ae5).(const stdcxx . . $ std/::stringcxx . . $ std/string#& name); |
| 1336 | TDLObjectRoleExpressioncxx . . $ TDLObjectRoleExpression#* parseObjectRolecxx . . $ ReasoningKernel#parseObjectRole(24366d59580a416c).(const stdcxx . . $ std/::stringcxx . . $ std/string#& name); |
| 1337 | TDLDataRoleExpressioncxx . . $ TDLDataRoleExpression#* parseDataRolecxx . . $ ReasoningKernel#parseDataRole(290e70135ea6de9f).(const stdcxx . . $ std/::stringcxx . . $ std/string#& name); |
| 1338 | const TConceptcxx . . $ TConcept#* getConceptcxx . . $ ReasoningKernel#getConcept(65f8c540f712f165).(TDLIndividualNamecxx . . $ TDLIndividualName#* i_exp, TDLConceptExpressioncxx . . $ TDLConceptExpression#* c_exp); |
| 1339 | const TRolecxx . . $ TRole#* getRolecxx . . $ ReasoningKernel#getRole(9283c1cb4524c56a).(TDLObjectRoleExpressioncxx . . $ TDLObjectRoleExpression#* o_exp, TDLDataRoleExpressioncxx . . $ TDLDataRoleExpression#* d_exp); |
| 1340 | const char* getXsdTypecxx . . $ ReasoningKernel#getXsdType(fc71999b27369f84).(const TDataEntrycxx . . $ TDataEntry#* dataValue) const; |
| 1341 | void getTriplescxx . . $ ReasoningKernel#getTriples(5d4179706023b7bd).(const stdcxx . . $ std/::stringcxx . . $ std/string#& q_subj_name, const stdcxx . . $ std/::stringcxx . . $ std/string#& q_role_name, const stdcxx . . $ std/::stringcxx . . $ std/string#& q_obj_name, stdcxx . . $ std/::setcxx . . $ std/set#<stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#>>& triples); |
| 1342 | |
| 1343 | //---------------------------------------------------------------------------------- |
| 1344 | // knowledge exploration queries |
| 1345 | //---------------------------------------------------------------------------------- |
| 1346 | |
| 1347 | /// build a completion tree for a concept expression C (no caching as it breaks the idea of KE). @return the root node |
| 1348 | const TCGNodecxx . . $ ReasoningKernel#TCGNode#* buildCompletionTreecxx . . $ ReasoningKernel#buildCompletionTree(ea68414825e45655). ( const TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C ) |
| 1349 | { |
| 1350 | preprocessKBcxx . . $ ReasoningKernel#preprocessKB(49f6e7a06ebc5aa8).(); |
| 1351 | setUpCachecxx . . $ ReasoningKernel#setUpCache(59e27aeb12b314b). ( C, csSatcxx . . $ ReasoningKernel#csSat. ); |
| 1352 | const TCGNodecxx . . $ ReasoningKernel#TCGNode#* ret = getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).()->buildCompletionTreecxx . . $ TBox#buildCompletionTree(a413042f62b2ffcc).(cachedConceptcxx . . $ ReasoningKernel#cachedConcept.); |
| 1353 | if ( KEcxx . . $ ReasoningKernel#KE. == nullptr ) // init KB after the sat test to reduce the number of DAG adjustments |
| 1354 | KEcxx . . $ ReasoningKernel#KE. = new KnowledgeExplorercxx . . $ KnowledgeExplorer# ( getTBoxcxx . . $ ReasoningKernel#getTBox(e1a36bcbc166a7c5).(), getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).() ); |
| 1355 | return ret; |
| 1356 | } |
| 1357 | /// build the set of data neighbours of a NODE, put the set of data roles into the RESULT variable |
| 1358 | void getDataRolescxx . . $ ReasoningKernel#getDataRoles(b894f4bf180191ca). ( const TCGNodecxx . . $ ReasoningKernel#TCGNode#* node, TCGRoleSetcxx . . $ ReasoningKernel#TCGRoleSet#& Result, bool onlyDet ) { Result =cxx . . $ std/set#`operator=`(7d6e6bfeb60e39ab). KEcxx . . $ ReasoningKernel#KE.->getDataRolescxx . . $ KnowledgeExplorer#getDataRoles(106d2ee0a895843a). ( node, onlyDet ); } |
| 1359 | /// build the set of object neighbours of a NODE, put the set of object roles and inverses into the RESULT variable |
| 1360 | void getObjectRolescxx . . $ ReasoningKernel#getObjectRoles(bd79446f219f2825). ( const TCGNodecxx . . $ ReasoningKernel#TCGNode#* node, TCGRoleSetcxx . . $ ReasoningKernel#TCGRoleSet#& Result, bool onlyDet, bool needIncoming ) { Result =cxx . . $ std/set#`operator=`(7d6e6bfeb60e39ab). KEcxx . . $ ReasoningKernel#KE.->getObjectRolescxx . . $ KnowledgeExplorer#getObjectRoles(d53edb8dd44149b1). ( node, onlyDet, needIncoming ); } |
| 1361 | /// build the set of neighbours of a NODE via role ROLE; put the resulting list into RESULT |
| 1362 | void getNeighbourscxx . . $ ReasoningKernel#getNeighbours(6e2d65de7fadf11e). ( const TCGNodecxx . . $ ReasoningKernel#TCGNode#* node, TRoleExprcxx . . $ ReasoningKernel#TRoleExpr#* role, TCGNodeVeccxx . . $ ReasoningKernel#TCGNodeVec#& Result ) |
| 1363 | { Result =cxx . . $ std/vector#`operator=`(e6b68e61becad66f). KEcxx . . $ ReasoningKernel#KE.->getNeighbourscxx . . $ KnowledgeExplorer#getNeighbours(a01bc3e0a8487b5d). ( node, getRolecxx . . $ ReasoningKernel#getRole(ed2e21ac85945398). ( role, "Role expression expected in getNeighbours() method" ) ); } |
| 1364 | /// put into RESULT all the expressions from the NODE label; if ONLYDET is true, return only deterministic elements |
| 1365 | void getLabelcxx . . $ ReasoningKernel#getLabel(9ffb748944fd6fc2). ( const TCGNodecxx . . $ ReasoningKernel#TCGNode#* node, TCGItemVeccxx . . $ ReasoningKernel#TCGItemVec#& Result, bool onlyDet ) { Result =cxx . . $ std/vector#`operator=`(e6b68e61becad66f). KEcxx . . $ ReasoningKernel#KE.->getLabelcxx . . $ KnowledgeExplorer#getLabel(696fa028d0583acd). ( node, onlyDet ); } |
| 1366 | /// @return blocker of a blocked node NODE or NULL if node is not blocked |
| 1367 | const TCGNodecxx . . $ ReasoningKernel#TCGNode#* getBlockercxx . . $ ReasoningKernel#getBlocker(86f029545115fbc6). ( const TCGNodecxx . . $ ReasoningKernel#TCGNode#* node ) const { return KEcxx . . $ ReasoningKernel#KE.->getBlockercxx . . $ KnowledgeExplorer#getBlocker(86f029545115fbc6).(node); } |
| 1368 | |
| 1369 | //---------------------------------------------------------------------------------- |
| 1370 | // atomic decomposition queries |
| 1371 | //---------------------------------------------------------------------------------- |
| 1372 | |
| 1373 | /// create new atomic decomposition of the loaded ontology using TYPE. @return size of the AD |
| 1374 | size_tcxx . . $ size_t# getAtomicDecompositionSizecxx . . $ ReasoningKernel#getAtomicDecompositionSize(1ecc58f4296d2e19). ( ModuleMethodcxx . . $ ModuleMethod# moduleMethod, ModuleTypecxx . . $ ModuleType# moduleType ); |
| 1375 | /// get a set of axioms that corresponds to the atom with the id INDEX |
| 1376 | const TOntologyAtomcxx . . $ TOntologyAtom#::AxiomSetcxx . . $ TOntologyAtom#AxiomSet#& getAtomAxiomscxx . . $ ReasoningKernel#getAtomAxioms(510971c2db1388b). ( unsigned int index ) const; |
| 1377 | /// get a set of axioms that corresponds to the module of the atom with the id INDEX |
| 1378 | const TOntologyAtomcxx . . $ TOntologyAtom#::AxiomSetcxx . . $ TOntologyAtom#AxiomSet#& getAtomModulecxx . . $ ReasoningKernel#getAtomModule(510971c2db1388b). ( unsigned int index ) const; |
| 1379 | /// get a set of atoms on which atom with index INDEX depends |
| 1380 | const TOntologyAtomcxx . . $ TOntologyAtom#::AtomSetcxx . . $ TOntologyAtom#AtomSet#& getAtomDependentscxx . . $ ReasoningKernel#getAtomDependents(60a3854698667129). ( unsigned int index ) const; |
| 1381 | /// get a number of locality checks performed for creating an AD |
| 1382 | unsigned long long getLocCheckNumbercxx . . $ ReasoningKernel#getLocCheckNumber(1c5fc1fd41a99ae7). ( void ) const; |
| 1383 | |
| 1384 | //---------------------------------------------------------------------------------- |
| 1385 | // modularity queries |
| 1386 | //---------------------------------------------------------------------------------- |
| 1387 | |
| 1388 | /// get a module of an ontology wrt given method. |
| 1389 | const AxiomVeccxx . . $ AxiomVec#& getModulecxx . . $ ReasoningKernel#getModule(1d482f158db4a6a1). ( ModuleMethodcxx . . $ ModuleMethod# moduleMethod, ModuleTypecxx . . $ ModuleType# moduleType ); |
| 1390 | /// get a set of non-local axioms of an ontology wrt given method. |
| 1391 | const AxiomVeccxx . . $ AxiomVec#& getNonLocalcxx . . $ ReasoningKernel#getNonLocal(1d482f158db4a6a1). ( ModuleMethodcxx . . $ ModuleMethod# moduleMethod, ModuleTypecxx . . $ ModuleType# moduleType ); |
| 1392 | |
| 1393 | //---------------------------------------------------------------------------------- |
| 1394 | // save/load interface |
| 1395 | //---------------------------------------------------------------------------------- |
| 1396 | |
| 1397 | /// check whether @return true if a file with reasoner state with a given NAME exists. |
| 1398 | bool checkSaveLoadContextcxx . . $ ReasoningKernel#checkSaveLoadContext(13a55b95a0133754). ( const stdcxx . . $ std/::stringcxx . . $ std/string#& name ) const; |
| 1399 | /// set a save/load file to a given NAME |
| 1400 | bool setSaveLoadContextcxx . . $ ReasoningKernel#setSaveLoadContext(7c222eea44a24d43). ( const stdcxx . . $ std/::stringcxx . . $ std/string#& name ); |
| 1401 | /// clear a cache for a given name |
| 1402 | bool clearSaveLoadContextcxx . . $ ReasoningKernel#clearSaveLoadContext(13a55b95a0133754). ( const stdcxx . . $ std/::stringcxx . . $ std/string#& name ) const; |
| 1403 | }; // ReasoningKernel |
| 1404 | |
| 1405 | #endif |