Debian Codegraph @

FaCT++.Python/examples/test-property-large.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 import time
22
23 reasoner = pyfactxx.Reasoner()
24
25 start = time.time()
26 individuals = [
27 reasoner.individual('i-{}'.format(i))
28 for i in range(10 ** 4)
29 ]
30 role = reasoner.object_role('R')
31
32 reasoner.set_symmetric(role)
33 reasoner.set_transitive(role)
34
35 items = [iter(individuals)] * 4
36 for i1, i2, i3, i4 in zip(*items):
37 reasoner.related_to(i1, role, i2)
38 reasoner.related_to(i2, role, i3)
39 reasoner.related_to(i3, role, i4)
40
41 print('setup done within {:.4f}s'.format(time.time() - start))
42
43 reasoner.realise()
44 print('realised after {:.4f}s'.format(time.time() - start))
45
46 values = reasoner.get_role_fillers(individuals[-1], role)
47 for v in values:
48 print(v.name)
49
50 print('total exec time {:.4f}s'.format(time.time() - start))
51
52 # vim: sw=4:et:ai