Assert universal fact in FC rules?

178 views
Skip to first unread message

Matteo Dell'Amico

unread,
Sep 19, 2012, 10:04:32 AM9/19/12
to py...@googlegroups.com
Hello,

thanks for Pyke, it's really a nice piece of work! :)

I am considering using forward chaining to perform "pre-computation" of facts that you can infer from a .kfb file. Say, for the standard family relations example, I'd like to precompute an "is_ancestor" fact for all such relations, on the basis that I'm going to need it often and it would be a waste to recompute it with backward chaining any time it is needed. The problem is, when I reset the knowledge engine, as far as I understand facts generated through forward chaining are all erased because they are specific facts and not universal fact.

So, I'd need a way to either a) save specific facts in a new fact base or b) directly assert universal facts from forward chaining.

Would that be possible in Pyke?

thanks! :)
matteo

Bruce Frederiksen

unread,
Sep 23, 2012, 12:24:25 PM9/23/12
to py...@googlegroups.com
You can include python statements in the assert clause of forward-chaining rules.  These can refer to the current knowledge_engine as "engine" to add universal facts, so:

assert
    python engine.add_universal_fact(...)


matteo

--
You received this message because you are subscribed to the Google Groups "PyKE" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pyke/-/Dnr1npq5CQ8J.
To post to this group, send email to py...@googlegroups.com.
To unsubscribe from this group, send email to pyke+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyke?hl=en.

Matteo Dell'Amico

unread,
Sep 23, 2012, 12:37:45 PM9/23/12
to py...@googlegroups.com
2012/9/23 Bruce Frederiksen <dang...@gmail.com>:
> You can include python statements in the assert clause of forward-chaining
> rules. These can refer to the current knowledge_engine as "engine" to add
> universal facts, so:
>
> assert
> python engine.add_universal_fact(...)

Thanks!

matteo
Reply all
Reply to author
Forward
0 new messages