tilde-lab / pyfactxx Goto Github PK
View Code? Open in Web Editor NEWPython bindings for upgraded FaCT++ description logic reasoner
Home Page: https://bitbucket.org/dtsarkov/factplusplus
Python bindings for upgraded FaCT++ description logic reasoner
Home Page: https://bitbucket.org/dtsarkov/factplusplus
Hello again,
I would like to use pyfactxx
in an incremental fashion where initially I load some files, and during runtime mainly object and data roles are asserted and retracted.
I am now wondering about whether there is a smart way to obtain a list of all new inferences after calling classify/realize, and also which previous inferences were removed.
This information could be obtained be keeping the list of previous inferences in my code, but that seems not optimal.
Is there some way I am not aware of? Maybe to hook an event handler into the reasoner that gets a call for every change?
Best,
Daniel
This is a bit non-trivial, since cmake is required, so packaging can be done e.g. as per https://github.com/dev-cafe/cmake-cookbook/blob/v1.0/chapter-11/recipe-02/README.md
Steps to reproduce:
cd FaCT++.Python
pip install -e .
pytest pyfactxx
Results in:
======================================================= test session starts =======================================================platform linux -- Python 3.8.0, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/andrey/SEMANTIC/pyfactxx/FaCT++.Python, configfile: setup.cfg
plugins: cov-3.0.0
collected 44 items
pyfactxx/tests/test_concept.py .... [ 9%]
pyfactxx/tests/test_d_role.py ..... [ 20%]
pyfactxx/tests/test_instance.py . [ 22%]
pyfactxx/tests/test_o_role.py .......FF... [ 50%]
pyfactxx/tests/test_one_to_one.py ........ [ 68%]
pyfactxx/tests/test_query_instances.py ..... [ 79%]
pyfactxx/tests/test_set_op.py .. [ 84%]
pyfactxx/tests/coras/test_coras.py FF.FFFF [100%]
============================================================ FAILURES =============================================================
What's wrong?
FaCT++.Kernel: Reasoner for the SROIQ(D) Description Logic, 64-bit
Copyright (C) Dmitry Tsarkov, Ivan Rygaev, 2002-2022. Version 1.8.1-SNAPSHOT (21 June 2022)
Traceback (most recent call last):
File "./bin/factpp-load", line 24, in
import pyfactxx.rdflib_interface
ModuleNotFoundError: No module named 'pyfactxx.rdflib_interface'
This is strange, since we basically do not use Java...
root@corvus:/home/eb/pyfactxx# cmake .
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindJNI.cmake:372 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
FaCT++.JNI/CMakeLists.txt:4 (find_package)
-- Configuring incomplete, errors occurred!
Hello,
Loading an ontology fails with published pip artifact:
>>> crs.load(owfile)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/daniel/.local/lib/python3.10/site-packages/pyfactxx/coras/core.py", line 50, in load
self._graph.load(f, format=format)
AttributeError: 'ConjunctiveGraph' object has no attribute 'load'
In fact, core.py
in the source tree rather uses parse method, changing it in the file fixes the loading error.
$ make
...
CMake Error: Error: generator : Unix Makefiles
Does not match the generator used previously: Ninja
Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
...
Please see CMake's output for more information.
make[2]: *** [CMakeFiles/pyfactxx-build.dir/build.make:64: build/timestamp] Error 1
make[2]: Leaving directory '/home/eb/pyfactxx/FaCT++.Python'
make[1]: *** [CMakeFiles/Makefile2:79: CMakeFiles/pyfactxx-build.dir/all] Error 2
make[1]: Leaving directory '/home/eb/pyfactxx/FaCT++.Python'
make: *** [Makefile:133: all] Error 2
PVS-Studio: V524
TaxonomyCreator.h 82
It is odd that the body of 'p_begin' function is fully equivalent to the body of 's_end' function:
ss_iterator s_begin ( void ) override { return beg; }
ss_iterator s_end ( void ) override { return end; }
ss_iterator p_begin ( void ) override { return end; } // <=
ss_iterator p_end ( void ) override { return end; }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.