Debian Codegraph @

Kernel/tOntologyAtom.h

raw symbols SCIP
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 TONTOLOGYATOM_H
21 #define TONTOLOGYATOM_Hcxx . . $ `Kernel/tOntologyAtom.h:21:9`!
22
23 #include <set>
24
25 #include "globaldef.h"cxx . . $ `<file>/Kernel/globaldef.h`/
26 #include "tDLAxiom.h"cxx . . $ `<file>/Kernel/tDLAxiom.h`/
27
28 /// representation of the ontology atom
29 class TOntologyAtomcxx . . $ TOntologyAtom#
30 {
31 protected: // internal types
32 /// type to compare 2 atoms
33 struct AtomLesscxx . . $ TOntologyAtom#AtomLess#
34 {
35 bool operatorcxx . . $ TOntologyAtom#AtomLess#`operator()`(b9af087dcf2e68d3).()(const TOntologyAtomcxx . . $ TOntologyAtom#* a1, const TOntologyAtomcxx . . $ TOntologyAtom#* a2) const
36 { return a1->getIdcxx . . $ TOntologyAtom#getId(fe4d2d262d4164a8).() < a2->getIdcxx . . $ TOntologyAtom#getId(fe4d2d262d4164a8).(); }
37 };
38
39 public: // typedefs
40 /// set of axioms
41 typedef AxiomVeccxx . . $ AxiomVec# AxiomSetcxx . . $ TOntologyAtom#AxiomSet#;
42 /// set of atoms
43 typedef stdcxx . . $ std/::setcxx . . $ std/set#<TOntologyAtomcxx . . $ TOntologyAtom#*, AtomLesscxx . . $ TOntologyAtom#AtomLess#> AtomSetcxx . . $ TOntologyAtom#AtomSet#;
44
45 protected: // members
46 /// set of axioms in the atom
47 AxiomSetcxx . . $ TOntologyAtom#AxiomSet# AtomAxiomscxx . . $ TOntologyAtom#AtomAxioms.;
48 /// set of axioms in the module (Atom's ideal)
49 AxiomSetcxx . . $ TOntologyAtom#AxiomSet# ModuleAxiomscxx . . $ TOntologyAtom#ModuleAxioms.;
50 /// set of atoms current one depends on
51 AtomSetcxx . . $ TOntologyAtom#AtomSet# DepAtomscxx . . $ TOntologyAtom#DepAtoms.;
52 /// set of all atoms current one depends on
53 AtomSetcxx . . $ TOntologyAtom#AtomSet# AllDepAtomscxx . . $ TOntologyAtom#AllDepAtoms.;
54 /// unique atom's identifier
55 size_tcxx . . $ size_t# Idcxx . . $ TOntologyAtom#Id. = 0;
56
57 protected: // methods
58 /// remove all atoms in AllDepAtoms from DepAtoms
59 void filterDepcxx . . $ TOntologyAtom#filterDep(49f6e7a06ebc5aa8). ( void )
60 {
61 for ( TOntologyAtomcxx . . $ TOntologyAtom#* atom : AllDepAtomscxx . . $ TOntologyAtom#AllDepAtoms. )
62 DepAtomscxx . . $ TOntologyAtom#DepAtoms..erasecxx . . $ std/set#erase(3a53bfe100edb289).(atom);
63 }
64 /// build all dep atoms; filter them from DepAtoms
65 void buildAllDepAtomscxx . . $ TOntologyAtom#buildAllDepAtoms(733b14a0f74c0b2). ( AtomSetcxx . . $ TOntologyAtom#AtomSet#& checked )
66 {
67 // first gather all dep atoms from all known dep atoms
68 for ( TOntologyAtomcxx . . $ TOntologyAtom#* atom : DepAtomscxx . . $ TOntologyAtom#DepAtoms. )
69 {
70 const AtomSetcxx . . $ TOntologyAtom#AtomSet#& Dep = atom->getAllDepAtomscxx . . $ TOntologyAtom#getAllDepAtoms(93250490d327d7e4).(checked);
71 AllDepAtomscxx . . $ TOntologyAtom#AllDepAtoms..insertcxx . . $ std/set#insert(50ef72ff69bc573d). ( Dep.begincxx . . $ std/set#begin(a1617ab40ea76896).(), Dep.endcxx . . $ std/set#end(a1617ab40ea76896).() );
72 }
73 // now filter them out from known dep atoms
74 filterDepcxx . . $ TOntologyAtom#filterDep(49f6e7a06ebc5aa8).();
75 // add direct deps to all deps
76 AllDepAtomscxx . . $ TOntologyAtom#AllDepAtoms..insertcxx . . $ std/set#insert(50ef72ff69bc573d). ( DepAtomscxx . . $ TOntologyAtom#DepAtoms..begincxx . . $ std/set#begin(a1617ab40ea76896).(), DepAtomscxx . . $ TOntologyAtom#DepAtoms..endcxx . . $ std/set#end(a1617ab40ea76896).() );
77 // now the atom is checked
78 checked.insertcxx . . $ std/set#insert(10916b2dbd511ba8).(this);
79 }
80
81 public: // interface
82 /// set the module axioms
83 void setModulecxx . . $ TOntologyAtom#setModule(b963b3dd7533a896). ( const AxiomSetcxx . . $ TOntologyAtom#AxiomSet#& module ) { ModuleAxiomscxx . . $ TOntologyAtom#ModuleAxioms. =cxx . . $ std/vector#`operator=`(e6b68e61becad66f). module; }
84 /// add axiom AX to an atom
85 void addAxiomcxx . . $ TOntologyAtom#addAxiom(ade74f2f8b540a23). ( TDLAxiomcxx . . $ TDLAxiom#* ax )
86 {
87 AtomAxiomscxx . . $ TOntologyAtom#AtomAxioms..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(ax);
88 ax->setAtomcxx . . $ TDLAxiom#setAtom(a6a3ca6e1aeed0ea).(this);
89 }
90 /// add atom to the dependency set
91 void addDepAtomcxx . . $ TOntologyAtom#addDepAtom(1edcf2cc03520493). ( TOntologyAtomcxx . . $ TOntologyAtom#* atom )
92 {
93 if ( likelycxx . . $ `Kernel/globaldef.h:28:10`!(atom != nullptr) && atom != this )
94 DepAtomscxx . . $ TOntologyAtom#DepAtoms..insertcxx . . $ std/set#insert(411a10a755068dfe).(atom);
95 }
96 /// get all the atoms the current one depends on; build this set if necessary
97 const AtomSetcxx . . $ TOntologyAtom#AtomSet#& getAllDepAtomscxx . . $ TOntologyAtom#getAllDepAtoms(93250490d327d7e4). ( AtomSetcxx . . $ TOntologyAtom#AtomSet#& checked )
98 {
99 if ( checked.countcxx . . $ std/set#count(a9c5b6ffd713dfa6).(this) == 0 ) // not build yet
100 buildAllDepAtomscxx . . $ TOntologyAtom#buildAllDepAtoms(733b14a0f74c0b2).(checked);
101 return AllDepAtomscxx . . $ TOntologyAtom#AllDepAtoms.;
102 }
103
104 // access to axioms
105
106 /// get all the atom's axioms
107 const AxiomSetcxx . . $ TOntologyAtom#AxiomSet#& getAtomAxiomscxx . . $ TOntologyAtom#getAtomAxioms(73e4577bb59fbb07). ( void ) const { return AtomAxiomscxx . . $ TOntologyAtom#AtomAxioms.; }
108 /// get all the module axioms
109 const AxiomSetcxx . . $ TOntologyAtom#AxiomSet#& getModulecxx . . $ TOntologyAtom#getModule(73e4577bb59fbb07). ( void ) const { return ModuleAxiomscxx . . $ TOntologyAtom#ModuleAxioms.; }
110 /// get atoms a given one depends on
111 const AtomSetcxx . . $ TOntologyAtom#AtomSet#& getDepAtomscxx . . $ TOntologyAtom#getDepAtoms(87724da9ee6d316b). ( void ) const { return DepAtomscxx . . $ TOntologyAtom#DepAtoms.; }
112
113 /// get the value of the id
114 size_tcxx . . $ size_t# getIdcxx . . $ TOntologyAtom#getId(fe4d2d262d4164a8).() const { return Idcxx . . $ TOntologyAtom#Id.; }
115 /// set the value of the id to ID
116 void setIdcxx . . $ TOntologyAtom#setId(2c44cd906ae4e829). ( size_tcxx . . $ size_t# id ) { Idcxx . . $ TOntologyAtom#Id. = id; }
117 }; // TOntologyAtom
118
119 #endif