コード例 #1
0
        public RuleCollection ParseRules()
        {
            /** Create a list of rules */
            RuleCollection rules    = new RuleCollection();
            XmlNodeList    ruleNode = xmlDoc.GetElementsByTagName("Rule");

            foreach (XmlNode r in ruleNode)
            {
                /** Conclusion of Rule */
                XmlNode     conclusionNode = r["Conclusion"];
                string      attribute      = conclusionNode["Attribute"].InnerText;
                TypeOfValue value          = (TypeOfValue)Convert.ToInt32(conclusionNode["Value"].InnerText);

                Literal conclusion = new Literal(attribute, value);

                /** Priority of Rule */
                decimal priority = decimal.Parse(r["Priority"].InnerText);

                /** Create a list of conditions */
                LiteralCollection conditions = ParseConditions(r);

                rules.Add(new Rule(rules.Count, conditions, conclusion, priority));
            }
            return(rules);
        }
コード例 #2
0
        public void RetractAllConclusionsGeneratedByTheRule(Rule r, RuleCollection rules)
        {
            if (r.IdNextRules != null)
            {
                foreach (int id in r.IdNextRules)
                {
                    Rule nextRule = rules[id] as Rule;

                    int index_nextConclusion = IndexOf(new Fact(nextRule.Conclusion, id));
                    if (index_nextConclusion != -1)
                    {
                        if (!ContainsWithAnotherRule(r.Conclusion, id))
                        {
                            RetractAllConclusionsGeneratedByTheRule(rules[id] as Rule, rules);
                            RetractConclusion(index_nextConclusion);
                        }
                    }
                }
            }
        }
コード例 #3
0
 public NonMonotonicity(LiteralCollection facts, RuleCollection rules)
     : base(facts, rules)
 {
 }
コード例 #4
0
 public Conflict(LiteralCollection facts, RuleCollection rules)
 {
     this.Facts = facts;
     this.Rules = rules;
 }
コード例 #5
0
 public Rebutting(LiteralCollection facts, RuleCollection rules)
     : base(facts, rules)
 {
 }
コード例 #6
0
 public Undermining(LiteralCollection facts, RuleCollection rules)
     : base(facts, rules)
 {
 }
コード例 #7
0
 public Attack(LiteralCollection facts, RuleCollection rules)
 {
     this.Facts = facts;
     this.Rules = rules;
 }