1 | concept AppliedRule {
|
2 | S globalID = aGlobalID(); |
3 | S ruleID; |
4 | S modifiedRule; |
5 | S outText; |
6 | S judgement; |
7 | S comments; |
8 | S varMap; |
9 | S matchedRuleStruct; |
10 | S intention, context; |
11 | } |
12 | |
13 | abstract sclass DynAppliedRules extends DynCRUD<AppliedRule> {
|
14 | start {
|
15 | dbIndexing(AppliedRule, 'ruleID, AppliedRule, 'context, AppliedRule, 'globalID); |
16 | for (AppliedRule r : list()) fixEntry(r); |
17 | dm_registerAs('gazelleFeedbackCRUD);
|
18 | addCountToName(); |
19 | } |
20 | |
21 | enhanceFrame { internalFrameIcon(f, gazelle_frameIcon()); }
|
22 | |
23 | void fixEntry(AppliedRule r) {
|
24 | if (r.ruleID == null) {
|
25 | S ruleID = "?"; |
26 | pcall {
|
27 | ruleID = gazelle_ruleIDFromMatchedRuleStruct(r.matchedRuleStruct); |
28 | } |
29 | cset(r, +ruleID); |
30 | } |
31 | |
32 | if (r.varMap == null) {
|
33 | S varMap = ""; |
34 | pcall {
|
35 | varMap = sfu(gazelle_varMapFromMatchedRuleStruct(r.matchedRuleStruct); |
36 | } |
37 | cset(r, +varMap); |
38 | } |
39 | |
40 | if (r.outText == null) {
|
41 | S outText = ""; |
42 | pcall {
|
43 | outText = gazelle_outTextFromMatchedRuleStruct(r.matchedRuleStruct); |
44 | } |
45 | cset(r, +outText); |
46 | } |
47 | |
48 | if (r.modifiedRule == null) {
|
49 | S modifiedRule = ""; |
50 | pcall {
|
51 | modifiedRule = gazelle_modifiedRuleFromMatchedRuleStruct(r.matchedRuleStruct); |
52 | } |
53 | cset(r, +modifiedRule); |
54 | } |
55 | } |
56 | |
57 | // API |
58 | |
59 | AppliedRule getFeedback(S globalID) {
|
60 | ret conceptWhere AppliedRule(+globalID); |
61 | } |
62 | |
63 | L<AppliedRule> feedbackForRule(S ruleID) {
|
64 | ret asList(conceptsWhere AppliedRule(+ruleID)); |
65 | } |
66 | |
67 | Map<S, Int> stats() {
|
68 | ret multiSetToMap(collectMultiSet ruleID(concepts())); |
69 | } |
70 | |
71 | Map<S, Int> statsByJudgement() {
|
72 | new MultiSet<S> ms; |
73 | for (AppliedRule r : concepts()) |
74 | ms.add(r.ruleID + "/" + r.judgement); |
75 | ret multiSetToMap(ms); |
76 | } |
77 | |
78 | AppliedRule uniqConcept(O... params) {
|
79 | AppliedRule r = super.uniqConcept(params); |
80 | fixEntry(r); |
81 | ret r; |
82 | } |
83 | |
84 | Cl<AppliedRule> applicationsForContext(S context) {
|
85 | ret conceptsWhere(AppliedRule, +context); |
86 | } |
87 | |
88 | Cl<AppliedRule> allGoodFeedback() {
|
89 | ret conceptsWhere(AppliedRule, judgement := 'good); |
90 | } |
91 | } |
Began life as a copy of #1021413
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1021788 |
| Snippet name: | Gazelle Feedback List Include [Dyn Module] |
| Eternal ID of this version: | #1021788/10 |
| Text MD5: | 27c27d291ebd09cb93c049394b90b132 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-12-19 11:36:05 |
| Source code size: | 2213 bytes / 91 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 529 / 843 |
| Version history: | 9 change(s) |
| Referenced in: | [show references] |