!7 sclass Entry { //S originalRule, replacements, modifiedRule; S rule; S judgement = ""; S ruleID; S struct; sS _fieldOrder = "rule judgement ruleID"; } module TestRuleEngine2 > DynObjectTable { S input; start { set fieldsInOrder; hideFields = litset('struct); } visualize { ret northAndCenterWithMargins( dm_textFieldAndSubmit_q('input, 'calc), super.visualize()); } void calc { S input = this.input; new RuleEngine2 engine; engine.addRules2(dm_allRulesFromRulesModuleWithCommentsAndIDs()); L l = ai_ruleEngine2_rulesForInput_3(engine, input); l = sortByMethodDesc qualitySum(l); setList(map(l, func(RuleEngine2_MatchedRule r) -> Entry { S modifiedRule = r.applyMapping().asText(); ret nu(Entry, rule := modifiedRule, ruleID := r.rule.globalID, struct := struct(r)); })); } void saveEntry(Entry e) { dm_requireAndCall("#1021413/AppliedRules", 'uniqConcept, litobjarray( modifiedRule := e.rule, judgement := e.judgement, matchedRuleStruct := e.struct)); } }