Debian Codegraph @

FaCT++.Python/examples/test-data-cardinality.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 top_data = reasoner.data_top()
24
25 cls_a = reasoner.concept('CLS-A')
26 c = reasoner.individual('C')
27 reasoner.instance_of(c, cls_a)
28
29 r = reasoner.data_role('R')
30 reasoner.set_d_domain(r, cls_a)
31 reasoner.set_d_range(r, reasoner.type_int)
32
33 restriction_max_one = reasoner.max_d_cardinality(1, r, top_data)
34 reasoner.implies_concepts(cls_a, restriction_max_one)
35
36 reasoner.value_of_int(c, r, 1)
37 print('consistent after first value:', reasoner.is_consistent())
38
39 reasoner.value_of_int(c, r, 2)
40 print('consistent after 2nd value:', reasoner.is_consistent())
41
42 # vim: sw=4:et:ai