Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obtaining incremental inferences #17

Open
daniel86 opened this issue Feb 4, 2024 · 2 comments
Open

Obtaining incremental inferences #17

daniel86 opened this issue Feb 4, 2024 · 2 comments

Comments

@daniel86
Copy link

daniel86 commented Feb 4, 2024

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

@irygaev
Copy link
Member

irygaev commented Feb 5, 2024

Hi Daniel!

Thank you for your question.

Unfortunately, incremental reasoning is not supported (yet). The second call to realise() won't produce any new inferences as FaCT++ remembers that the KB is already realized and doesn't do anything in this case.

However, you can query asserted or inferred triples separately if you specify scope parameter in the call to Coras.query method. The scope can be asserted, inferred or both (default).

Ivan.

@daniel86
Copy link
Author

daniel86 commented Feb 5, 2024

Hi Ivan,

oh really? I was not assuming a second call would do nothing when additional facts were added until the last call.
I was thinking it might be possible due to the par in the README about persistent and incremental reasoning. Is this functionality of the C++ implementation which is not yet exposed to Python?

oh yes, I found this line:

if ( !isKBRealised() )

So your response suggests you are planning to support incremental mode at some time?

FYI: I am considering a use case where a robot manages a knowledge base over time, during the course of its action it grounds new knowledge in its action and perception which I would like to incrementally add/remove to/from reasoning systems in the knowledge base.

Best,
Daniel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants