Comments (5)
Hi @nilp0inter,
I am using pyknow library to build some logic based on logic and facts. I have faced the same behavior as you explain in this issue. In fact, I had the same error as it seems in one point (not exactly when) the activations in the agenda have a factid that has being retracted (so it does not exists any more).
I have created on a fork the behavior that I would need, but I suppose the problem should be solved by ensuring the activation facts has the proper factid that stays in the facts list of the engine, no?
Thanks!
from pyknow.
This is maybe a regression after the last optimizations made this year. A couple of regression tests and a git bisect could help here.
from pyknow.
+1 any updates on this?
from pyknow.
for my case this decorator solves my problem:
def safe_access_fact(attr, fact_type):
def func_receiver(func):
def inner(*args, **kwargs):
database = args[0]
for fact in database.facts.items():
if isinstance(fact[1], fact_type):
return func(*args,
**kwargs,
**{attr: fact[1]})
return func(*args, **kwargs)
return inner
return func_receiver
And the use:
@Rule(
EXISTS(SystemPreCheck()),
Common(current_state=QuestionsBlock.SYSTEM_PRE_CHECK),
~SystemPreCheck(have_error_within_time_limit=W()))
@safe_access_fact('system', SystemPreCheck)
def have_error_within_time_limit(self, system):
read = auto_read([True, False])
print(f'Existe defeito atribuído dentro do prazo?: {"y" if read else "n"}')
self.modify(system, have_error_within_time_limit=read)
if I use the AS.* <<
operator, I receive a retracted fact, causing the error
from pyknow.
Already fixed in Experta
from pyknow.
Related Issues (20)
- Matching list content using `CONTAINS` HOT 2
- Modules in Pyknow HOT 2
- Load rule set dynamically in KnowledgeEngine HOT 9
- Document Engine-Matcher interaction and dynamic rule creation strategies HOT 11
- teminal HOT 1
- Explanation Module HOT 1
- Got a AttributeError: 'Rule' object has no attribute '__name__' HOT 2
- what can i do if i want the return value of the P function ? HOT 1
- Is it needed for creating a shared OrdinaryMatchNode? HOT 1
- watch() raises KeyError HOT 2
- Return of value HOT 2
- Current time
- Declare new fact in RHS function? HOT 1
- Long execution time
- Little issue with PyPi HOT 5
- what is role of MATCH and AS HOT 1
- Thank you so much! HOT 1
- Exporting and importing the rules to and from PyKnow HOT 1
- Suggest to loosen the dependency on schema HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyknow.