Пример #1
0
        public void NoCnlTest()
        {
            var feClient = new CogniPySvr();
            var cnl      = feClient.ToCNL(true);

            Assert.AreEqual("", cnl);
        }
Пример #2
0
        public void StrageBug2a2BUG()
        {
            var reasoner = new CogniPySvr();

            reasoner.LoadCnlFromString("Bubu influences-with-weight-of-1 Dudu.", true, true);
            var toDel = "Bubu influence-with-weight-of-1 Dudu.";

            reasoner.KnowledgeDelete(toDel, true);
            var cnl = reasoner.ToCNL(false);
        }
Пример #3
0
        public void MaterializationTest(bool materialize)
        {
            var cnlSentences = new List <string>()
            {
                "John is a man.",
                "Every man is a human-being."
            };
            var feClient = new CogniPySvr();

            feClient.LoadCnlFromString(string.Join("\r\n", cnlSentences), true, materialize: materialize);
            //var res = feClient.SparqlQuery("SELECT * WHERE {?x ?y ?z}");
            var result = feClient.ToCNL(true, true);

            Assert.IsNotNull(result);
            if (materialize)
            {
                Assert.IsTrue(result.Contains("John is a human-being."));
            }
            else
            {
                Assert.IsFalse(result.Contains("John is a human-being."));
            }
        }
Пример #4
0
        public void KnowledgeInsertAnnotationsTest(bool includeImplicit, bool removeTrivials)
        {
            var cnlSentences = new List <string>()
            {
                "Data-Location-Form is a data-location-form.",
                "Annotations: _Data-Location-Form Instance: description 'A data location form.'@en.",
                "Comment: This comment should not be returned as CNL statement."
            };

            var feClient = new CogniPySvr();

            feClient.LoadCnlFromString(string.Join("\r\n", cnlSentences), true, true);


            var toInsert = new List <string>()
            {
                "Operational-Risk is a thing.",
                "Annotations: _Operational-Risk Instance: network-description 'Network of operational risk.'@en."
            };

            feClient.KnowledgeInsert(string.Join("\r\n", toInsert), true, true);
            var annots = feClient.GetAnnotationsForSignature(new List <string>()
            {
                "Operational-Risk"
            });

            Assert.IsTrue(annots.Where(a => a.Property == "network-description").Count() > 0);

            //Check for number of Annotations: blocks, should be exactly 1
            var toCnl = feClient.ToCNL(includeImplicit, true);

            Assert.AreEqual(1, toCnl.Split(' ').Where(tok => tok.Contains("Annotations:")).Count());

            var toCnlList = feClient.ToCNLList(includeImplicit, removeTrivials, true);

            Assert.AreEqual(1, toCnlList.Count(s => s.Contains("Annotations:")));
        }