| 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 program is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU General Public License |
| 7 | as published by the Free Software Foundation; either version 2 |
| 8 | of the License, or (at your option) any later version. |
| 9 | |
| 10 | This program 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 |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the Free Software |
| 17 | Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | #include <iostream> |
| 21 | #include <iomanip> |
| 22 | #include <fstream> |
| 23 | #include <sstream> |
| 24 | |
| 25 | #include "procTimer.h"cxx . . $ `<file>/Kernel/procTimer.h`/ |
| 26 | #include "parser.h"cxx . . $ `<file>/FaCT++/parser.h`/ |
| 27 | #include "configure.h"cxx . . $ `<file>/Kernel/configure.h`/ |
| 28 | #include "logging.h"cxx . . $ `<file>/Kernel/logging.h`/ |
| 29 | |
| 30 | #include "Kernel.h"cxx . . $ `<file>/Kernel/Kernel.h`/ |
| 31 | #include "cpm.h"cxx . . $ `<file>/Kernel/cpm.h`/ |
| 32 | |
| 33 | TsProcTimercxx . . $ TsProcTimer# totalTimercxx . . $ totalTimer., wTimercxx . . $ wTimer.; |
| 34 | Configurationcxx . . $ Configuration# Configcxx . . $ Config.; |
| 35 | ReasoningKernelcxx . . $ ReasoningKernel# Kernelcxx . . $ Kernel.; |
| 36 | stdcxx . . $ std/::ofstreamcxx . . $ std/ofstream# Outcxx . . $ Out.; |
| 37 | |
| 38 | // defined in AD.cpp |
| 39 | void CreateADcxx . . $ CreateAD(282b0c8dcc64148e). ( TOntologycxx . . $ TOntology#* O, ModuleMethodcxx . . $ ModuleMethod# moduleMethod ); |
| 40 | |
| 41 | // local methods |
| 42 | inline void Usagecxx . . $ Usage(49f6e7a06ebc5aa8). ( void ) |
| 43 | { |
| 44 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nUsage:\tFaCT++ <Conf file> or\n\tFaCT++ -get-default-options\n\n"; |
| 45 | exit (1); |
| 46 | } |
| 47 | |
| 48 | inline void errorcxx . . $ error(85c52e162fed56f9). ( const char* mes ) |
| 49 | { |
| 50 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). mes <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 51 | exit(2); |
| 52 | } |
| 53 | |
| 54 | inline void OutTimecxx . . $ OutTime(f7f45734e6842120). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& o ) |
| 55 | { |
| 56 | o <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Working time = " <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). totalTimercxx . . $ totalTimer. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " seconds\n"; |
| 57 | } |
| 58 | |
| 59 | //---------------------------------------------------------------------------------- |
| 60 | // SAT/SUB queries |
| 61 | //---------------------------------------------------------------------------------- |
| 62 | |
| 63 | stdcxx . . $ std/::stringcxx . . $ std/string# Querycxx . . $ Query.[2]; |
| 64 | |
| 65 | /// fill query target names by configure |
| 66 | static void |
| 67 | fillSatSubQuerycxx . . $ fillSatSubQuery(49f6e7a06ebc5aa8). ( void ) |
| 68 | { |
| 69 | // founds a target for checking |
| 70 | if ( !Configcxx . . $ Config..checkValuecxx . . $ Configuration#checkValue(1667653f663d0d88). ( "Query"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Target"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d). ) ) |
| 71 | Querycxx . . $ Query.[0] =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). Configcxx . . $ Config..getStringcxx . . $ Configuration#getString(a9f41ea0e82d88cf).(); |
| 72 | |
| 73 | if ( !Configcxx . . $ Config..checkValuecxx . . $ Configuration#checkValue(1667653f663d0d88). ( "Query"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Target2"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d). ) ) |
| 74 | Querycxx . . $ Query.[1] =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). Configcxx . . $ Config..getStringcxx . . $ Configuration#getString(a9f41ea0e82d88cf).(); |
| 75 | } |
| 76 | |
| 77 | static ReasoningKernelcxx . . $ ReasoningKernel#::TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* |
| 78 | getNextNamecxx . . $ getNextName(72eb15375668b8f3). ( TsScannercxx . . $ TsScanner#& sc, TExpressionManagercxx . . $ TExpressionManager#* pEM ) |
| 79 | { |
| 80 | for (;;) |
| 81 | { |
| 82 | if ( sc.GetLexcxx . . $ TsScanner#GetLex(5dd2f7e041733f46).() == LEXEOFcxx . . $ LEXEOF. ) |
| 83 | return nullptr; |
| 84 | LispTokencxx . . $ LispToken# t = sc.getNameKeywordcxx . . $ TsScanner#getNameKeyword(922db4e91ebad8cc).(); |
| 85 | |
| 86 | if ( t != IDcxx . . $ ID. ) |
| 87 | { |
| 88 | if ( t == L_TOPcxx . . $ L_TOP. ) |
| 89 | return pEM->Topcxx . . $ TExpressionManager#Top(aac0c49b6bdfac38).(); |
| 90 | else |
| 91 | return pEM->Bottomcxx . . $ TExpressionManager#Bottom(2a1e789bc1a0a42f).(); |
| 92 | } |
| 93 | try |
| 94 | { |
| 95 | return pEM->Conceptcxx . . $ TExpressionManager#Concept(f43767f328f84e3).(sccxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)..GetNamecxx . . $ CommonScanner#GetName(a9f41ea0e82d88cf).()); |
| 96 | } |
| 97 | catch ( const EFPPCantRegNamecxx . . $ EFPPCantRegName#& ) |
| 98 | { |
| 99 | try |
| 100 | { |
| 101 | return pEM->OneOfcxx . . $ TExpressionManager#OneOf(c7c486251d40ba0d).(pEM->Individualcxx . . $ TExpressionManager#Individual(fa65f56176e0b266).(sccxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)..GetNamecxx . . $ CommonScanner#GetName(a9f41ea0e82d88cf).())); |
| 102 | } |
| 103 | catch ( const EFPPCantRegNamecxx . . $ EFPPCantRegName#& ) |
| 104 | { |
| 105 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Query name " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). sc.GetNamecxx . . $ CommonScanner#GetName(a9f41ea0e82d88cf).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " is undefined in TBox\n"; |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | static const char* |
| 112 | getConceptNamecxx . . $ getConceptName(f9b40294821e5fa3). ( ReasoningKernelcxx . . $ ReasoningKernel#::TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* C ) |
| 113 | { |
| 114 | if ( const TDLConceptNamecxx . . $ TDLConceptName#* name = dynamic_cast<const TDLConceptNamecxx . . $ TDLConceptName#*>(C) ) |
| 115 | return name->getNamecxx . . $ TNamedEntity#getName(a9f41ea0e82d88cf).(); |
| 116 | if ( dynamic_cast<const TDLConceptTopcxx . . $ TDLConceptTop#*>(C) ) |
| 117 | return "*TOP*"; |
| 118 | if ( dynamic_cast<const TDLConceptBottomcxx . . $ TDLConceptBottom#*>(C) ) |
| 119 | return "*BOTTOM*"; |
| 120 | return "concept expression"; |
| 121 | } |
| 122 | |
| 123 | /// try to do a reasoning; react if exception was thrown |
| 124 | #define TryReasoningcxx . . $ `FaCT++/FaCT.cpp:124:9`!(action) \ |
| 125 | do { \ |
| 126 | try { action; } \ |
| 127 | catch ( const EFPPInconsistentKB& ) {} \ |
| 128 | catch ( const EFPPCantRegName& crn ) \ |
| 129 | { std::cout << "Query name " << crn.getName() \ |
| 130 | << " is undefined in TBox\n"; } \ |
| 131 | catch ( const EFPPNonSimpleRole& nsr ) \ |
| 132 | { std::cerr << "WARNING: KB is incorrect: " \ |
| 133 | << nsr.what() << ". Query is NOT processed\n"; \ |
| 134 | exit(0); } \ |
| 135 | catch ( const EFPPCycleInRIA& cir ) \ |
| 136 | { std::cerr << "WARNING: KB is incorrect: " \ |
| 137 | << cir.what() << ". Query is NOT processed\n"; \ |
| 138 | exit(0); } \ |
| 139 | } while (false) |
| 140 | |
| 141 | static void |
| 142 | testSatcxx . . $ testSat(a69d1e9fe63b3c3f). ( const stdcxx . . $ std/::stringcxx . . $ std/string#& names, ReasoningKernelcxx . . $ ReasoningKernel#& Kernel ) |
| 143 | { |
| 144 | stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# scxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(d3c8ea0e6521074c).(names); |
| 145 | TsScannercxx . . $ TsScanner# sccxx . . $ TsScanner#TsScanner(6a35a7fc14119650).(&s); |
| 146 | ReasoningKernelcxx . . $ ReasoningKernel#::TConceptExprcxx . . $ ReasoningKernel#TConceptExpr#* sat; |
| 147 | |
| 148 | while ( (sat = getNextNamecxx . . $ getNextName(72eb15375668b8f3).(sc,Kernel.getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).())) != nullptr ) |
| 149 | { |
| 150 | bool result = false; |
| 151 | if ( dynamic_cast<const TDLConceptTopcxx . . $ TDLConceptTop#*>(sat) != nullptr ) |
| 152 | result = Kernel.isKBConsistentcxx . . $ ReasoningKernel#isKBConsistent(c9857a73d68e59ba).(); |
| 153 | else |
| 154 | TryReasoningcxx . . $ `FaCT++/FaCT.cpp:124:9`! ( result = Kernel.isSatisfiable(sat) ); |
| 155 | |
| 156 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "The '" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). getConceptNamecxx . . $ getConceptName(f9b40294821e5fa3).(sat) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "' concept is "; |
| 157 | if ( !result ) |
| 158 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "un"; |
| 159 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "satisfiable w.r.t. TBox\n"; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | static void |
| 164 | testSubcxx . . $ testSub(c908b986ae712ebd). ( const stdcxx . . $ std/::stringcxx . . $ std/string#& names1, const stdcxx . . $ std/::stringcxx . . $ std/string#& names2, ReasoningKernelcxx . . $ ReasoningKernel#& Kernel ) |
| 165 | { |
| 166 | stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# s1cxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(d3c8ea0e6521074c).(names1), s2cxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(d3c8ea0e6521074c).(names2); |
| 167 | TsScannercxx . . $ TsScanner# sc1cxx . . $ TsScanner#TsScanner(6a35a7fc14119650).(&s1), sc2cxx . . $ TsScanner#TsScanner(6a35a7fc14119650).(&s2); |
| 168 | ReasoningKernelcxx . . $ ReasoningKernel#::TConceptExprcxx . . $ ReasoningKernel#TConceptExpr# *sub, *sup; |
| 169 | TExpressionManagercxx . . $ TExpressionManager#* pEM = Kernel.getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).(); |
| 170 | |
| 171 | while ( (sub = getNextNamecxx . . $ getNextName(72eb15375668b8f3).(sc1,pEM)) != nullptr ) |
| 172 | { |
| 173 | sc2.ReSetcxx . . $ CommonScanner#ReSet(49f6e7a06ebc5aa8).(); |
| 174 | while ( (sup = getNextNamecxx . . $ getNextName(72eb15375668b8f3).(sc2,pEM)) != nullptr ) |
| 175 | { |
| 176 | bool result = false; |
| 177 | TryReasoningcxx . . $ `FaCT++/FaCT.cpp:124:9`! ( result = Kernel.isSubsumedBy ( sub, sup ) ); |
| 178 | |
| 179 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "The '" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). getConceptNamecxx . . $ getConceptName(f9b40294821e5fa3).(sub) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " [= " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). getConceptNamecxx . . $ getConceptName(f9b40294821e5fa3).(sup) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "' subsumption does"; |
| 180 | if ( !result ) |
| 181 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " NOT"; |
| 182 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " holds w.r.t. TBox\n"; |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | static void |
| 188 | doReasoningQuerycxx . . $ doReasoningQuery(49f6e7a06ebc5aa8). ( void ) |
| 189 | { |
| 190 | if ( Querycxx . . $ Query.[0].emptycxx . . $ std/__cxx11/basic_string#empty(50ce9a9e25b4a850).() ) |
| 191 | { |
| 192 | if ( Querycxx . . $ Query.[1].emptycxx . . $ std/__cxx11/basic_string#empty(50ce9a9e25b4a850).() ) |
| 193 | TryReasoningcxx . . $ `FaCT++/FaCT.cpp:124:9`!(Kernel.realiseKB()); |
| 194 | else |
| 195 | errorcxx . . $ error(85c52e162fed56f9). ( "Query: Incorrect options" ); |
| 196 | } |
| 197 | else |
| 198 | { |
| 199 | if ( Querycxx . . $ Query.[1].emptycxx . . $ std/__cxx11/basic_string#empty(50ce9a9e25b4a850).() ) // sat |
| 200 | testSatcxx . . $ testSat(a69d1e9fe63b3c3f). ( Querycxx . . $ Query.[0], Kernelcxx . . $ Kernel. ); |
| 201 | else |
| 202 | testSubcxx . . $ testSub(c908b986ae712ebd). ( Querycxx . . $ Query.[0], Querycxx . . $ Query.[1], Kernelcxx . . $ Kernel. ); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | |
| 207 | //********************** Main function ************************************ |
| 208 | int maincxx . . $ main(afcd3168fc1188a4). ( int argc, char *argv[] ) |
| 209 | { |
| 210 | try{ |
| 211 | |
| 212 | totalTimercxx . . $ totalTimer.. Startcxx . . $ TsProcTimer#Start(49f6e7a06ebc5aa8). (); |
| 213 | |
| 214 | Kernelcxx . . $ Kernel..setTopBottomRoleNamescxx . . $ ReasoningKernel#setTopBottomRoleNames(292f14abfe735e66). ( "*UROLE*", "*EROLE*", "*UDROLE*", "*EDROLE*" ); |
| 215 | |
| 216 | // parse options |
| 217 | if ( argc > 3 || argc < 2 ) |
| 218 | Usagecxx . . $ Usage(49f6e7a06ebc5aa8). (); |
| 219 | |
| 220 | // test if we asked for default options |
| 221 | if ( !strcmp ( argv[1], "-get-default-options" ) ) |
| 222 | { // print Kernel's option set |
| 223 | Kernelcxx . . $ Kernel..getOptionscxx . . $ ReasoningKernel#getOptions(d018531a31ef00c8).()->printConfigcxx . . $ ifOptionSet#printConfig(490063bd7e6d8d5d). ( stdcxx . . $ std/::coutcxx . . $ std/cout. ); |
| 224 | exit (0); |
| 225 | } |
| 226 | |
| 227 | // loading config file... |
| 228 | if ( Configcxx . . $ Config.. Loadcxx . . $ Configuration#Load(c5f7da30cbc0f4e9). ( argv [1] ) ) |
| 229 | errorcxx . . $ error(85c52e162fed56f9). ( "Cannot load Config file" ); |
| 230 | else |
| 231 | { |
| 232 | argv++; |
| 233 | argc--; |
| 234 | } |
| 235 | |
| 236 | // fills option values by Config |
| 237 | if ( Kernelcxx . . $ Kernel..getOptionscxx . . $ ReasoningKernel#getOptions(d018531a31ef00c8).()->initByConfigurecxx . . $ ifOptionSet#initByConfigure(bb2da3fc04b58aa3). ( Configcxx . . $ Config., "Tuning"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d). ) ) |
| 238 | errorcxx . . $ error(85c52e162fed56f9). ( "Cannot fill options value by config file" ); |
| 239 | |
| 240 | // getting TBox file name |
| 241 | const char* tBoxName = nullptr; |
| 242 | if ( Configcxx . . $ Config.. checkValuecxx . . $ Configuration#checkValue(1667653f663d0d88). ( "Query"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "TBox"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d). ) ) |
| 243 | errorcxx . . $ error(85c52e162fed56f9). ( "Config: no TBox file defined" ); |
| 244 | else |
| 245 | tBoxName = Configcxx . . $ Config.. getStringcxx . . $ Configuration#getString(a9f41ea0e82d88cf). (); |
| 246 | |
| 247 | // Open input file for TBox and so on... |
| 248 | stdcxx . . $ std/::ifstreamcxx . . $ std/ifstream# iTBoxcxx . . $ std/basic_ifstream#basic_ifstream(b8cd37071ce335df). ( tBoxName ); |
| 249 | |
| 250 | if ( iTBox.failcxx . . $ std/basic_ios#fail(50ce9a9e25b4a850). () ) |
| 251 | errorcxx . . $ error(85c52e162fed56f9). ( "Cannot open input TBox file" ); |
| 252 | |
| 253 | // output file... |
| 254 | Outcxx . . $ Out..opencxx . . $ std/basic_ofstream#open(b8cd37071ce335df). ( argc == 3 ? argv [2] : "dl.res" ); |
| 255 | |
| 256 | if ( Outcxx . . $ Out..failcxx . . $ std/basic_ios#fail(50ce9a9e25b4a850). () ) |
| 257 | errorcxx . . $ error(85c52e162fed56f9). ( "Cannot open output file" ); |
| 258 | |
| 259 | if ( USE_LOGGINGcxx . . $ `Kernel/globaldef.h:45:10`! ) |
| 260 | { |
| 261 | // initialize LeveLogger only if not AD |
| 262 | if ( !Kernelcxx . . $ Kernel..getOptionscxx . . $ ReasoningKernel#getOptions(d018531a31ef00c8).()->getBoolcxx . . $ ifOptionSet#getBool(13a55b95a0133754).("checkAD"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).) ) |
| 263 | if ( LLMcxx . . $ LLM..initLoggercxx . . $ LeveLogger#initLogger(4977eee16444659f).(Configcxx . . $ Config.) ) |
| 264 | errorcxx . . $ error(85c52e162fed56f9). ( "LeveLogger: couldn't open logging file" ); |
| 265 | } |
| 266 | |
| 267 | // init timeout option |
| 268 | unsigned long testTimeout = (unsigned long)Kernelcxx . . $ Kernel..getOptionscxx . . $ ReasoningKernel#getOptions(d018531a31ef00c8).()->getIntcxx . . $ ifOptionSet#getInt(22cc3a531165f6b0).("testTimeout"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 269 | Kernelcxx . . $ Kernel..setOperationTimeoutcxx . . $ ReasoningKernel#setOperationTimeout(2c44cd906ae4e829).(testTimeout); |
| 270 | if ( LLMcxx . . $ LLM..isWritablecxx . . $ LeveLogger#isWritable(8de63fdb265b07c1).(llAlwayscxx . . $ llAlways.) ) |
| 271 | LLcxx . . $ LL. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Init testTimeout = " <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). testTimeout <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 272 | |
| 273 | // init undefined names |
| 274 | Kernelcxx . . $ Kernel..setUseUndefinedNamescxx . . $ ReasoningKernel#setUseUndefinedNames(b45ddcbc8423892c).(false); |
| 275 | |
| 276 | // dump ontology if requested |
| 277 | Kernelcxx . . $ Kernel..setDumpOntologycxx . . $ ReasoningKernel#setDumpOntology(b45ddcbc8423892c).(Kernelcxx . . $ Kernel..getOptionscxx . . $ ReasoningKernel#getOptions(d018531a31ef00c8).()->getBoolcxx . . $ ifOptionSet#getBool(13a55b95a0133754).("dumpOntology"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).)); |
| 278 | |
| 279 | // Load the ontology |
| 280 | DLLispParsercxx . . $ DLLispParser# TBoxParsercxx . . $ DLLispParser#DLLispParser(4766a9693cc45d57). ( &iTBox, &Kernelcxx . . $ Kernel. ); |
| 281 | Kernelcxx . . $ Kernel..setVerboseOutputcxx . . $ ReasoningKernel#setVerboseOutput(b45ddcbc8423892c).(true); |
| 282 | TProgressMonitorcxx . . $ TProgressMonitor#* pMon = new ConsoleProgressMonitorcxx . . $ ConsoleProgressMonitor#; |
| 283 | Kernelcxx . . $ Kernel..setProgressMonitorcxx . . $ ReasoningKernel#setProgressMonitor(192f8d731e56d7e3).(pMon); |
| 284 | |
| 285 | // parsing input TBox |
| 286 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Loading KB..."; |
| 287 | wTimercxx . . $ wTimer..Startcxx . . $ TsProcTimer#Start(49f6e7a06ebc5aa8). (); |
| 288 | TBoxParser.Parsecxx . . $ DLLispParser#Parse(49f6e7a06ebc5aa8). (); |
| 289 | wTimercxx . . $ wTimer..Stopcxx . . $ TsProcTimer#Stop(49f6e7a06ebc5aa8). (); |
| 290 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " done in " <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). wTimercxx . . $ wTimer. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " seconds\n"; |
| 291 | |
| 292 | Outcxx . . $ Out. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "loading time " <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). wTimercxx . . $ wTimer. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " seconds\n"; |
| 293 | |
| 294 | if ( Kernelcxx . . $ Kernel..getOptionscxx . . $ ReasoningKernel#getOptions(d018531a31ef00c8).()->getBoolcxx . . $ ifOptionSet#getBool(13a55b95a0133754).("checkAD"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).) ) // check atomic decomposition and exit |
| 295 | { |
| 296 | if ( argc < 2 ) |
| 297 | { |
| 298 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Atomic Decomposition option missed: use s,c,n for syntactic, counting or semantic locality checking\n"; |
| 299 | exit(1); |
| 300 | } |
| 301 | char c = argv[1][0]; |
| 302 | ModuleMethodcxx . . $ ModuleMethod# moduleMethod; |
| 303 | switch ( c ) |
| 304 | { |
| 305 | case 's' : moduleMethod = SYN_LOC_STDcxx . . $ SYN_LOC_STD.; break; |
| 306 | case 'c' : moduleMethod = SYN_LOC_COUNTcxx . . $ SYN_LOC_COUNT.; break; |
| 307 | case 'n' : moduleMethod = SEM_LOCcxx . . $ SEM_LOC.; break; |
| 308 | default: |
| 309 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Wrong AD option: " <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). c <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 310 | exit(1); |
| 311 | } |
| 312 | |
| 313 | CreateADcxx . . $ CreateAD(282b0c8dcc64148e).(&Kernelcxx . . $ Kernel..getOntologycxx . . $ ReasoningKernel#getOntology(df3ff36553523908).(), moduleMethod); |
| 314 | return 0; |
| 315 | } |
| 316 | |
| 317 | TsProcTimercxx . . $ TsProcTimer# pt; |
| 318 | pt.Startcxx . . $ TsProcTimer#Start(49f6e7a06ebc5aa8).(); |
| 319 | |
| 320 | // parsing query targets |
| 321 | fillSatSubQuerycxx . . $ fillSatSubQuery(49f6e7a06ebc5aa8).(); |
| 322 | |
| 323 | TryReasoningcxx . . $ `FaCT++/FaCT.cpp:124:9`!(Kernel.preprocessKB()); |
| 324 | |
| 325 | // do preprocessing |
| 326 | if ( !Kernelcxx . . $ Kernel..isKBConsistentcxx . . $ ReasoningKernel#isKBConsistent(c9857a73d68e59ba).() ) |
| 327 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "WARNING: KB is inconsistent. Query is NOT processed\n"; |
| 328 | else // perform reasoning |
| 329 | doReasoningQuerycxx . . $ doReasoningQuery(49f6e7a06ebc5aa8).(); |
| 330 | |
| 331 | pt.Stopcxx . . $ TsProcTimer#Stop(49f6e7a06ebc5aa8).(); |
| 332 | |
| 333 | // save final TBox |
| 334 | Kernelcxx . . $ Kernel..writeReasoningResultcxx . . $ ReasoningKernel#writeReasoningResult(6d452f970b0e0b13). ( Outcxx . . $ Out., pt ); |
| 335 | |
| 336 | // finish |
| 337 | totalTimercxx . . $ totalTimer..Stopcxx . . $ TsProcTimer#Stop(49f6e7a06ebc5aa8). (); |
| 338 | OutTimecxx . . $ OutTime(f7f45734e6842120). (stdcxx . . $ std/::coutcxx . . $ std/cout.); |
| 339 | OutTimecxx . . $ OutTime(f7f45734e6842120). (Outcxx . . $ Out.); |
| 340 | delete pMon; |
| 341 | |
| 342 | } |
| 343 | catch ( const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& e ) |
| 344 | { |
| 345 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). e.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 346 | exit(1); |
| 347 | } |
| 348 | return 0; |
| 349 | } |