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

26
LINES

< > BotCompany Repo | #1022152 // gazelle_addRulesFromConcepts

JavaX fragment (include)

svoid gazelle_addRulesFromConcepts(Concepts concepts, O... _) {
  bool overwrite = boolPar overwrite(_);
  L<Concept> toMerge = list(concepts, "Rule");
  for (Concept c : toMerge) {
    S ruleID = getString globalID(c);
    if (empty(ruleID))
      continue with print("No rule ID!?");
    PairS p = dm_textAndCommentForRule(ruleID);
    S text = getString text(c);
    S comments = getString comments(c);
    if (p == null) {
      print("Rule " + ruleID + ": importing");
      dm_call(dm_gazelle_rulesModule(), 'uniqConcept, globalID := ruleID, +text, +comments);
    } else {
      if (neq(text, p.a) || neq(comments, p.b)) {
        if (overwrite) {
          gazelle_setRuleText(ruleID, text);
          dm_gazelle_setRuleComments_verbose(ruleID, comments);
          print("Rule " + ruleID + ": changed");
        } else
          print("Rule " + ruleID + ": should update");
      } /*else
        print("Rule " + ruleID + ": same");*/
    }
  }
}

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: 281 / 318
Version history: 8 change(s)
Referenced in: [show references]