| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2011-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 SEMANTICLOCALITYCHECKER_H |
| 21 | #define SEMANTICLOCALITYCHECKER_Hcxx . . $ `Kernel/SemanticLocalityChecker.h:21:9`! |
| 22 | |
| 23 | #include "LocalityChecker.h"cxx . . $ `<file>/Kernel/LocalityChecker.h`/ |
| 24 | #include "Kernel.h"cxx . . $ `<file>/Kernel/Kernel.h`/ |
| 25 | |
| 26 | /// semantic locality checker for DL axioms |
| 27 | class SemanticLocalityCheckercxx . . $ SemanticLocalityChecker#: public LocalityCheckercxx . . $ LocalityChecker# |
| 28 | { |
| 29 | protected: // members |
| 30 | /// Reasoner to detect the tautology |
| 31 | ReasoningKernelcxx . . $ ReasoningKernel# Kernelcxx . . $ SemanticLocalityChecker#Kernel.; |
| 32 | /// Expression manager of a kernel |
| 33 | TExpressionManagercxx . . $ TExpressionManager#* pEMcxx . . $ SemanticLocalityChecker#pEM.; |
| 34 | /// map between axioms and concept expressions |
| 35 | stdcxx . . $ std/::mapcxx . . $ std/map#<const TDLAxiomcxx . . $ TDLAxiom#*, const TDLConceptExpressioncxx . . $ TDLConceptExpression#*> ExprMapcxx . . $ SemanticLocalityChecker#ExprMap.; |
| 36 | |
| 37 | protected: // methods |
| 38 | /// @return expression necessary to build query for a given type of an axiom; @return NULL if none necessary |
| 39 | const TDLConceptExpressioncxx . . $ TDLConceptExpression#* getExprcxx . . $ SemanticLocalityChecker#getExpr(f8a5562bbc12150b). ( const TDLAxiomcxx . . $ TDLAxiom#* axiom ) |
| 40 | { |
| 41 | if ( const TDLAxiomRelatedTocxx . . $ TDLAxiomRelatedTo#* art = dynamic_cast<const TDLAxiomRelatedTocxx . . $ TDLAxiomRelatedTo#*>(axiom) ) |
| 42 | return pEMcxx . . $ SemanticLocalityChecker#pEM.->Valuecxx . . $ TExpressionManager#Value(69f3b6d87cafa765). ( art->getRelationcxx . . $ TDLAxiomRelatedTo#getRelation(b0a963b5b1b1e1ae).(), art->getRelatedIndividualcxx . . $ TDLAxiomRelatedTo#getRelatedIndividual(11d970b45c73cfb9).() ); |
| 43 | if ( const TDLAxiomValueOfcxx . . $ TDLAxiomValueOf#* avo = dynamic_cast<const TDLAxiomValueOfcxx . . $ TDLAxiomValueOf#*>(axiom) ) |
| 44 | return pEMcxx . . $ SemanticLocalityChecker#pEM.->Valuecxx . . $ TExpressionManager#Value(62218c83419ce0c7). ( avo->getAttributecxx . . $ TDLAxiomValueOf#getAttribute(a81f3d9965bf170b).(), avo->getValuecxx . . $ TDLAxiomValueOf#getValue(493934cfcada0bd8).() ); |
| 45 | if ( const TDLAxiomORoleDomaincxx . . $ TDLAxiomORoleDomain#* ord = dynamic_cast<const TDLAxiomORoleDomaincxx . . $ TDLAxiomORoleDomain#*>(axiom) ) |
| 46 | return pEMcxx . . $ SemanticLocalityChecker#pEM.->Existscxx . . $ TExpressionManager#Exists(1977ffbf49b50255). ( ord->getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).(), pEMcxx . . $ SemanticLocalityChecker#pEM.->Topcxx . . $ TExpressionManager#Top(aac0c49b6bdfac38).() ); |
| 47 | if ( const TDLAxiomORoleRangecxx . . $ TDLAxiomORoleRange#* orr = dynamic_cast<const TDLAxiomORoleRangecxx . . $ TDLAxiomORoleRange#*>(axiom) ) |
| 48 | return pEMcxx . . $ SemanticLocalityChecker#pEM.->Existscxx . . $ TExpressionManager#Exists(1977ffbf49b50255). ( orr->getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).(), pEMcxx . . $ SemanticLocalityChecker#pEM.->Notcxx . . $ TExpressionManager#Not(a5147c10d6f77be7).(orr->getRangecxx . . $ TDLAxiomORoleRange#getRange(76ab2b9ad52d3e83).()) ); |
| 49 | if ( const TDLAxiomDRoleDomaincxx . . $ TDLAxiomDRoleDomain#* drd = dynamic_cast<const TDLAxiomDRoleDomaincxx . . $ TDLAxiomDRoleDomain#*>(axiom) ) |
| 50 | return pEMcxx . . $ SemanticLocalityChecker#pEM.->Existscxx . . $ TExpressionManager#Exists(2a4ec6bc45376abb). ( drd->getRolecxx . . $ TDLAxiomSingleDRole#getRole(a81f3d9965bf170b).(), pEMcxx . . $ SemanticLocalityChecker#pEM.->DataTopcxx . . $ TExpressionManager#DataTop(9f9fdff2273d849c).() ); |
| 51 | if ( const TDLAxiomDRoleRangecxx . . $ TDLAxiomDRoleRange#* drr = dynamic_cast<const TDLAxiomDRoleRangecxx . . $ TDLAxiomDRoleRange#*>(axiom) ) |
| 52 | return pEMcxx . . $ SemanticLocalityChecker#pEM.->Existscxx . . $ TExpressionManager#Exists(2a4ec6bc45376abb). ( drr->getRolecxx . . $ TDLAxiomSingleDRole#getRole(a81f3d9965bf170b).(), pEMcxx . . $ SemanticLocalityChecker#pEM.->DataNotcxx . . $ TExpressionManager#DataNot(83abbe967e1a7d33).(drr->getRangecxx . . $ TDLAxiomDRoleRange#getRange(8a5cd50e478c5d2c).()) ); |
| 53 | if ( const TDLAxiomRelatedToNotcxx . . $ TDLAxiomRelatedToNot#* rtn = dynamic_cast<const TDLAxiomRelatedToNotcxx . . $ TDLAxiomRelatedToNot#*>(axiom) ) |
| 54 | return pEMcxx . . $ SemanticLocalityChecker#pEM.->Notcxx . . $ TExpressionManager#Not(a5147c10d6f77be7). ( pEMcxx . . $ SemanticLocalityChecker#pEM.->Valuecxx . . $ TExpressionManager#Value(69f3b6d87cafa765). ( rtn->getRelationcxx . . $ TDLAxiomRelatedToNot#getRelation(b0a963b5b1b1e1ae).(), rtn->getRelatedIndividualcxx . . $ TDLAxiomRelatedToNot#getRelatedIndividual(11d970b45c73cfb9).() ) ); |
| 55 | if ( const TDLAxiomValueOfNotcxx . . $ TDLAxiomValueOfNot#* von = dynamic_cast<const TDLAxiomValueOfNotcxx . . $ TDLAxiomValueOfNot#*>(axiom) ) |
| 56 | return pEMcxx . . $ SemanticLocalityChecker#pEM.->Notcxx . . $ TExpressionManager#Not(a5147c10d6f77be7). ( pEMcxx . . $ SemanticLocalityChecker#pEM.->Valuecxx . . $ TExpressionManager#Value(62218c83419ce0c7). ( von->getAttributecxx . . $ TDLAxiomValueOfNot#getAttribute(a81f3d9965bf170b).(), von->getValuecxx . . $ TDLAxiomValueOfNot#getValue(493934cfcada0bd8).() ) ); |
| 57 | // everything else doesn't require expression to be build |
| 58 | return nullptr; |
| 59 | } |
| 60 | |
| 61 | public: // interface |
| 62 | /// init c'tor |
| 63 | explicit SemanticLocalityCheckercxx . . $ SemanticLocalityChecker#SemanticLocalityChecker(63821116a1afc694). ( const TSignaturecxx . . $ TSignature#* sig ) : LocalityCheckercxx . . $ LocalityChecker#(sig) |
| 64 | { |
| 65 | pEMcxx . . $ SemanticLocalityChecker#pEM. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..getExpressionManagercxx . . $ ReasoningKernel#getExpressionManager(867f96a8caac8aab).(); |
| 66 | // for tests we will need TB names to be from the OWL 2 namespace |
| 67 | pEMcxx . . $ SemanticLocalityChecker#pEM.->setTopBottomRolescxx . . $ TExpressionManager#setTopBottomRoles(292f14abfe735e66).( |
| 68 | "http://www.w3.org/2002/07/owl#topObjectProperty", |
| 69 | "http://www.w3.org/2002/07/owl#bottomObjectProperty", |
| 70 | "http://www.w3.org/2002/07/owl#topDataProperty", |
| 71 | "http://www.w3.org/2002/07/owl#bottomDataProperty"); |
| 72 | } |
| 73 | |
| 74 | /// init kernel with the ontology signature and init expression map |
| 75 | void preprocessOntologycxx . . $ SemanticLocalityChecker#preprocessOntology(b963b3dd7533a896). ( const AxiomVeccxx . . $ AxiomVec#& Axioms ) override |
| 76 | { |
| 77 | TSignaturecxx . . $ TSignature# s; |
| 78 | ExprMapcxx . . $ SemanticLocalityChecker#ExprMap..clearcxx . . $ std/map#clear(49f6e7a06ebc5aa8).(); |
| 79 | for ( TDLAxiomcxx . . $ TDLAxiom#* axiom : Axioms ) |
| 80 | { |
| 81 | ExprMapcxx . . $ SemanticLocalityChecker#ExprMap.[cxx . . $ std/map#`operator[]`(bbd415b616967878).axiom] = getExprcxx . . $ SemanticLocalityChecker#getExpr(f8a5562bbc12150b).(axiom); |
| 82 | s.addcxx . . $ TSignature#add(7393b46d99f9f765).(axiom->getSignaturecxx . . $ TDLAxiom#getSignature(67d28bb768a72444).()); |
| 83 | } |
| 84 | |
| 85 | Kernelcxx . . $ SemanticLocalityChecker#Kernel..clearKBcxx . . $ ReasoningKernel#clearKB(c9857a73d68e59ba).(); |
| 86 | // register all the objects in the ontology signature |
| 87 | for (const TNamedEntitycxx . . $ TNamedEntity#* entity : s) |
| 88 | Kernelcxx . . $ SemanticLocalityChecker#Kernel..declarecxx . . $ ReasoningKernel#declare(6ee6f6ac494558bc).(dynamic_cast<const TDLExpressioncxx . . $ TDLExpression#*>(entity)); |
| 89 | // prepare the reasoner to check tautologies |
| 90 | Kernelcxx . . $ SemanticLocalityChecker#Kernel..realiseKBcxx . . $ ReasoningKernel#realiseKB(49f6e7a06ebc5aa8).(); |
| 91 | // after TBox appears there, set signature to translate |
| 92 | Kernelcxx . . $ SemanticLocalityChecker#Kernel..setSignaturecxx . . $ ReasoningKernel#setSignature(63821116a1afc694).(getSignaturecxx . . $ SigAccessor#getSignature(2fd32eeecbb0ed7e).()); |
| 93 | // disallow usage of the expression cache as same expressions will lead to different translations |
| 94 | Kernelcxx . . $ SemanticLocalityChecker#Kernel..setIgnoreExprCachecxx . . $ ReasoningKernel#setIgnoreExprCache(b45ddcbc8423892c).(true); |
| 95 | } |
| 96 | |
| 97 | public: // visitor interface |
| 98 | void visitcxx . . $ SemanticLocalityChecker#visit(d9d59c22ba059f26). ( const TDLAxiomDeclarationcxx . . $ TDLAxiomDeclaration#& ) override { isLocalcxx . . $ LocalityChecker#isLocal. = true; } |
| 99 | |
| 100 | void visitcxx . . $ SemanticLocalityChecker#visit(9ecff12220e47c40). ( const TDLAxiomEquivalentConceptscxx . . $ TDLAxiomEquivalentConcepts#& axiom ) override |
| 101 | { |
| 102 | isLocalcxx . . $ LocalityChecker#isLocal. = false; |
| 103 | TDLAxiomEquivalentConceptscxx . . $ TDLAxiomEquivalentConcepts#::iteratorcxx . . $ TDLNAryExpression#iterator# p = axiom.begincxx . . $ TDLNAryExpression#begin(9e2439d61c0d1310).(), p_end = axiom.endcxx . . $ TDLNAryExpression#end(9e2439d61c0d1310).(); |
| 104 | const TDLConceptExpressioncxx . . $ TDLConceptExpression#* C = *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p; |
| 105 | while ( ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end ) |
| 106 | if ( !Kernelcxx . . $ SemanticLocalityChecker#Kernel..isEquivalentcxx . . $ ReasoningKernel#isEquivalent(5fdff331daaf87aa). ( C, *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p ) ) |
| 107 | return; |
| 108 | isLocalcxx . . $ LocalityChecker#isLocal. = true; |
| 109 | } |
| 110 | void visitcxx . . $ SemanticLocalityChecker#visit(aa51a7285ba589ba). ( const TDLAxiomDisjointConceptscxx . . $ TDLAxiomDisjointConcepts#& axiom ) override |
| 111 | { |
| 112 | isLocalcxx . . $ LocalityChecker#isLocal. = false; |
| 113 | for ( TDLAxiomDisjointConceptscxx . . $ TDLAxiomDisjointConcepts#::iteratorcxx . . $ TDLNAryExpression#iterator# p = axiom.begincxx . . $ TDLNAryExpression#begin(9e2439d61c0d1310).(), qcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(49f6e7a06ebc5aa8)., p_end = axiom.endcxx . . $ TDLNAryExpression#end(9e2439d61c0d1310).(); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 114 | for ( q =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(c74070c1a856c914). p+cxx . . $ __gnu_cxx/__normal_iterator#operator+(d0cb2d2ebd313f38).1; q !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).q ) |
| 115 | if ( !Kernelcxx . . $ SemanticLocalityChecker#Kernel..isDisjointcxx . . $ ReasoningKernel#isDisjoint(5fdff331daaf87aa). ( *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p, *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q ) ) |
| 116 | return; |
| 117 | isLocalcxx . . $ LocalityChecker#isLocal. = true; |
| 118 | } |
| 119 | void visitcxx . . $ SemanticLocalityChecker#visit(402fe14fc3eb0067). ( const TDLAxiomDisjointUnioncxx . . $ TDLAxiomDisjointUnion#& axiom ) override |
| 120 | { |
| 121 | isLocalcxx . . $ LocalityChecker#isLocal. = false; |
| 122 | // check A = (or C1... Cn) |
| 123 | TDLAxiomDisjointUnioncxx . . $ TDLAxiomDisjointUnion#::iteratorcxx . . $ TDLNAryExpression#iterator# pcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(49f6e7a06ebc5aa8)., qcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(49f6e7a06ebc5aa8)., p_end = axiom.endcxx . . $ TDLNAryExpression#end(9e2439d61c0d1310).(); |
| 124 | pEMcxx . . $ SemanticLocalityChecker#pEM.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 125 | for ( p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(c74070c1a856c914). axiom.begincxx . . $ TDLNAryExpression#begin(9e2439d61c0d1310).(); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 126 | pEMcxx . . $ SemanticLocalityChecker#pEM.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(*cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p); |
| 127 | if ( !Kernelcxx . . $ SemanticLocalityChecker#Kernel..isEquivalentcxx . . $ ReasoningKernel#isEquivalent(5fdff331daaf87aa). ( axiom.getCcxx . . $ TDLAxiomDisjointUnion#getC(76ab2b9ad52d3e83).(), pEMcxx . . $ SemanticLocalityChecker#pEM.->Orcxx . . $ TExpressionManager#Or(bdfb1e6da6a1dacd).() ) ) |
| 128 | return; |
| 129 | // check disjoint(C1... Cn) |
| 130 | for ( p =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(c74070c1a856c914). axiom.begincxx . . $ TDLNAryExpression#begin(9e2439d61c0d1310).(); p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p ) |
| 131 | for ( q =cxx . . $ __gnu_cxx/__normal_iterator#`operator=`(c74070c1a856c914). p+cxx . . $ __gnu_cxx/__normal_iterator#operator+(d0cb2d2ebd313f38).1; q !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end; ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).q ) |
| 132 | if ( !Kernelcxx . . $ SemanticLocalityChecker#Kernel..isDisjointcxx . . $ ReasoningKernel#isDisjoint(5fdff331daaf87aa). ( *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p, *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).q ) ) |
| 133 | return; |
| 134 | isLocalcxx . . $ LocalityChecker#isLocal. = true; |
| 135 | } |
| 136 | void visitcxx . . $ SemanticLocalityChecker#visit(c0fc84e0a2be77f7). ( const TDLAxiomEquivalentORolescxx . . $ TDLAxiomEquivalentORoles#& axiom ) override |
| 137 | { |
| 138 | isLocalcxx . . $ LocalityChecker#isLocal. = false; |
| 139 | TDLAxiomEquivalentORolescxx . . $ TDLAxiomEquivalentORoles#::iteratorcxx . . $ TDLNAryExpression#iterator# p = axiom.begincxx . . $ TDLNAryExpression#begin(9e2439d61c0d1310).(), p_end = axiom.endcxx . . $ TDLNAryExpression#end(9e2439d61c0d1310).(); |
| 140 | const TDLObjectRoleExpressioncxx . . $ TDLObjectRoleExpression#* R = *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p; |
| 141 | while ( ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end ) |
| 142 | if ( !(Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubRolescxx . . $ ReasoningKernel#isSubRoles(68b0dcd62a26d5fb). ( R, *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p ) && Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubRolescxx . . $ ReasoningKernel#isSubRoles(68b0dcd62a26d5fb). ( *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p, R )) ) |
| 143 | return; |
| 144 | isLocalcxx . . $ LocalityChecker#isLocal. = true; |
| 145 | } |
| 146 | // tautology if all the subsumptions Ri [= Rj holds |
| 147 | void visitcxx . . $ SemanticLocalityChecker#visit(c126fb3da66d6497). ( const TDLAxiomEquivalentDRolescxx . . $ TDLAxiomEquivalentDRoles#& axiom ) override |
| 148 | { |
| 149 | isLocalcxx . . $ LocalityChecker#isLocal. = false; |
| 150 | TDLAxiomEquivalentDRolescxx . . $ TDLAxiomEquivalentDRoles#::iteratorcxx . . $ TDLNAryExpression#iterator# p = axiom.begincxx . . $ TDLNAryExpression#begin(9e2439d61c0d1310).(), p_end = axiom.endcxx . . $ TDLNAryExpression#end(9e2439d61c0d1310).(); |
| 151 | const TDLDataRoleExpressioncxx . . $ TDLDataRoleExpression#* R = *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p; |
| 152 | while ( ++cxx . . $ __gnu_cxx/__normal_iterator#operator++(93f2e9c3bc4efc49).p !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). p_end ) |
| 153 | if ( !(Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubRolescxx . . $ ReasoningKernel#isSubRoles(1eccbaba8fe97673). ( R, *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p ) && Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubRolescxx . . $ ReasoningKernel#isSubRoles(1eccbaba8fe97673). ( *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).p, R )) ) |
| 154 | return; |
| 155 | isLocalcxx . . $ LocalityChecker#isLocal. = true; |
| 156 | } |
| 157 | void visitcxx . . $ SemanticLocalityChecker#visit(9b4c04465f82a032). ( const TDLAxiomDisjointORolescxx . . $ TDLAxiomDisjointORoles#& axiom ) override |
| 158 | { |
| 159 | pEMcxx . . $ SemanticLocalityChecker#pEM.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 160 | for (const auto* arg : axiom) |
| 161 | pEMcxx . . $ SemanticLocalityChecker#pEM.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(arg); |
| 162 | isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isDisjointRolescxx . . $ ReasoningKernel#isDisjointRoles(c9857a73d68e59ba).(); |
| 163 | } |
| 164 | void visitcxx . . $ SemanticLocalityChecker#visit(f937f280b5be5d09). ( const TDLAxiomDisjointDRolescxx . . $ TDLAxiomDisjointDRoles#& axiom ) override |
| 165 | { |
| 166 | pEMcxx . . $ SemanticLocalityChecker#pEM.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 167 | for (const auto* arg : axiom) |
| 168 | pEMcxx . . $ SemanticLocalityChecker#pEM.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(arg); |
| 169 | isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isDisjointRolescxx . . $ ReasoningKernel#isDisjointRoles(c9857a73d68e59ba).(); |
| 170 | } |
| 171 | // never local |
| 172 | void visitcxx . . $ SemanticLocalityChecker#visit(d37f1d21cd25a5f3). ( const TDLAxiomSameIndividualscxx . . $ TDLAxiomSameIndividuals#& ) override { isLocalcxx . . $ LocalityChecker#isLocal. = false; } |
| 173 | // never local |
| 174 | void visitcxx . . $ SemanticLocalityChecker#visit(d0a24753794666b). ( const TDLAxiomDifferentIndividualscxx . . $ TDLAxiomDifferentIndividuals#& ) override { isLocalcxx . . $ LocalityChecker#isLocal. = false; } |
| 175 | /// there is no such axiom in OWL API, but I hope nobody would use Fairness here |
| 176 | void visitcxx . . $ SemanticLocalityChecker#visit(8ec85f1c9f859b33). ( const TDLAxiomFairnessConstraintcxx . . $ TDLAxiomFairnessConstraint#& ) override { isLocalcxx . . $ LocalityChecker#isLocal. = true; } |
| 177 | |
| 178 | // R = inverse(S) is tautology iff R [= S- and S [= R- |
| 179 | void visitcxx . . $ SemanticLocalityChecker#visit(dbfe2e7150e0dc38). ( const TDLAxiomRoleInversecxx . . $ TDLAxiomRoleInverse#& axiom ) override |
| 180 | { |
| 181 | isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubRolescxx . . $ ReasoningKernel#isSubRoles(68b0dcd62a26d5fb). ( axiom.getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).(), pEMcxx . . $ SemanticLocalityChecker#pEM.->Inversecxx . . $ TExpressionManager#Inverse(c6736427cdccb407).(axiom.getInvRolecxx . . $ TDLAxiomRoleInverse#getInvRole(b0a963b5b1b1e1ae).()) ) && |
| 182 | Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubRolescxx . . $ ReasoningKernel#isSubRoles(68b0dcd62a26d5fb). ( axiom.getInvRolecxx . . $ TDLAxiomRoleInverse#getInvRole(b0a963b5b1b1e1ae).(), pEMcxx . . $ SemanticLocalityChecker#pEM.->Inversecxx . . $ TExpressionManager#Inverse(c6736427cdccb407).(axiom.getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).()) ); |
| 183 | } |
| 184 | void visitcxx . . $ SemanticLocalityChecker#visit(71a707b53d3a8b2f). ( const TDLAxiomORoleSubsumptioncxx . . $ TDLAxiomORoleSubsumption#& axiom ) override |
| 185 | { |
| 186 | // check whether the LHS is a role chain |
| 187 | if ( const TDLObjectRoleChaincxx . . $ TDLObjectRoleChain#* Chain = dynamic_cast<const TDLObjectRoleChaincxx . . $ TDLObjectRoleChain#*>(axiom.getSubRolecxx . . $ TDLAxiomORoleSubsumption#getSubRole(15ec025ea2d791ae).()) ) |
| 188 | { |
| 189 | pEMcxx . . $ SemanticLocalityChecker#pEM.->newArgListcxx . . $ TExpressionManager#newArgList(49f6e7a06ebc5aa8).(); |
| 190 | for (const auto* arg : *Chain) |
| 191 | pEMcxx . . $ SemanticLocalityChecker#pEM.->addArgcxx . . $ TExpressionManager#addArg(ca1ea7df707d7472).(arg); |
| 192 | isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubChaincxx . . $ ReasoningKernel#isSubChain(8fc77c3492e4f36b).(axiom.getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).()); |
| 193 | } |
| 194 | // check whether the LHS is a plain role or inverse |
| 195 | else if ( const TDLObjectRoleExpressioncxx . . $ TDLObjectRoleExpression#* Sub = dynamic_cast<const TDLObjectRoleExpressioncxx . . $ TDLObjectRoleExpression#*>(axiom.getSubRolecxx . . $ TDLAxiomORoleSubsumption#getSubRole(15ec025ea2d791ae).()) ) |
| 196 | isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubRolescxx . . $ ReasoningKernel#isSubRoles(68b0dcd62a26d5fb). ( Sub, axiom.getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).() ); |
| 197 | else // here we have a projection expression. FIXME!! for now |
| 198 | isLocalcxx . . $ LocalityChecker#isLocal. = true; |
| 199 | } |
| 200 | void visitcxx . . $ SemanticLocalityChecker#visit(20fca8e39bd7f9de). ( const TDLAxiomDRoleSubsumptioncxx . . $ TDLAxiomDRoleSubsumption#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubRolescxx . . $ ReasoningKernel#isSubRoles(1eccbaba8fe97673). ( axiom.getSubRolecxx . . $ TDLAxiomDRoleSubsumption#getSubRole(a81f3d9965bf170b).(), axiom.getRolecxx . . $ TDLAxiomSingleDRole#getRole(a81f3d9965bf170b).() ); } |
| 201 | // Domain(R) = C is tautology iff ER.Top [= C |
| 202 | void visitcxx . . $ SemanticLocalityChecker#visit(b19917e065e373b0). ( const TDLAxiomORoleDomaincxx . . $ TDLAxiomORoleDomain#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubsumedBycxx . . $ ReasoningKernel#isSubsumedBy(5fdff331daaf87aa). ( ExprMapcxx . . $ SemanticLocalityChecker#ExprMap.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).&axiom], axiom.getDomaincxx . . $ TDLAxiomORoleDomain#getDomain(76ab2b9ad52d3e83).() ); } |
| 203 | void visitcxx . . $ SemanticLocalityChecker#visit(6a89384f45b02cb7). ( const TDLAxiomDRoleDomaincxx . . $ TDLAxiomDRoleDomain#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubsumedBycxx . . $ ReasoningKernel#isSubsumedBy(5fdff331daaf87aa). ( ExprMapcxx . . $ SemanticLocalityChecker#ExprMap.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).&axiom], axiom.getDomaincxx . . $ TDLAxiomDRoleDomain#getDomain(76ab2b9ad52d3e83).() ); } |
| 204 | // Range(R) = C is tautology iff ER.~C is unsatisfiable |
| 205 | void visitcxx . . $ SemanticLocalityChecker#visit(eef9ff8aad06e081). ( const TDLAxiomORoleRangecxx . . $ TDLAxiomORoleRange#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = !Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSatisfiablecxx . . $ ReasoningKernel#isSatisfiable(96881bbb97bd7038).(ExprMapcxx . . $ SemanticLocalityChecker#ExprMap.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).&axiom]); } |
| 206 | void visitcxx . . $ SemanticLocalityChecker#visit(da8dca8cacae49f9). ( const TDLAxiomDRoleRangecxx . . $ TDLAxiomDRoleRange#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = !Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSatisfiablecxx . . $ ReasoningKernel#isSatisfiable(96881bbb97bd7038).(ExprMapcxx . . $ SemanticLocalityChecker#ExprMap.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).&axiom]); } |
| 207 | void visitcxx . . $ SemanticLocalityChecker#visit(e8585e86130514df). ( const TDLAxiomRoleTransitivecxx . . $ TDLAxiomRoleTransitive#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isTransitivecxx . . $ ReasoningKernel#isTransitive(8fc77c3492e4f36b).(axiom.getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).()); } |
| 208 | void visitcxx . . $ SemanticLocalityChecker#visit(1555e5dd37550403). ( const TDLAxiomRoleReflexivecxx . . $ TDLAxiomRoleReflexive#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isReflexivecxx . . $ ReasoningKernel#isReflexive(8fc77c3492e4f36b).(axiom.getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).()); } |
| 209 | void visitcxx . . $ SemanticLocalityChecker#visit(eabfd54a3bd95b2). ( const TDLAxiomRoleIrreflexivecxx . . $ TDLAxiomRoleIrreflexive#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isIrreflexivecxx . . $ ReasoningKernel#isIrreflexive(8fc77c3492e4f36b).(axiom.getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).()); } |
| 210 | void visitcxx . . $ SemanticLocalityChecker#visit(371dc479b720f66a). ( const TDLAxiomRoleSymmetriccxx . . $ TDLAxiomRoleSymmetric#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSymmetriccxx . . $ ReasoningKernel#isSymmetric(8fc77c3492e4f36b).(axiom.getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).()); } |
| 211 | void visitcxx . . $ SemanticLocalityChecker#visit(2eab0e2ee768d6ea). ( const TDLAxiomRoleAsymmetriccxx . . $ TDLAxiomRoleAsymmetric#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isAsymmetriccxx . . $ ReasoningKernel#isAsymmetric(8fc77c3492e4f36b).(axiom.getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).()); } |
| 212 | void visitcxx . . $ SemanticLocalityChecker#visit(1cb3074f4e7d0a89). ( const TDLAxiomORoleFunctionalcxx . . $ TDLAxiomORoleFunctional#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isFunctionalcxx . . $ ReasoningKernel#isFunctional(8fc77c3492e4f36b).(axiom.getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).()); } |
| 213 | void visitcxx . . $ SemanticLocalityChecker#visit(4ed58748b443d4d). ( const TDLAxiomDRoleFunctionalcxx . . $ TDLAxiomDRoleFunctional#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isFunctionalcxx . . $ ReasoningKernel#isFunctional(f368119995a8beee).(axiom.getRolecxx . . $ TDLAxiomSingleDRole#getRole(a81f3d9965bf170b).()); } |
| 214 | void visitcxx . . $ SemanticLocalityChecker#visit(92d9880035cab613). ( const TDLAxiomRoleInverseFunctionalcxx . . $ TDLAxiomRoleInverseFunctional#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isInverseFunctionalcxx . . $ ReasoningKernel#isInverseFunctional(8fc77c3492e4f36b).(axiom.getRolecxx . . $ TDLAxiomSingleORole#getRole(b0a963b5b1b1e1ae).()); } |
| 215 | |
| 216 | void visitcxx . . $ SemanticLocalityChecker#visit(4415e73e741b43da). ( const TDLAxiomConceptInclusioncxx . . $ TDLAxiomConceptInclusion#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isSubsumedBycxx . . $ ReasoningKernel#isSubsumedBy(5fdff331daaf87aa). ( axiom.getSubCcxx . . $ TDLAxiomConceptInclusion#getSubC(76ab2b9ad52d3e83).(), axiom.getSupCcxx . . $ TDLAxiomConceptInclusion#getSupC(76ab2b9ad52d3e83).() ); } |
| 217 | // for top locality, this might be local |
| 218 | void visitcxx . . $ SemanticLocalityChecker#visit(ac53f03206c5ffd8). ( const TDLAxiomInstanceOfcxx . . $ TDLAxiomInstanceOf#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isInstancecxx . . $ ReasoningKernel#isInstance(c3232ab85b187851). ( axiom.getIndividualcxx . . $ TDLAxiomIndividual#getIndividual(11d970b45c73cfb9).(), axiom.getCcxx . . $ TDLAxiomInstanceOf#getC(76ab2b9ad52d3e83).() ); } |
| 219 | // R(i,j) holds if {i} [= \ER.{j} |
| 220 | void visitcxx . . $ SemanticLocalityChecker#visit(adefee3ba499aec2). ( const TDLAxiomRelatedTocxx . . $ TDLAxiomRelatedTo#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isInstancecxx . . $ ReasoningKernel#isInstance(c3232ab85b187851). ( axiom.getIndividualcxx . . $ TDLAxiomIndividual#getIndividual(11d970b45c73cfb9).(), ExprMapcxx . . $ SemanticLocalityChecker#ExprMap.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).&axiom] ); } |
| 221 | ///!R(i,j) holds if {i} [= \AR.!{j}=!\ER.{j} |
| 222 | void visitcxx . . $ SemanticLocalityChecker#visit(8c7dc9507962ec65). ( const TDLAxiomRelatedToNotcxx . . $ TDLAxiomRelatedToNot#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isInstancecxx . . $ ReasoningKernel#isInstance(c3232ab85b187851). ( axiom.getIndividualcxx . . $ TDLAxiomIndividual#getIndividual(11d970b45c73cfb9).(), ExprMapcxx . . $ SemanticLocalityChecker#ExprMap.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).&axiom] ); } |
| 223 | // R(i,v) holds if {i} [= \ER.{v} |
| 224 | void visitcxx . . $ SemanticLocalityChecker#visit(ff1a1ebde6ad8bad). ( const TDLAxiomValueOfcxx . . $ TDLAxiomValueOf#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isInstancecxx . . $ ReasoningKernel#isInstance(c3232ab85b187851). ( axiom.getIndividualcxx . . $ TDLAxiomIndividual#getIndividual(11d970b45c73cfb9).(), ExprMapcxx . . $ SemanticLocalityChecker#ExprMap.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).&axiom] ); } |
| 225 | // !R(i,v) holds if {i} [= !\ER.{v} |
| 226 | void visitcxx . . $ SemanticLocalityChecker#visit(df12686069e02fa4). ( const TDLAxiomValueOfNotcxx . . $ TDLAxiomValueOfNot#& axiom ) override { isLocalcxx . . $ LocalityChecker#isLocal. = Kernelcxx . . $ SemanticLocalityChecker#Kernel..isInstancecxx . . $ ReasoningKernel#isInstance(c3232ab85b187851). ( axiom.getIndividualcxx . . $ TDLAxiomIndividual#getIndividual(11d970b45c73cfb9).(), ExprMapcxx . . $ SemanticLocalityChecker#ExprMap.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).&axiom] ); } |
| 227 | }; // SemanticLocalityChecker |
| 228 | |
| 229 | #endif |