| 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 "parser.h"cxx . . $ `<file>/FaCT++/parser.h`/ |
| 21 | |
| 22 | /********************* DLParser implementation ***************************/ |
| 23 | |
| 24 | void DLLispParsercxx . . $ DLLispParser# :: Parsecxx . . $ DLLispParser#Parse(49f6e7a06ebc5aa8). ( void ) |
| 25 | { |
| 26 | while ( Currentcxx . . $ CommonParser#Current. != LEXEOFcxx . . $ LEXEOF. ) |
| 27 | parseCommandcxx . . $ DLLispParser#parseCommand(49f6e7a06ebc5aa8). (); |
| 28 | } |
| 29 | |
| 30 | void DLLispParsercxx . . $ DLLispParser# :: parseCommandcxx . . $ DLLispParser#parseCommand(49f6e7a06ebc5aa8). ( void ) |
| 31 | { |
| 32 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f). (LBRACKcxx . . $ LBRACK.); |
| 33 | MustBecxx . . $ CommonParser#MustBe(9e9509433ff78145).(IDcxx . . $ ID.); |
| 34 | LispTokencxx . . $ LispToken# t = scancxx . . $ CommonParser#scan..getCommandKeywordcxx . . $ TsScanner#getCommandKeyword(922db4e91ebad8cc).(); |
| 35 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8). (); |
| 36 | |
| 37 | switch (t) |
| 38 | { |
| 39 | case SUBSUMEScxx . . $ SUBSUMES.: |
| 40 | case EQUAL_Ccxx . . $ EQUAL_C.: |
| 41 | { |
| 42 | TConceptExprcxx . . $ DLLispParser#TConceptExpr#* left = getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).(); |
| 43 | TConceptExprcxx . . $ DLLispParser#TConceptExpr#* right = getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).(); |
| 44 | |
| 45 | try |
| 46 | { |
| 47 | if ( t == SUBSUMEScxx . . $ SUBSUMES. ) |
| 48 | Kernelcxx . . $ DLLispParser#Kernel.->impliesConceptscxx . . $ ReasoningKernel#impliesConcepts(9ddbe9740182b8be). ( left, right ); |
| 49 | else |
| 50 | { |
| 51 | EManagercxx . . $ DLLispParser#EManager.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 52 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(left); |
| 53 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(right); |
| 54 | Kernelcxx . . $ DLLispParser#Kernel.->equalConceptscxx . . $ ReasoningKernel#equalConcepts(a85f767f1601b331).(); |
| 55 | } |
| 56 | } |
| 57 | catch ( const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& ex ) |
| 58 | { |
| 59 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).(ex.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).()); |
| 60 | } |
| 61 | break; |
| 62 | } |
| 63 | |
| 64 | case IMPLIES_Rcxx . . $ IMPLIES_R.: |
| 65 | case EQUAL_Rcxx . . $ EQUAL_R.: |
| 66 | case DISJOINT_Rcxx . . $ DISJOINT_R.: |
| 67 | case INVERSEcxx . . $ INVERSE.: |
| 68 | { |
| 69 | TRoleExprcxx . . $ DLLispParser#TRoleExpr#* R = (t == IMPLIES_Rcxx . . $ IMPLIES_R.) ? getComplexRoleExpressioncxx . . $ DLLispParser#getComplexRoleExpression(fb30ad9ce55dbcf7).() : getRoleExpressioncxx . . $ DLLispParser#getRoleExpression(fb30ad9ce55dbcf7).(); |
| 70 | if ( isDataRolecxx . . $ DLLispParser#isDataRole(affb06d02a10040d).(R) ) |
| 71 | tellRoleAxiomcxx . . $ DLLispParser#tellRoleAxiom(a6b0df800255d88e). ( t, dynamic_cast<TDRoleExprcxx . . $ DLLispParser#TDRoleExpr#*>(R), getDRoleExpressioncxx . . $ DLLispParser#getDRoleExpression(c543e5b0a3ce84d2).() ); |
| 72 | else if ( t != IMPLIES_Rcxx . . $ IMPLIES_R. ) |
| 73 | tellRoleAxiomcxx . . $ DLLispParser#tellRoleAxiom(45aca2c298be4c49). ( t, dynamic_cast<TORoleExprcxx . . $ DLLispParser#TORoleExpr#*>(R), getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4).() ); |
| 74 | else // implies_R |
| 75 | try |
| 76 | { |
| 77 | Kernelcxx . . $ DLLispParser#Kernel.->impliesORolescxx . . $ ReasoningKernel#impliesORoles(fbb992326ec74be0). ( dynamic_cast<TORoleComplexExprcxx . . $ DLLispParser#TORoleComplexExpr#*>(R), getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4).() ); |
| 78 | } |
| 79 | catch ( const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& ex ) |
| 80 | { |
| 81 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).(ex.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).()); |
| 82 | } |
| 83 | break; |
| 84 | } |
| 85 | |
| 86 | case FUNCTIONALcxx . . $ FUNCTIONAL.: |
| 87 | case TRANSITIVEcxx . . $ TRANSITIVE.: |
| 88 | case REFLEXIVEcxx . . $ REFLEXIVE.: |
| 89 | case IRREFLEXIVEcxx . . $ IRREFLEXIVE.: |
| 90 | case SYMMETRICcxx . . $ SYMMETRIC.: |
| 91 | case ASYMMETRICcxx . . $ ASYMMETRIC.: |
| 92 | { |
| 93 | TRoleExprcxx . . $ DLLispParser#TRoleExpr#* R = getRoleExpressioncxx . . $ DLLispParser#getRoleExpression(fb30ad9ce55dbcf7).(); |
| 94 | if ( isDataRolecxx . . $ DLLispParser#isDataRole(affb06d02a10040d).(R) ) |
| 95 | tellRoleAxiomcxx . . $ DLLispParser#tellRoleAxiom(a6b0df800255d88e). ( t, dynamic_cast<TDRoleExprcxx . . $ DLLispParser#TDRoleExpr#*>(R), nullptr ); |
| 96 | else |
| 97 | tellRoleAxiomcxx . . $ DLLispParser#tellRoleAxiom(45aca2c298be4c49). ( t, dynamic_cast<TORoleExprcxx . . $ DLLispParser#TORoleExpr#*>(R), nullptr ); |
| 98 | break; |
| 99 | } |
| 100 | |
| 101 | case ROLERANGEcxx . . $ ROLERANGE.: |
| 102 | case ROLEDOMAINcxx . . $ ROLEDOMAIN.: |
| 103 | { |
| 104 | TRoleExprcxx . . $ DLLispParser#TRoleExpr#* R = getRoleExpressioncxx . . $ DLLispParser#getRoleExpression(fb30ad9ce55dbcf7).(); |
| 105 | try |
| 106 | { |
| 107 | if ( isDataRolecxx . . $ DLLispParser#isDataRole(affb06d02a10040d).(R) ) |
| 108 | { |
| 109 | TDRoleExprcxx . . $ DLLispParser#TDRoleExpr#* S = dynamic_cast<TDRoleExprcxx . . $ DLLispParser#TDRoleExpr#*>(R); |
| 110 | if ( t == ROLERANGEcxx . . $ ROLERANGE. ) |
| 111 | Kernelcxx . . $ DLLispParser#Kernel.->setDRangecxx . . $ ReasoningKernel#setDRange(53740e2aac823450). ( S, getDataExpressioncxx . . $ DLLispParser#getDataExpression(52b0f360576e8085).() ); |
| 112 | else |
| 113 | Kernelcxx . . $ DLLispParser#Kernel.->setDDomaincxx . . $ ReasoningKernel#setDDomain(e6d691fd9fca005). ( S, getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).() ); |
| 114 | } |
| 115 | else |
| 116 | { |
| 117 | TORoleExprcxx . . $ DLLispParser#TORoleExpr#* S = dynamic_cast<TORoleExprcxx . . $ DLLispParser#TORoleExpr#*>(R); |
| 118 | if ( t == ROLERANGEcxx . . $ ROLERANGE. ) |
| 119 | Kernelcxx . . $ DLLispParser#Kernel.->setORangecxx . . $ ReasoningKernel#setORange(c79d55885bb7c543). ( S, getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).() ); |
| 120 | else |
| 121 | Kernelcxx . . $ DLLispParser#Kernel.->setODomaincxx . . $ ReasoningKernel#setODomain(c79d55885bb7c543). ( S, getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).() ); |
| 122 | } |
| 123 | } |
| 124 | catch ( const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& ex ) |
| 125 | { |
| 126 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).(ex.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).()); |
| 127 | } |
| 128 | break; |
| 129 | } |
| 130 | |
| 131 | // disjoint-like operator |
| 132 | case DISJOINTcxx . . $ DISJOINT.: |
| 133 | case FAIRNESScxx . . $ FAIRNESS.: |
| 134 | case DIFFERENTcxx . . $ DIFFERENT.: |
| 135 | case SAMEcxx . . $ SAME.: |
| 136 | parseConceptListcxx . . $ DLLispParser#parseConceptList(b45ddcbc8423892c). ( /*singletonsOnly=*/ (t != DISJOINTcxx . . $ DISJOINT.) && (t != FAIRNESScxx . . $ FAIRNESS.) ); |
| 137 | try |
| 138 | { |
| 139 | switch (t) |
| 140 | { |
| 141 | case DISJOINTcxx . . $ DISJOINT.: |
| 142 | Kernelcxx . . $ DLLispParser#Kernel.->disjointConceptscxx . . $ ReasoningKernel#disjointConcepts(a85f767f1601b331).(); |
| 143 | return; // already read ')' |
| 144 | case FAIRNESScxx . . $ FAIRNESS.: |
| 145 | Kernelcxx . . $ DLLispParser#Kernel.->setFairnessConstraintcxx . . $ ReasoningKernel#setFairnessConstraint(a85f767f1601b331).(); |
| 146 | return; // already read ')' |
| 147 | case SAMEcxx . . $ SAME.: |
| 148 | Kernelcxx . . $ DLLispParser#Kernel.->processSamecxx . . $ ReasoningKernel#processSame(a85f767f1601b331).(); |
| 149 | return; // already read ')' |
| 150 | case DIFFERENTcxx . . $ DIFFERENT.: |
| 151 | Kernelcxx . . $ DLLispParser#Kernel.->processDifferentcxx . . $ ReasoningKernel#processDifferent(a85f767f1601b331).(); |
| 152 | return; // already read ')' |
| 153 | default: |
| 154 | fpp_unreachablecxx . . $ `Kernel/fpp_assert.h:49:9`!(); |
| 155 | } |
| 156 | } |
| 157 | catch ( const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& ex ) |
| 158 | { |
| 159 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).(ex.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).()); |
| 160 | } |
| 161 | break; |
| 162 | |
| 163 | case PCONCEPTcxx . . $ PCONCEPT.: |
| 164 | { |
| 165 | TConceptExprcxx . . $ DLLispParser#TConceptExpr#* Name = getConceptcxx . . $ DLLispParser#getConcept(13b03fa3a15e39e7).(); |
| 166 | if ( Currentcxx . . $ CommonParser#Current. != RBRACKcxx . . $ RBRACK. ) |
| 167 | Kernelcxx . . $ DLLispParser#Kernel.->impliesConceptscxx . . $ ReasoningKernel#impliesConcepts(9ddbe9740182b8be). ( Name, getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).() ); |
| 168 | else |
| 169 | Kernelcxx . . $ DLLispParser#Kernel.->declarecxx . . $ ReasoningKernel#declare(6ee6f6ac494558bc).(Name); |
| 170 | break; |
| 171 | } |
| 172 | |
| 173 | case CONCEPTcxx . . $ CONCEPT.: |
| 174 | EManagercxx . . $ DLLispParser#EManager.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 175 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(getConceptcxx . . $ DLLispParser#getConcept(13b03fa3a15e39e7).()); |
| 176 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).()); |
| 177 | Kernelcxx . . $ DLLispParser#Kernel.->equalConceptscxx . . $ ReasoningKernel#equalConcepts(a85f767f1601b331).(); |
| 178 | break; |
| 179 | |
| 180 | case DEFINDIVIDUALcxx . . $ DEFINDIVIDUAL.: // just register singleton |
| 181 | Kernelcxx . . $ DLLispParser#Kernel.->declarecxx . . $ ReasoningKernel#declare(6ee6f6ac494558bc).(getSingletoncxx . . $ DLLispParser#getSingleton(6b6c17f94ede7fae).()); |
| 182 | break; |
| 183 | |
| 184 | case INSTANCEcxx . . $ INSTANCE.: |
| 185 | { |
| 186 | TIndividualExprcxx . . $ DLLispParser#TIndividualExpr#* Name = getSingletoncxx . . $ DLLispParser#getSingleton(6b6c17f94ede7fae).(); |
| 187 | Kernelcxx . . $ DLLispParser#Kernel.->instanceOfcxx . . $ ReasoningKernel#instanceOf(6f0498ee11afa2a2). ( Name, getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).() ); |
| 188 | break; |
| 189 | } |
| 190 | |
| 191 | case RELATEDcxx . . $ RELATED.: // command is (Related id1 R id2); |
| 192 | try |
| 193 | { |
| 194 | TIndividualExprcxx . . $ DLLispParser#TIndividualExpr#* id1 = getSingletoncxx . . $ DLLispParser#getSingleton(6b6c17f94ede7fae).(); |
| 195 | TORoleExprcxx . . $ DLLispParser#TORoleExpr#* R = getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4).(); |
| 196 | MustBecxx . . $ CommonParser#MustBe(9e9509433ff78145). (IDcxx . . $ ID.); // second individual |
| 197 | TIndividualExprcxx . . $ DLLispParser#TIndividualExpr#* id2 = getSingletoncxx . . $ DLLispParser#getSingleton(6b6c17f94ede7fae).(); |
| 198 | Kernelcxx . . $ DLLispParser#Kernel.->relatedTocxx . . $ ReasoningKernel#relatedTo(463e07427a10fcd0). ( id1, R, id2 ); |
| 199 | } |
| 200 | catch ( const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& ex ) |
| 201 | { |
| 202 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).(ex.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).()); |
| 203 | } |
| 204 | break; |
| 205 | |
| 206 | case VALUEOFcxx . . $ VALUEOF.: // command is (valueOf id1 R data); |
| 207 | try |
| 208 | { |
| 209 | TIndividualExprcxx . . $ DLLispParser#TIndividualExpr#* id1 = getSingletoncxx . . $ DLLispParser#getSingleton(6b6c17f94ede7fae).(); |
| 210 | TDRoleExprcxx . . $ DLLispParser#TDRoleExpr#* R = getDRoleExpressioncxx . . $ DLLispParser#getDRoleExpression(c543e5b0a3ce84d2).(); |
| 211 | TDataValueExprcxx . . $ DLLispParser#TDataValueExpr#* data = dynamic_cast<TDataValueExprcxx . . $ DLLispParser#TDataValueExpr#*>(getDataExpressioncxx . . $ DLLispParser#getDataExpression(52b0f360576e8085).()); |
| 212 | Kernelcxx . . $ DLLispParser#Kernel.->valueOfcxx . . $ ReasoningKernel#valueOf(37daa01f957a95bc).(id1, R, data); |
| 213 | } |
| 214 | catch (const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& ex) |
| 215 | { |
| 216 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).(ex.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).()); |
| 217 | } |
| 218 | break; |
| 219 | |
| 220 | case PROLEcxx . . $ PROLE.: |
| 221 | case PATTRcxx . . $ PATTR.: |
| 222 | { |
| 223 | TORoleExprcxx . . $ DLLispParser#TORoleExpr#* Name = getObjectRolecxx . . $ DLLispParser#getObjectRole(c66348bd9c8594d4).(); |
| 224 | |
| 225 | if ( t == PATTRcxx . . $ PATTR. ) |
| 226 | try |
| 227 | { |
| 228 | Kernelcxx . . $ DLLispParser#Kernel.->setOFunctionalcxx . . $ ReasoningKernel#setOFunctional(de8740941eccd406).(Name); |
| 229 | } |
| 230 | catch ( const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& ex ) |
| 231 | { |
| 232 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).(ex.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).()); |
| 233 | } |
| 234 | |
| 235 | if ( Currentcxx . . $ CommonParser#Current. != RBRACKcxx . . $ RBRACK. ) |
| 236 | parseRoleArgumentscxx . . $ DLLispParser#parseRoleArguments(4301d0bef5e81149).(Name); |
| 237 | else |
| 238 | Kernelcxx . . $ DLLispParser#Kernel.->declarecxx . . $ ReasoningKernel#declare(6ee6f6ac494558bc).(Name); |
| 239 | break; |
| 240 | } |
| 241 | |
| 242 | case DATAROLEcxx . . $ DATAROLE.: // register data role |
| 243 | Kernelcxx . . $ DLLispParser#Kernel.->declarecxx . . $ ReasoningKernel#declare(6ee6f6ac494558bc).(getDataRolecxx . . $ DLLispParser#getDataRole(c543e5b0a3ce84d2).()); |
| 244 | break; |
| 245 | |
| 246 | default: |
| 247 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77). ( "Unrecognised command" ); |
| 248 | } |
| 249 | |
| 250 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f). ( RBRACKcxx . . $ RBRACK. ); // skip bracket |
| 251 | } |
| 252 | |
| 253 | /// generate object role axiom between R and S according to the operation TAG |
| 254 | void |
| 255 | DLLispParsercxx . . $ DLLispParser# :: tellRoleAxiomcxx . . $ DLLispParser#tellRoleAxiom(45aca2c298be4c49). ( LispTokencxx . . $ LispToken# tag, TORoleExprcxx . . $ DLLispParser#TORoleExpr#* R, TORoleExprcxx . . $ DLLispParser#TORoleExpr#* S ) |
| 256 | { |
| 257 | try |
| 258 | { |
| 259 | switch(tag) |
| 260 | { |
| 261 | case INVERSEcxx . . $ INVERSE.: |
| 262 | Kernelcxx . . $ DLLispParser#Kernel.->setInverseRolescxx . . $ ReasoningKernel#setInverseRoles(2f1b9e1d366167c7). ( R, S ); |
| 263 | break; |
| 264 | |
| 265 | case DISJOINT_Rcxx . . $ DISJOINT_R.: |
| 266 | case EQUAL_Rcxx . . $ EQUAL_R.: |
| 267 | EManagercxx . . $ DLLispParser#EManager.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 268 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(R); |
| 269 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(S); |
| 270 | if ( tag == DISJOINT_Rcxx . . $ DISJOINT_R. ) |
| 271 | Kernelcxx . . $ DLLispParser#Kernel.->disjointORolescxx . . $ ReasoningKernel#disjointORoles(a85f767f1601b331).(); |
| 272 | else |
| 273 | Kernelcxx . . $ DLLispParser#Kernel.->equalORolescxx . . $ ReasoningKernel#equalORoles(a85f767f1601b331).(); |
| 274 | break; |
| 275 | |
| 276 | case FUNCTIONALcxx . . $ FUNCTIONAL.: |
| 277 | Kernelcxx . . $ DLLispParser#Kernel.->setOFunctionalcxx . . $ ReasoningKernel#setOFunctional(de8740941eccd406).(R); |
| 278 | break; |
| 279 | case TRANSITIVEcxx . . $ TRANSITIVE.: |
| 280 | Kernelcxx . . $ DLLispParser#Kernel.->setTransitivecxx . . $ ReasoningKernel#setTransitive(de8740941eccd406).(R); |
| 281 | break; |
| 282 | case REFLEXIVEcxx . . $ REFLEXIVE.: |
| 283 | Kernelcxx . . $ DLLispParser#Kernel.->setReflexivecxx . . $ ReasoningKernel#setReflexive(de8740941eccd406).(R); |
| 284 | break; |
| 285 | case IRREFLEXIVEcxx . . $ IRREFLEXIVE.: |
| 286 | Kernelcxx . . $ DLLispParser#Kernel.->setIrreflexivecxx . . $ ReasoningKernel#setIrreflexive(de8740941eccd406).(R); |
| 287 | break; |
| 288 | case SYMMETRICcxx . . $ SYMMETRIC.: |
| 289 | Kernelcxx . . $ DLLispParser#Kernel.->setSymmetriccxx . . $ ReasoningKernel#setSymmetric(de8740941eccd406).(R); |
| 290 | break; |
| 291 | case ASYMMETRICcxx . . $ ASYMMETRIC.: |
| 292 | Kernelcxx . . $ DLLispParser#Kernel.->setAsymmetriccxx . . $ ReasoningKernel#setAsymmetric(de8740941eccd406).(R); |
| 293 | break; |
| 294 | |
| 295 | default: |
| 296 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).("Unrecognised object role command"); |
| 297 | } |
| 298 | } |
| 299 | catch ( const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& ex ) |
| 300 | { |
| 301 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).(ex.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).()); |
| 302 | } |
| 303 | } |
| 304 | /// generate data role axiom between R and S according to the operation TAG |
| 305 | void |
| 306 | DLLispParsercxx . . $ DLLispParser# :: tellRoleAxiomcxx . . $ DLLispParser#tellRoleAxiom(a6b0df800255d88e). ( LispTokencxx . . $ LispToken# tag, TDRoleExprcxx . . $ DLLispParser#TDRoleExpr#* R, TDRoleExprcxx . . $ DLLispParser#TDRoleExpr#* S ) |
| 307 | { |
| 308 | try |
| 309 | { |
| 310 | switch(tag) |
| 311 | { |
| 312 | case IMPLIES_Rcxx . . $ IMPLIES_R.: |
| 313 | Kernelcxx . . $ DLLispParser#Kernel.->impliesDRolescxx . . $ ReasoningKernel#impliesDRoles(d0244c75cc050b68). ( R, S ); |
| 314 | break; |
| 315 | |
| 316 | case DISJOINT_Rcxx . . $ DISJOINT_R.: |
| 317 | case EQUAL_Rcxx . . $ EQUAL_R.: |
| 318 | EManagercxx . . $ DLLispParser#EManager.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 319 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(R); |
| 320 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(S); |
| 321 | if ( tag == DISJOINT_Rcxx . . $ DISJOINT_R. ) |
| 322 | Kernelcxx . . $ DLLispParser#Kernel.->disjointDRolescxx . . $ ReasoningKernel#disjointDRoles(a85f767f1601b331).(); |
| 323 | else |
| 324 | Kernelcxx . . $ DLLispParser#Kernel.->equalDRolescxx . . $ ReasoningKernel#equalDRoles(a85f767f1601b331).(); |
| 325 | break; |
| 326 | |
| 327 | case FUNCTIONALcxx . . $ FUNCTIONAL.: |
| 328 | Kernelcxx . . $ DLLispParser#Kernel.->setDFunctionalcxx . . $ ReasoningKernel#setDFunctional(6ede7e710a8dc4ea).(R); |
| 329 | break; |
| 330 | |
| 331 | default: |
| 332 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).("Unrecognised data role command"); |
| 333 | } |
| 334 | } |
| 335 | catch ( const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& ex ) |
| 336 | { |
| 337 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).(ex.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).()); |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | void DLLispParsercxx . . $ DLLispParser# :: parseConceptListcxx . . $ DLLispParser#parseConceptList(b45ddcbc8423892c). ( bool singletonsOnly ) |
| 342 | { |
| 343 | EManagercxx . . $ DLLispParser#EManager.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 344 | |
| 345 | // continue with all concepts |
| 346 | while ( Currentcxx . . $ CommonParser#Current. != RBRACKcxx . . $ RBRACK. ) |
| 347 | if ( singletonsOnly ) |
| 348 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(getSingletoncxx . . $ DLLispParser#getSingleton(6b6c17f94ede7fae).()); |
| 349 | else |
| 350 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).()); |
| 351 | |
| 352 | // skip RBRACK |
| 353 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f). (RBRACKcxx . . $ RBRACK.); |
| 354 | } |
| 355 | |
| 356 | void DLLispParsercxx . . $ DLLispParser# :: parseRoleArgumentscxx . . $ DLLispParser#parseRoleArguments(4301d0bef5e81149). ( TORoleExprcxx . . $ DLLispParser#TORoleExpr#* R ) |
| 357 | { |
| 358 | while ( Currentcxx . . $ CommonParser#Current. != RBRACKcxx . . $ RBRACK. ) |
| 359 | if ( scancxx . . $ CommonParser#scan..isKeywordcxx . . $ CommonScanner#isKeyword(7d4bdb1abc417636). ("parents") || scancxx . . $ CommonParser#scan..isKeywordcxx . . $ CommonScanner#isKeyword(7d4bdb1abc417636). ("supers") ) |
| 360 | { // followed by a list of parent role names |
| 361 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8). (); |
| 362 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f). ( LBRACKcxx . . $ LBRACK. ); |
| 363 | |
| 364 | while ( Currentcxx . . $ CommonParser#Current. != RBRACKcxx . . $ RBRACK. ) |
| 365 | { |
| 366 | try |
| 367 | { // only object roles can have arguments |
| 368 | Kernelcxx . . $ DLLispParser#Kernel.->impliesORolescxx . . $ ReasoningKernel#impliesORoles(fbb992326ec74be0). ( R, getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4).() ); |
| 369 | } |
| 370 | catch ( const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& ex ) |
| 371 | { |
| 372 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).(ex.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).()); |
| 373 | } |
| 374 | } |
| 375 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8). (); // skip last RBRACK |
| 376 | } |
| 377 | else if ( scancxx . . $ CommonParser#scan..isKeywordcxx . . $ CommonScanner#isKeyword(7d4bdb1abc417636). ("transitive") ) |
| 378 | { // followed by NIL or (usually!) T |
| 379 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8). (); |
| 380 | |
| 381 | try |
| 382 | { |
| 383 | Kernelcxx . . $ DLLispParser#Kernel.->setTransitivecxx . . $ ReasoningKernel#setTransitive(de8740941eccd406).(R); |
| 384 | } |
| 385 | catch ( const EFaCTPlusPluscxx . . $ EFaCTPlusPlus#& ex ) |
| 386 | { |
| 387 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).(ex.whatcxx . . $ EFaCTPlusPlus#what(a9f41ea0e82d88cf).()); |
| 388 | } |
| 389 | |
| 390 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8). (); // skip token |
| 391 | } |
| 392 | else |
| 393 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77). ( "use either :parents or :transitive command in role description" ); |
| 394 | } |
| 395 | |
| 396 | DLLispParsercxx . . $ DLLispParser#::TConceptExprcxx . . $ DLLispParser#TConceptExpr#* |
| 397 | DLLispParsercxx . . $ DLLispParser# :: getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7). ( void ) |
| 398 | { |
| 399 | switch ( Codecxx . . $ CommonParser#Code(922db4e91ebad8cc).() ) |
| 400 | { |
| 401 | case LBRACKcxx . . $ LBRACK.: // complex description |
| 402 | return getComplexConceptExpressioncxx . . $ DLLispParser#getComplexConceptExpression(13b03fa3a15e39e7). (); |
| 403 | case NUMcxx . . $ NUM.: // numbers in concept expressions are constant names |
| 404 | return getConceptcxx . . $ DLLispParser#getConcept(13b03fa3a15e39e7).(); |
| 405 | case IDcxx . . $ ID.: |
| 406 | { |
| 407 | switch ( scancxx . . $ CommonParser#scan..getNameKeywordcxx . . $ TsScanner#getNameKeyword(922db4e91ebad8cc).() ) |
| 408 | { // Top/Bottom or real ID |
| 409 | case L_TOPcxx . . $ L_TOP.: NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); return EManagercxx . . $ DLLispParser#EManager.->Topcxx . . $ TExpressionManager#Top(aac0c49b6bdfac38).(); |
| 410 | case L_BOTTOMcxx . . $ L_BOTTOM.: NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); return EManagercxx . . $ DLLispParser#EManager.->Bottomcxx . . $ TExpressionManager#Bottom(2a1e789bc1a0a42f).(); |
| 411 | default: return getConceptcxx . . $ DLLispParser#getConcept(13b03fa3a15e39e7).(); |
| 412 | } |
| 413 | } |
| 414 | default: // else -- report syntax error |
| 415 | MustBecxx . . $ CommonParser#MustBe(9e9509433ff78145).(IDcxx . . $ ID.); |
| 416 | return nullptr; |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | DLLispParsercxx . . $ DLLispParser#::TConceptExprcxx . . $ DLLispParser#TConceptExpr#* |
| 421 | DLLispParsercxx . . $ DLLispParser# :: getComplexConceptExpressioncxx . . $ DLLispParser#getComplexConceptExpression(13b03fa3a15e39e7). ( void ) |
| 422 | { |
| 423 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f). ( LBRACKcxx . . $ LBRACK. ); |
| 424 | LispTokencxx . . $ LispToken# T = scancxx . . $ CommonParser#scan..getExpressionKeywordcxx . . $ TsScanner#getExpressionKeyword(922db4e91ebad8cc).(); |
| 425 | unsigned int n = 0; // number for >= (<=) expression (or just 0) |
| 426 | TRoleExprcxx . . $ DLLispParser#TRoleExpr#* R = nullptr; |
| 427 | TConceptExprcxx . . $ DLLispParser#TConceptExpr#* C = nullptr; |
| 428 | |
| 429 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8). (); |
| 430 | |
| 431 | switch (T) |
| 432 | { |
| 433 | case L_GEcxx . . $ L_GE.: |
| 434 | case L_LEcxx . . $ L_LE.: |
| 435 | n = (unsigned int)scancxx . . $ CommonParser#scan..GetNumbercxx . . $ CommonScanner#GetNumber(fe4d2d262d4164a8).(); |
| 436 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8). (); |
| 437 | // fallthrough |
| 438 | case L_FORALLcxx . . $ L_FORALL.: |
| 439 | case L_EXISTScxx . . $ L_EXISTS.: |
| 440 | // first argument -- role name |
| 441 | R = getRoleExpressioncxx . . $ DLLispParser#getRoleExpression(fb30ad9ce55dbcf7).(); |
| 442 | if ( isDataRolecxx . . $ DLLispParser#isDataRole(affb06d02a10040d).(R) ) // data expression |
| 443 | { |
| 444 | TDRoleExprcxx . . $ DLLispParser#TDRoleExpr#* A = dynamic_cast<TDRoleExprcxx . . $ DLLispParser#TDRoleExpr#*>(R); |
| 445 | TDataExprcxx . . $ DLLispParser#TDataExpr#* E = nullptr; |
| 446 | |
| 447 | // second argument -- data expression |
| 448 | if ( Currentcxx . . $ CommonParser#Current. == RBRACKcxx . . $ RBRACK. ) |
| 449 | E = EManagercxx . . $ DLLispParser#EManager.->DataTopcxx . . $ TExpressionManager#DataTop(9f9fdff2273d849c).(); // for (GE n R) |
| 450 | else |
| 451 | E = getDataExpressioncxx . . $ DLLispParser#getDataExpression(52b0f360576e8085).(); |
| 452 | |
| 453 | // skip right bracket |
| 454 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(RBRACKcxx . . $ RBRACK.); |
| 455 | |
| 456 | if ( T == L_EXISTScxx . . $ L_EXISTS. ) |
| 457 | return EManagercxx . . $ DLLispParser#EManager.->Existscxx . . $ TExpressionManager#Exists(2a4ec6bc45376abb). ( A, E ); |
| 458 | else if ( T == L_FORALLcxx . . $ L_FORALL. ) |
| 459 | return EManagercxx . . $ DLLispParser#EManager.->Forallcxx . . $ TExpressionManager#Forall(2a4ec6bc45376abb). ( A, E ); |
| 460 | else if ( T == L_GEcxx . . $ L_GE. ) |
| 461 | return EManagercxx . . $ DLLispParser#EManager.->MinCardinalitycxx . . $ TExpressionManager#MinCardinality(970f1e34a516ac29). ( n, A, E ); |
| 462 | else |
| 463 | return EManagercxx . . $ DLLispParser#EManager.->MaxCardinalitycxx . . $ TExpressionManager#MaxCardinality(970f1e34a516ac29). ( n, A, E ); |
| 464 | } |
| 465 | else |
| 466 | { |
| 467 | TORoleExprcxx . . $ DLLispParser#TORoleExpr#* S = dynamic_cast<TORoleExprcxx . . $ DLLispParser#TORoleExpr#*>(R); |
| 468 | |
| 469 | // second argument -- data expression |
| 470 | if ( Currentcxx . . $ CommonParser#Current. == RBRACKcxx . . $ RBRACK. ) |
| 471 | C = EManagercxx . . $ DLLispParser#EManager.->Topcxx . . $ TExpressionManager#Top(aac0c49b6bdfac38).(); // for (GE n R) |
| 472 | else |
| 473 | C = getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).(); |
| 474 | |
| 475 | // skip right bracket |
| 476 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(RBRACKcxx . . $ RBRACK.); |
| 477 | |
| 478 | if ( T == L_EXISTScxx . . $ L_EXISTS. ) |
| 479 | return EManagercxx . . $ DLLispParser#EManager.->Existscxx . . $ TExpressionManager#Exists(1977ffbf49b50255). ( S, C ); |
| 480 | else if ( T == L_FORALLcxx . . $ L_FORALL. ) |
| 481 | return EManagercxx . . $ DLLispParser#EManager.->Forallcxx . . $ TExpressionManager#Forall(1977ffbf49b50255). ( S, C ); |
| 482 | else if ( T == L_GEcxx . . $ L_GE. ) |
| 483 | return EManagercxx . . $ DLLispParser#EManager.->MinCardinalitycxx . . $ TExpressionManager#MinCardinality(7ff11ffeb6ece181). ( n, S, C ); |
| 484 | else |
| 485 | return EManagercxx . . $ DLLispParser#EManager.->MaxCardinalitycxx . . $ TExpressionManager#MaxCardinality(7ff11ffeb6ece181). ( n, S, C ); |
| 486 | } |
| 487 | |
| 488 | case REFLEXIVEcxx . . $ REFLEXIVE.: // self-reference |
| 489 | R = getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4).(); |
| 490 | // skip right bracket |
| 491 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(RBRACKcxx . . $ RBRACK.); |
| 492 | return EManagercxx . . $ DLLispParser#EManager.->SelfReferencecxx . . $ TExpressionManager#SelfReference(9065bafcb0572b22).(dynamic_cast<TORoleExprcxx . . $ DLLispParser#TORoleExpr#*>(R)); |
| 493 | |
| 494 | case L_NOTcxx . . $ L_NOT.: |
| 495 | C = getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).(); |
| 496 | // skip right bracket |
| 497 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(RBRACKcxx . . $ RBRACK.); |
| 498 | return EManagercxx . . $ DLLispParser#EManager.->Notcxx . . $ TExpressionManager#Not(a5147c10d6f77be7).(C); |
| 499 | |
| 500 | case L_ANDcxx . . $ L_AND.: |
| 501 | case L_ORcxx . . $ L_OR.: // multiple And's/Or's |
| 502 | EManagercxx . . $ DLLispParser#EManager.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 503 | do |
| 504 | { |
| 505 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).()); |
| 506 | } while ( Currentcxx . . $ CommonParser#Current. != RBRACKcxx . . $ RBRACK. ); |
| 507 | |
| 508 | // list is parsed here |
| 509 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); // skip ')' |
| 510 | return T == L_ANDcxx . . $ L_AND. ? EManagercxx . . $ DLLispParser#EManager.->Andcxx . . $ TExpressionManager#And(bdfb1e6da6a1dacd).() : EManagercxx . . $ DLLispParser#EManager.->Orcxx . . $ TExpressionManager#Or(bdfb1e6da6a1dacd).(); |
| 511 | |
| 512 | case ONEOFcxx . . $ ONEOF.: |
| 513 | parseConceptListcxx . . $ DLLispParser#parseConceptList(b45ddcbc8423892c).(/*singletonsOnly=*/true); |
| 514 | return EManagercxx . . $ DLLispParser#EManager.->OneOfcxx . . $ TExpressionManager#OneOf(bdfb1e6da6a1dacd).(); |
| 515 | |
| 516 | default: // error |
| 517 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77). ( "Unknown concept constructor" ); |
| 518 | return nullptr; // FSCO |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | DLLispParsercxx . . $ DLLispParser#::TDRoleExprcxx . . $ DLLispParser#TDRoleExpr#* |
| 523 | DLLispParsercxx . . $ DLLispParser# :: getDRoleExpressioncxx . . $ DLLispParser#getDRoleExpression(c543e5b0a3ce84d2). ( void ) |
| 524 | { |
| 525 | MustBecxx . . $ CommonParser#MustBe(9e9509433ff78145). ( IDcxx . . $ ID., "Data role name expected" ); |
| 526 | return getDataRolecxx . . $ DLLispParser#getDataRole(c543e5b0a3ce84d2).(); |
| 527 | } |
| 528 | |
| 529 | DLLispParsercxx . . $ DLLispParser#::TORoleExprcxx . . $ DLLispParser#TORoleExpr#* |
| 530 | DLLispParsercxx . . $ DLLispParser# :: getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4). ( void ) |
| 531 | { |
| 532 | if ( Currentcxx . . $ CommonParser#Current. != LBRACKcxx . . $ LBRACK. ) |
| 533 | return getObjectRolecxx . . $ DLLispParser#getObjectRole(c66348bd9c8594d4).(); |
| 534 | |
| 535 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); // skip '(' |
| 536 | if ( scancxx . . $ CommonParser#scan..getExpressionKeywordcxx . . $ TsScanner#getExpressionKeyword(922db4e91ebad8cc).() != L_INVcxx . . $ L_INV. ) |
| 537 | MustBecxx . . $ CommonParser#MustBe(9e9509433ff78145). ( L_INVcxx . . $ L_INV., "only role names and their inverses are allowed as a role expression" ); |
| 538 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); // skip INV |
| 539 | TORoleExprcxx . . $ DLLispParser#TORoleExpr#* ret = EManagercxx . . $ DLLispParser#EManager.->Inversecxx . . $ TExpressionManager#Inverse(c6736427cdccb407).(getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4).()); |
| 540 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(RBRACKcxx . . $ RBRACK.); |
| 541 | return ret; |
| 542 | } |
| 543 | |
| 544 | DLLispParsercxx . . $ DLLispParser#::TRoleExprcxx . . $ DLLispParser#TRoleExpr#* |
| 545 | DLLispParsercxx . . $ DLLispParser# :: getRoleExpressioncxx . . $ DLLispParser#getRoleExpression(fb30ad9ce55dbcf7). ( void ) |
| 546 | { |
| 547 | if ( Currentcxx . . $ CommonParser#Current. != LBRACKcxx . . $ LBRACK. ) |
| 548 | return getRolecxx . . $ DLLispParser#getRole(fb30ad9ce55dbcf7).(); |
| 549 | |
| 550 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); // skip '(' |
| 551 | if ( scancxx . . $ CommonParser#scan..getExpressionKeywordcxx . . $ TsScanner#getExpressionKeyword(922db4e91ebad8cc).() != L_INVcxx . . $ L_INV. ) |
| 552 | MustBecxx . . $ CommonParser#MustBe(9e9509433ff78145). ( L_INVcxx . . $ L_INV., "only role names and their inverses are allowed as a role expression" ); |
| 553 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); // skip INV |
| 554 | TORoleExprcxx . . $ DLLispParser#TORoleExpr#* ret = EManagercxx . . $ DLLispParser#EManager.->Inversecxx . . $ TExpressionManager#Inverse(c6736427cdccb407).(getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4).()); |
| 555 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(RBRACKcxx . . $ RBRACK.); |
| 556 | return ret; |
| 557 | } |
| 558 | |
| 559 | DLLispParsercxx . . $ DLLispParser#::TRoleExprcxx . . $ DLLispParser#TRoleExpr#* |
| 560 | DLLispParsercxx . . $ DLLispParser# :: getComplexRoleExpressioncxx . . $ DLLispParser#getComplexRoleExpression(fb30ad9ce55dbcf7). ( void ) |
| 561 | { |
| 562 | if ( Currentcxx . . $ CommonParser#Current. != LBRACKcxx . . $ LBRACK. ) |
| 563 | return getRolecxx . . $ DLLispParser#getRole(fb30ad9ce55dbcf7).(); |
| 564 | |
| 565 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); // skip '(' |
| 566 | LispTokencxx . . $ LispToken# keyword = scancxx . . $ CommonParser#scan..getExpressionKeywordcxx . . $ TsScanner#getExpressionKeyword(922db4e91ebad8cc).(); |
| 567 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); // skip keyword |
| 568 | TORoleComplexExprcxx . . $ DLLispParser#TORoleComplexExpr#* ret = nullptr; |
| 569 | TORoleExprcxx . . $ DLLispParser#TORoleExpr#* R; |
| 570 | switch ( keyword ) |
| 571 | { |
| 572 | case L_INVcxx . . $ L_INV.: // inverse of a simple role |
| 573 | ret = EManagercxx . . $ DLLispParser#EManager.->Inversecxx . . $ TExpressionManager#Inverse(c6736427cdccb407).(getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4).()); |
| 574 | break; |
| 575 | case L_RCOMPOSITIONcxx . . $ L_RCOMPOSITION.: // role composition expression = list of simple roles |
| 576 | EManagercxx . . $ DLLispParser#EManager.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 577 | while ( Currentcxx . . $ CommonParser#Current. != RBRACKcxx . . $ RBRACK. ) |
| 578 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4).()); |
| 579 | ret = EManagercxx . . $ DLLispParser#EManager.->Composecxx . . $ TExpressionManager#Compose(5f62c3934368bfed).(); |
| 580 | break; |
| 581 | case L_PROJINTOcxx . . $ L_PROJINTO.: // role projection operator, parse simple role and concept |
| 582 | R = getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4).(); |
| 583 | ret = EManagercxx . . $ DLLispParser#EManager.->ProjectIntocxx . . $ TExpressionManager#ProjectInto(afe880527d531d5c). ( R, getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).() ); |
| 584 | break; |
| 585 | case L_PROJFROMcxx . . $ L_PROJFROM.: // role projection operator, parse simple role and concept |
| 586 | R = getORoleExpressioncxx . . $ DLLispParser#getORoleExpression(c66348bd9c8594d4).(); |
| 587 | ret = EManagercxx . . $ DLLispParser#EManager.->ProjectFromcxx . . $ TExpressionManager#ProjectFrom(afe880527d531d5c). ( R, getConceptExpressioncxx . . $ DLLispParser#getConceptExpression(13b03fa3a15e39e7).() ); |
| 588 | break; |
| 589 | default: |
| 590 | MustBecxx . . $ CommonParser#MustBe(9e9509433ff78145). ( L_INVcxx . . $ L_INV., "unknown expression in complex role constructor" ); |
| 591 | } |
| 592 | |
| 593 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(RBRACKcxx . . $ RBRACK.); |
| 594 | return ret; |
| 595 | } |
| 596 | |
| 597 | DLLispParsercxx . . $ DLLispParser#::TDataExprcxx . . $ DLLispParser#TDataExpr#* |
| 598 | DLLispParsercxx . . $ DLLispParser# :: getDataExpressioncxx . . $ DLLispParser#getDataExpression(52b0f360576e8085). ( void ) |
| 599 | { |
| 600 | // check for TOP/BOTTOM |
| 601 | if ( Codecxx . . $ CommonParser#Code(922db4e91ebad8cc).() == IDcxx . . $ ID. ) |
| 602 | { |
| 603 | switch ( scancxx . . $ CommonParser#scan..getNameKeywordcxx . . $ TsScanner#getNameKeyword(922db4e91ebad8cc).() ) |
| 604 | { // Top/Bottom; can not be name |
| 605 | case L_TOPcxx . . $ L_TOP.: NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); return EManagercxx . . $ DLLispParser#EManager.->DataTopcxx . . $ TExpressionManager#DataTop(9f9fdff2273d849c).(); |
| 606 | case L_BOTTOMcxx . . $ L_BOTTOM.: NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); return EManagercxx . . $ DLLispParser#EManager.->DataBottomcxx . . $ TExpressionManager#DataBottom(9f9fdff2273d849c).(); |
| 607 | default: parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77). ( "Unknown data constructor" ); return nullptr; |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(LBRACKcxx . . $ LBRACK.); // always complex expression |
| 612 | LispTokencxx . . $ LispToken# T = scancxx . . $ CommonParser#scan..getExpressionKeywordcxx . . $ TsScanner#getExpressionKeyword(922db4e91ebad8cc).(); |
| 613 | |
| 614 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8). (); |
| 615 | |
| 616 | switch (T) |
| 617 | { |
| 618 | case DTGTcxx . . $ DTGT.: // facet ">" |
| 619 | { |
| 620 | TDataValueExprcxx . . $ DLLispParser#TDataValueExpr#* value = dynamic_cast<TDataValueExprcxx . . $ DLLispParser#TDataValueExpr#*>(getDataExpressioncxx . . $ DLLispParser#getDataExpression(52b0f360576e8085).()); |
| 621 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(RBRACKcxx . . $ RBRACK.); |
| 622 | if ( value == nullptr ) |
| 623 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).("Data value expected"); |
| 624 | // the type of the expression is taken from value; it is basic type, so it is safe to make it RW |
| 625 | TDataTypeExprcxx . . $ DLLispParser#TDataTypeExpr#* type = const_cast<TDataTypeExprcxx . . $ DLLispParser#TDataTypeExpr#*>(value->getExprcxx . . $ TDataExpressionArg#getExpr(1016ee5406d91ab9).()); |
| 626 | return EManagercxx . . $ DLLispParser#EManager.->RestrictedTypecxx . . $ TExpressionManager#RestrictedType(835ba682b65d9bd9). ( type, EManagercxx . . $ DLLispParser#EManager.->FacetMinExclusivecxx . . $ TExpressionManager#FacetMinExclusive(fb0bf252cd5e7c9e).(value) ); |
| 627 | } |
| 628 | case DTGEcxx . . $ DTGE.: // facet ">=" |
| 629 | { |
| 630 | TDataValueExprcxx . . $ DLLispParser#TDataValueExpr#* value = dynamic_cast<TDataValueExprcxx . . $ DLLispParser#TDataValueExpr#*>(getDataExpressioncxx . . $ DLLispParser#getDataExpression(52b0f360576e8085).()); |
| 631 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(RBRACKcxx . . $ RBRACK.); |
| 632 | if ( value == nullptr ) |
| 633 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).("Data value expected"); |
| 634 | // the type of the expression is taken from value; it is basic type, so it is safe to make it RW |
| 635 | TDataTypeExprcxx . . $ DLLispParser#TDataTypeExpr#* type = const_cast<TDataTypeExprcxx . . $ DLLispParser#TDataTypeExpr#*>(value->getExprcxx . . $ TDataExpressionArg#getExpr(1016ee5406d91ab9).()); |
| 636 | return EManagercxx . . $ DLLispParser#EManager.->RestrictedTypecxx . . $ TExpressionManager#RestrictedType(835ba682b65d9bd9). ( type, EManagercxx . . $ DLLispParser#EManager.->FacetMinInclusivecxx . . $ TExpressionManager#FacetMinInclusive(fb0bf252cd5e7c9e).(value) ); |
| 637 | } |
| 638 | case DTLTcxx . . $ DTLT.: // facet "<" |
| 639 | { |
| 640 | TDataValueExprcxx . . $ DLLispParser#TDataValueExpr#* value = dynamic_cast<TDataValueExprcxx . . $ DLLispParser#TDataValueExpr#*>(getDataExpressioncxx . . $ DLLispParser#getDataExpression(52b0f360576e8085).()); |
| 641 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(RBRACKcxx . . $ RBRACK.); |
| 642 | if ( value == nullptr ) |
| 643 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).("Data value expected"); |
| 644 | // the type of the expression is taken from value; it is basic type, so it is safe to make it RW |
| 645 | TDataTypeExprcxx . . $ DLLispParser#TDataTypeExpr#* type = const_cast<TDataTypeExprcxx . . $ DLLispParser#TDataTypeExpr#*>(value->getExprcxx . . $ TDataExpressionArg#getExpr(1016ee5406d91ab9).()); |
| 646 | return EManagercxx . . $ DLLispParser#EManager.->RestrictedTypecxx . . $ TExpressionManager#RestrictedType(835ba682b65d9bd9). ( type, EManagercxx . . $ DLLispParser#EManager.->FacetMaxExclusivecxx . . $ TExpressionManager#FacetMaxExclusive(fb0bf252cd5e7c9e).(value) ); |
| 647 | } |
| 648 | case DTLEcxx . . $ DTLE.: // facet "<=" |
| 649 | { |
| 650 | TDataValueExprcxx . . $ DLLispParser#TDataValueExpr#* value = dynamic_cast<TDataValueExprcxx . . $ DLLispParser#TDataValueExpr#*>(getDataExpressioncxx . . $ DLLispParser#getDataExpression(52b0f360576e8085).()); |
| 651 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f).(RBRACKcxx . . $ RBRACK.); |
| 652 | if ( value == nullptr ) |
| 653 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77).("Data value expected"); |
| 654 | // the type of the expression is taken from value; it is basic type, so it is safe to make it RW |
| 655 | TDataTypeExprcxx . . $ DLLispParser#TDataTypeExpr#* type = const_cast<TDataTypeExprcxx . . $ DLLispParser#TDataTypeExpr#*>(value->getExprcxx . . $ TDataExpressionArg#getExpr(1016ee5406d91ab9).()); |
| 656 | return EManagercxx . . $ DLLispParser#EManager.->RestrictedTypecxx . . $ TExpressionManager#RestrictedType(835ba682b65d9bd9). ( type, EManagercxx . . $ DLLispParser#EManager.->FacetMaxInclusivecxx . . $ TExpressionManager#FacetMaxInclusive(fb0bf252cd5e7c9e).(value) ); |
| 657 | } |
| 658 | case L_NOTcxx . . $ L_NOT.: |
| 659 | { |
| 660 | TDataExprcxx . . $ DLLispParser#TDataExpr#* expr = getDataExpressioncxx . . $ DLLispParser#getDataExpression(52b0f360576e8085).(); |
| 661 | // skip right bracket |
| 662 | MustBeMcxx . . $ CommonParser#MustBeM(82d9ea22de4def4f). ( RBRACKcxx . . $ RBRACK. ); |
| 663 | return EManagercxx . . $ DLLispParser#EManager.->DataNotcxx . . $ TExpressionManager#DataNot(83abbe967e1a7d33).(expr); |
| 664 | } |
| 665 | case DONEOFcxx . . $ DONEOF.: |
| 666 | case L_ANDcxx . . $ L_AND.: |
| 667 | case L_ORcxx . . $ L_OR.: // multiple And's/Or's |
| 668 | EManagercxx . . $ DLLispParser#EManager.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 669 | do |
| 670 | { |
| 671 | EManagercxx . . $ DLLispParser#EManager.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(getDataExpressioncxx . . $ DLLispParser#getDataExpression(52b0f360576e8085).()); |
| 672 | } while ( Currentcxx . . $ CommonParser#Current. != RBRACKcxx . . $ RBRACK. ); |
| 673 | |
| 674 | // list is parsed here |
| 675 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); // skip ')' |
| 676 | return T == L_ANDcxx . . $ L_AND. ? EManagercxx . . $ DLLispParser#EManager.->DataAndcxx . . $ TExpressionManager#DataAnd(b4330069d252c810).() : T == L_ORcxx . . $ L_OR. ? EManagercxx . . $ DLLispParser#EManager.->DataOrcxx . . $ TExpressionManager#DataOr(b4330069d252c810).() : EManagercxx . . $ DLLispParser#EManager.->DataOneOfcxx . . $ TExpressionManager#DataOneOf(b4330069d252c810).(); |
| 677 | |
| 678 | case STRINGcxx . . $ STRING.: // expression (string <value>) |
| 679 | case NUMBERcxx . . $ NUMBER.: // expression (number <value>) |
| 680 | case REALcxx . . $ REAL.: // expression (real <value>) |
| 681 | case BOOLcxx . . $ BOOL.: |
| 682 | { |
| 683 | TDataTypeExprcxx . . $ DLLispParser#TDataTypeExpr#* type = |
| 684 | (T == STRINGcxx . . $ STRING.) ? EManagercxx . . $ DLLispParser#EManager.->getStrDataTypecxx . . $ TExpressionManager#getStrDataType(af9ac3d67b9a694f).(): |
| 685 | (T == NUMBERcxx . . $ NUMBER.) ? EManagercxx . . $ DLLispParser#EManager.->getIntDataTypecxx . . $ TExpressionManager#getIntDataType(af9ac3d67b9a694f).(): |
| 686 | (T == REALcxx . . $ REAL. ) ? EManagercxx . . $ DLLispParser#EManager.->getRealDataTypecxx . . $ TExpressionManager#getRealDataType(af9ac3d67b9a694f).(): |
| 687 | EManagercxx . . $ DLLispParser#EManager.->getBoolDataTypecxx . . $ TExpressionManager#getBoolDataType(af9ac3d67b9a694f).(); |
| 688 | |
| 689 | if ( Currentcxx . . $ CommonParser#Current. == RBRACKcxx . . $ RBRACK. ) // just datatype |
| 690 | { |
| 691 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); |
| 692 | return type; |
| 693 | } |
| 694 | |
| 695 | NextLexcxx . . $ CommonParser#NextLex(49f6e7a06ebc5aa8).(); |
| 696 | return getDTValuecxx . . $ DLLispParser#getDTValue(91bd0d659265132b).(type); |
| 697 | } |
| 698 | |
| 699 | default: // error |
| 700 | parseErrorcxx . . $ CommonParser#parseError(acfedb98bf840c77). ( "Unknown data constructor" ); |
| 701 | return nullptr; // FSCO |
| 702 | } |
| 703 | } |