Is there a way to just dump or inspect all of the facts that exist in a session? I am thinking about looking at taking a session (which has to be defined with a static set of rules, if I understand correctly), dumping the facts, and creating a new session with a different set of rules to apply to the facts from the previous session.
Also, I've seen in youtube talks some (at the time, just alpha-level) tools that will diagram out a set of rules or fact-firings on the given state of the working memory. Does anyone have any links to tools like this to play with?
@matthew.pettis You can inspect a session to return a number of different rule/fact data structures http://www.clara-rules.org/apidocs/0.9.0/clojure/clara.tools.inspect.html
That should enable you to retrieve all the facts inserted
https://github.com/rbrush/clara-tools might of been what you saw in that YouTube talk
@matthew.pettis in general I’d say it’s best to make targeted queries that you use to extract the facts you want to use in the next set of rules.
That’s your smoothest path forward.
There are some inspect namespaces and stuff in clara you can look at too. But typically more for inspection at a different sort of level
I’m just on mobile so can’t pull up much currently
Clara-tools maybe relevant. I think the codebase is likely outdated though. But perhaps gives extra insight. Clara has inspection and tracing things built in to an extent too. And then there is a listener api you can hook into if you require more specific things.
Agreed that if you need to pull out facts, targeted queries are probably the way to go. You could write a query that would match all facts e.g. against Object on the JVM, but the performance impact of that could be significant. You might consider whether you actually need multiple sessions though - what is the motivation there as opposed to having the facts you’re extracting trigger those rules in the same session? You could use a design pattern where you have subsets of your system that have “private” facts that by convention are only used in say a particular namespace, and “glue” facts that connect different parts. It is highly domain-dependent but that’s a pattern I’ve used before. @matthew.pettis