| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2003-2015 Dmitry Tsarkov and The University of Manchester |
| 3 | Copyright (C) 2015-2017 Dmitry Tsarkov |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #ifndef DUMPLISP_H |
| 21 | #define DUMPLISP_Hcxx . . $ `Kernel/dumpLisp.h:21:9`! |
| 22 | |
| 23 | #include "dumpInterface.h"cxx . . $ `<file>/Kernel/dumpInterface.h`/ |
| 24 | #include "dlTBox.h"cxx . . $ `<file>/Kernel/dlTBox.h`/ //TConcept/TRole |
| 25 | |
| 26 | /// class for dumping ontology to a lisp format |
| 27 | class dumpLispcxx . . $ dumpLisp# : public dumpInterfacecxx . . $ dumpInterface# |
| 28 | { |
| 29 | public: // interface |
| 30 | /// the only c'tor -- empty |
| 31 | explicit dumpLispcxx . . $ dumpLisp#dumpLisp(f7f45734e6842120). ( stdcxx . . $ std/::ostreamcxx . . $ std/ostream#& oo ) : dumpInterfacecxx . . $ dumpInterface#dumpInterface(f7f45734e6842120).(oo) {} |
| 32 | |
| 33 | // global prologue/epilogue |
| 34 | void prologuecxx . . $ dumpLisp#prologue(49f6e7a06ebc5aa8). ( void ) override {} |
| 35 | void epiloguecxx . . $ dumpLisp#epilogue(49f6e7a06ebc5aa8). ( void ) override {} |
| 36 | |
| 37 | // general concept expression |
| 38 | void dumpTopcxx . . $ dumpLisp#dumpTop(49f6e7a06ebc5aa8). ( void ) override { ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "*TOP*"; } |
| 39 | void dumpBottomcxx . . $ dumpLisp#dumpBottom(49f6e7a06ebc5aa8). ( void ) override { ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "*BOTTOM*"; } |
| 40 | void dumpNumbercxx . . $ dumpLisp#dumpNumber(cb2f890c2fdad230). ( unsigned int n ) override { ocxx . . $ dumpInterface#o. <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). n <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " "; } |
| 41 | |
| 42 | void startOpcxx . . $ dumpLisp#startOp(7be172353191b2e5). ( diOpcxx . . $ diOp# Op ) override; |
| 43 | /// start operation >=/<= with number |
| 44 | void startOpcxx . . $ dumpLisp#startOp(8f1f39ecbb206b02). ( diOpcxx . . $ diOp# Op, unsigned int n ) override { startOpcxx . . $ dumpLisp#startOp(7be172353191b2e5).(Op); dumpNumbercxx . . $ dumpLisp#dumpNumber(cb2f890c2fdad230).(n); } |
| 45 | void contOpcxx . . $ dumpLisp#contOp(7be172353191b2e5). ( diOpcxx . . $ diOp# Op ) override |
| 46 | { |
| 47 | if ( Op == diAndcxx . . $ diAnd. || Op == diOrcxx . . $ diOr. ) |
| 48 | skipIndentcxx . . $ dumpInterface#skipIndent(49f6e7a06ebc5aa8).(); |
| 49 | else |
| 50 | ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " "; |
| 51 | } |
| 52 | void finishOpcxx . . $ dumpLisp#finishOp(7be172353191b2e5). ( diOpcxx . . $ diOp# Op ) override |
| 53 | { |
| 54 | if ( Op == diAndcxx . . $ diAnd. || Op == diOrcxx . . $ diOr. ) |
| 55 | decIndentcxx . . $ dumpInterface#decIndent(49f6e7a06ebc5aa8).(); |
| 56 | ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")"; |
| 57 | } |
| 58 | |
| 59 | void startAxcxx . . $ dumpLisp#startAx(125b68beff83e054). ( diAxcxx . . $ diAx# Ax ) override; |
| 60 | void contAxcxx . . $ dumpLisp#contAx(125b68beff83e054). ( diAxcxx . . $ diAx# ) override { ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " "; } |
| 61 | void finishAxcxx . . $ dumpLisp#finishAx(125b68beff83e054). ( diAxcxx . . $ diAx# ) override { ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")\n"; } |
| 62 | |
| 63 | /// obtain name by the named entry |
| 64 | void dumpNamecxx . . $ dumpLisp#dumpName(dccc50802eb9f6d5). ( const TNamedEntrycxx . . $ TNamedEntry#* p ) override { ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "|" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). p->getNamecxx . . $ TNamedEntry#getName(a9f41ea0e82d88cf).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "|"; } |
| 65 | /// dump concept atom (as used in expression) |
| 66 | void dumpConceptcxx . . $ dumpLisp#dumpConcept(49c8796e4511ff9d). ( const TConceptcxx . . $ TConcept#* p ) override { dumpNamecxx . . $ dumpLisp#dumpName(dccc50802eb9f6d5).(p); } |
| 67 | /// dump role atom (as used in expression) |
| 68 | void dumpRolecxx . . $ dumpLisp#dumpRole(67b1ad1f11addbc2). ( const TRolecxx . . $ TRole#* p ) override |
| 69 | { |
| 70 | if ( p->getIdcxx . . $ TNamedEntry#getId(455f465bc33b4cdf).() < 0 ) // inverse |
| 71 | { |
| 72 | ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "(inv "; |
| 73 | dumpNamecxx . . $ dumpLisp#dumpName(dccc50802eb9f6d5).(p->inversecxx . . $ TRole#inverse(69f26110a94b259f).()); |
| 74 | ocxx . . $ dumpInterface#o. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")"; |
| 75 | } |
| 76 | else |
| 77 | dumpNamecxx . . $ dumpLisp#dumpName(dccc50802eb9f6d5).(p); |
| 78 | } |
| 79 | }; // dumpLisp |
| 80 | |
| 81 | #endif |