Debian Codegraph @

FaCT++.Python/examples/test-disjoint-classes.py

raw symbols SCIP
1 #
2 # pyfactxx - Python interface to FaCT++ reasoner
3 #
4 # Copyright (C) 2016-2018 by Artur Wroblewski <[email protected]>
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 import pyfactxx
21
22 reasoner = pyfactxx.Reasoner()
23
24 classes = [
25 reasoner.concept('A'),
26 reasoner.concept('B'),
27 reasoner.concept('C'),
28 ]
29
30 reasoner.disjoint_concepts(*classes)
31
32 a = reasoner.individual('a')
33 b = reasoner.individual('b')
34 c = reasoner.individual('c')
35 reasoner.instance_of(a, classes[0])
36
37 print('a is A, consistency:', reasoner.is_consistent())
38
39 # inconsistent, b is both instance of class B and C, but B and C are
40 # disjoint
41 reasoner.instance_of(b, classes[1])
42 reasoner.instance_of(b, classes[2])
43 print('b is B and b is C, consistency:', reasoner.is_consistent())
44
45 # vim: sw=4:et:ai