Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

29
LINES

< > BotCompany Repo | #1022153 // gazelle_addRuleFeedbackFromConcepts

JavaX fragment (include)

1  
svoid gazelle_addRuleFeedbackFromConcepts(Concepts concepts, O... _) {
2  
  bool overwrite = boolPar overwrite(_);
3  
  L<Concept> toMerge = list(concepts, "AppliedRule");
4  
  for (Concept c : toMerge) {
5  
    S globalID = getString globalID(c);
6  
    if (empty(globalID))
7  
      continue with print("No global ID!?");
8  
    S judgement = getString judgement(c);
9  
    S moduleID = empty(judgement)
10  
      ? dm_gazelle_longFeedbackCRUD()
11  
      : dm_gazelle_feedbackCRUD();
12  
    O local = dm_call(moduleID, 'getFeedback, globalID);
13  
    Set<S> fields = conceptFields_gen(c);
14  
    if (local == null) {
15  
      print(globalID + " => " + judgement);
16  
      print("  adding feedback");
17  
      local = dm_call(moduleID, 'uniqConcept, +globalID);
18  
    } else {
19  
      if (!anyFieldsDifferent(c, local, fields))
20  
        continue; // with print("  same");
21  
      else {
22  
        print(globalID + " => " + judgement);
23  
        if (!overwrite) continue with print("  would overwrite");
24  
        print("  found, updating");
25  
      }
26  
    }
27  
    ccopyFields2_gen(c, local, fields);
28  
  }
29  
}

Author comment

Began life as a copy of #1022152

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022153
Snippet name: gazelle_addRuleFeedbackFromConcepts
Eternal ID of this version: #1022153/8
Text MD5: aa83290986bf5260c92a3167b2368d9a
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-10 09:59:18
Source code size: 1068 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 193 / 238
Version history: 7 change(s)
Referenced in: [show references]