Fork me on GitHub

I’m working on an ingestion pipeline for scholarly material. It takes XML files and adds them to a (Datomic) database. There’s a ton of little decisions to be made along the way. Depending on the publisher, the type of material, the presence of related material already in the database, the subject matter, the presence or absence of a myriad of little attributes in the file itself, and so on, the ingestion process behaves differently. This means tons and tons of conditionals all over the place, and it quickly gets hard to get an overview. I’ve been contemplating ways to extract this decision making process into its own place. Would Clara be a suitable tool for this?


@ that sounds like a plausible use-case. Much depends on how much involved the logic is - IMO a rules engine has some upfront cost to bring in especially if the team hasn’t used one before, but at a certain complexity of business logic it helps a lot. Clara does what it can to help by “playing nicely” with the rest of the Clojure ecosystem e.g. by being simple Clojure code rather than an entirely separate framework with its own IDEs etc., but it still is a different way of thinking and is a nontrivial component to introduce to a system. FWIW the analysis in the ThoughtWorks radar linked above seems on-target to me. My guess would be that something like you describe would work best with a rules engine if large chunks of logic can be computed before needing to return to the stateful pipeline, but as always it is hard to say since so often it is the details that are most important.


howdy folks


im interested in partial condition matches


i want to answer the question: what conditions didn't match for a given rule


i'm not sure this is possible at the moment


Could you give a concrete example @devn? I'm not sure what exactly you mean; session inspection has some things that might help.


@wparker I'm looking to answer questions of "what LHS conditions for which rules weren't satisfiable?" My understanding may be incorrect, but I seem to recall the condition matches from session inspection not including information on when a rule's conditions were partially satisfied.


truth: I keep avoiding working out a tracing listener setup that will give me the Real Ultimate Power™ I desire


@alex-dixon I am reminded of a previous conversation that was had here about making something akin to precept-devtools work with clara. However, I am failing to remember details. Which parts of precept-devtools would not be possible without modification to clara?


@devn Pretty much all of it would need redone since it’s so Precept specific…


Clara’s listeners API is what you’re looking for though. You should be able to see every operation the rule engine does


I’ve only ever used the terminal node ones but they have everything…alpha activate, alpha retract…stuff I can’t remember


If you’re interested in CR or rule engines whatsoever it’ll pay off I promise 🙂