clara

http://www.clara-rules.org/
Matthew Pettis 2020-06-29T14:44:13.164900Z

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.

Matthew Pettis 2020-06-29T15:28:05.166100Z

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?

2020-06-29T18:54:57.167300Z

@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

đź‘Ť 1
2020-06-29T18:56:31.167900Z

That should enable you to retrieve all the facts inserted

2020-06-29T18:59:01.168600Z

https://github.com/rbrush/clara-tools might of been what you saw in that YouTube talk

2020-06-29T19:34:44.169800Z

@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.

đź‘Ť 3
2020-06-29T19:35:18.170300Z

That’s your smoothest path forward.

2020-06-29T19:37:00.171400Z

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

2020-06-29T19:37:13.171900Z

I’m just on mobile so can’t pull up much currently

2020-06-29T19:38:21.173600Z

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.

đź‘Ť 1
Matthew Pettis 2020-06-29T19:59:00.174300Z

Thanks @mbragg and @mikerod -- I'll take a look at these things.

2020-06-29T21:23:30.178400Z

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

đź‘Ť 1