Debian Codegraph @

FaCT++.Python/examples/imply-class.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 top_data = reasoner.data_top()
25
26 cls = reasoner.concept('A')
27
28 role = reasoner.data_role('R')
29 reasoner.set_d_domain(role, cls)
30 reasoner.set_d_range(role, reasoner.type_float)
31
32 rt = reasoner.d_cardinality(1, role, top_data)
33 reasoner.implies_concepts(cls, rt)
34
35 # a is instance of A due to use of R
36 a = reasoner.individual('a')
37 reasoner.value_of_float(a, role, 1)
38
39 print('a added, consistent:', reasoner.is_consistent())
40 print('a instance of A:', reasoner.is_instance(a, cls))
41
42 # vim: sw=4:et:ai
43