Exemplo n.º 1
0
        public void RuleML086SaveRuleBase()
        {
            IInferenceEngine ie = new IEImpl();

            ie.LoadRuleBase(new RuleML086DatalogAdapter(ruleFilesFolder + "endlessloop.ruleml", FileAccess.Read));
            ie.SaveRuleBase(new RuleML086DatalogAdapter(outFile, FileAccess.Write));

            // for now, compare only the size
            Assert.IsTrue(AreXmlOfSameLength(ruleFilesFolder + "endlessloop.ruleml", outFile), "Same XML size");
        }
Exemplo n.º 2
0
        public void RuleML08SaveRuleBase()
        {
            IInferenceEngine ie = new IEImpl();

            ie.LoadRuleBase(new RuleML08DatalogAdapter(ruleFilesFolder + "discount.ruleml", FileAccess.Read));
            ie.SaveRuleBase(new RuleML08DatalogAdapter(outFile, FileAccess.Write));

            // for now, let's reload the rulebase
            ie.LoadRuleBase(new RuleML08DatalogAdapter(outFile, FileAccess.Read));
        }
Exemplo n.º 3
0
        public void RuleML086SaveRuleBase()
        {
            IInferenceEngine ie = new IEImpl();

            ie.LoadRuleBase(new RuleML086DatalogAdapter(ruleFilesFolder + "endlessloop.ruleml", FileAccess.Read));
            ie.SaveRuleBase(new RuleML086DatalogAdapter(outFile, FileAccess.Write));

            ie.LoadRuleBase(new RuleML086DatalogAdapter(outFile, FileAccess.Read));

            Assert.IsTrue(AreSameXml(ruleFilesFolder + "endlessloop.ruleml", outFile), "Same XML");
        }
Exemplo n.º 4
0
        public void RuleMLNaf09SaveRuleBase()
        {
            string inFile = ruleFilesFolder + "test-0_9.ruleml";

            IInferenceEngine ie = new IEImpl();

            ie.LoadRuleBase(new RuleML09NafDatalogAdapter(inFile, FileAccess.Read));
            ie.SaveRuleBase(new RuleML09NafDatalogAdapter(outFile, FileAccess.Write));

            // for now, compare only the size
            Assert.IsTrue(AreXmlOfSameLength(inFile, outFile), "Same XML size");
        }
Exemplo n.º 5
0
        public void RuleMLNaf091SaveRuleBase()
        {
            string inFile = ruleFilesFolder + "test-0_91.ruleml";

            IInferenceEngine ie = new IEImpl();

            ie.LoadRuleBase(new RuleML091NafDatalogAdapter(inFile, FileAccess.Read));
            ie.SaveRuleBase(new RuleML091NafDatalogAdapter(outFile, FileAccess.Write));

            ie.LoadRuleBase(new RuleML091NafDatalogAdapter(outFile, FileAccess.Read));

            Assert.IsTrue(AreSameXml(inFile, outFile), "Same XML: " + inFile + " and " + outFile);
        }
Exemplo n.º 6
0
        public void HRFSaveRuleBase()
        {
            IInferenceEngine ie = new IEImpl();

            ie.LoadRuleBase(new HRF086Adapter(ruleFilesFolder + "gedcom-relations.hrf", FileAccess.Read));
            ie.SaveRuleBase(new HRF086Adapter(outFileHRF, FileAccess.Write));

            IInferenceEngine ie2 = new IEImpl();

            ie2.LoadRuleBase(new HRF086Adapter(outFileHRF, FileAccess.Read));

            Assert.AreEqual(ie.Direction, ie2.Direction, "Same Direction");
            Assert.AreEqual(ie.Label, ie2.Label, "Same Label");
        }
Exemplo n.º 7
0
		protected string GenerateRuleFile(string inFile, SaveFormatAttributes sfa) {
			string outFile = outFilesFolder + sfa.ToString().ToLower() + "-" + inFile;
			
			FileInfo fi = new FileInfo(outFile);
			if (fi.Exists) fi.Delete();
			
			IInferenceEngine ie = new IEImpl();
			ie.LoadRuleBase(new RuleML09NafDatalogAdapter(ruleFilesFolder + inFile, FileAccess.Read));
			ie.SaveRuleBase(new RuleML09NafDatalogAdapter(outFile, FileAccess.Write, sfa));
			
			Console.Out.WriteLine("Generated: {0}", outFile);
			
			return outFile;
		}
        private void PerformSaveTest(string ruleFile, SaveFormatAttributes sfa)
        {
            string inFile = ruleFilesFolder + ruleFile;

            string   outFile = outFilesFolder + "outtest.ruleml";
            FileInfo fi      = new FileInfo(outFile);

            if (fi.Exists)
            {
                fi.Delete();
            }

            IInferenceEngine ie = new IEImpl();

            ie.LoadRuleBase(new RuleML09NafDatalogAdapter(inFile, FileAccess.Read));
            ie.SaveRuleBase(new RuleML09NafDatalogAdapter(outFile, FileAccess.Write, sfa));

            Assert.IsTrue(TestAdapter.AreSameXml(inFile, outFile), "Same XML file lengths");
        }