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

26
LINES

< > BotCompany Repo | #1022152 // gazelle_addRulesFromConcepts

JavaX fragment (include)

1  
svoid gazelle_addRulesFromConcepts(Concepts concepts, O... _) {
2  
  bool overwrite = boolPar overwrite(_);
3  
  L<Concept> toMerge = list(concepts, "Rule");
4  
  for (Concept c : toMerge) {
5  
    S ruleID = getString globalID(c);
6  
    if (empty(ruleID))
7  
      continue with print("No rule ID!?");
8  
    PairS p = dm_textAndCommentForRule(ruleID);
9  
    S text = getString text(c);
10  
    S comments = getString comments(c);
11  
    if (p == null) {
12  
      print("Rule " + ruleID + ": importing");
13  
      dm_call(dm_gazelle_rulesModule(), 'uniqConcept, globalID := ruleID, +text, +comments);
14  
    } else {
15  
      if (neq(text, p.a) || neq(comments, p.b)) {
16  
        if (overwrite) {
17  
          gazelle_setRuleText(ruleID, text);
18  
          dm_gazelle_setRuleComments_verbose(ruleID, comments);
19  
          print("Rule " + ruleID + ": changed");
20  
        } else
21  
          print("Rule " + ruleID + ": should update");
22  
      } /*else
23  
        print("Rule " + ruleID + ": same");*/
24  
    }
25  
  }
26  
}

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: #1022152
Snippet name: gazelle_addRulesFromConcepts
Eternal ID of this version: #1022152/9
Text MD5: da3a0e641917a32bce90b008d5a903b0
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:45:54
Source code size: 980 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 282 / 320
Version history: 8 change(s)
Referenced in: [show references]