Exemplo n.º 1
0
        public void SR15BUG()
        {
            var reasoner     = new CogniPySvr();
            var ontologyPath = Path.Combine(AssemblyDirectory, "TestFiles", "TestOntology.encnl");

            reasoner.LoadCnl(ontologyPath, true, true);

            const string concept = "reputational-risk-network-component";

            var instances = reasoner.GetInstancesOf(concept, false);

            var descriptionsBeforeDeletion = reasoner.DescribeInstancesByName(instances);

            var toDel = new List <string>
            {
                "Deal-Criteria-14 is a deal-criteria.",
                "Deal-Criteria-11 is a deal-criteria.",
                "Deal-Criteria-26 is a deal-criteria.",
                "Deal-Criteria-8 is a deal-criteria.",
                "Deal-Criteria-2 is a deal-criteria.",
                "Deal-Criteria-20 is a deal-criteria.",
                "Deal-Criteria-23 is a deal-criteria.",
                "Deal-Criteria-5 is a deal-criteria.",
                "Deal-Criteria-17 is a deal-criteria."
            };

            reasoner.KnowledgeDelete(string.Join("\r\n", toDel), true);

            var descriptionsAfterDeletion = reasoner.DescribeInstancesByName(instances);
        }
Exemplo n.º 2
0
        public void GetInstancesOfTest()
        {
            var cnlSentencesToInsert = new List <string>()
            {
                "Survey[<http://www.sfo.cognitum.eu/Survey/29ed4b1d-fa55-479b-93aa-7773b30bda6b#>] is a subject[sfo].",
            };

            var feClient = new CogniPySvr();

            feClient.LoadCnl(Path.Combine(AssemblyDirectory, "TestFiles", "CSHC.encnl"), true, true);
            feClient.KnowledgeInsert(cnlSentencesToInsert.First(), true, true);
            feClient.KnowledgeInsert(cnlSentencesToInsert.Last(), true, true);

            var instances = feClient.GetInstancesOf("a subject[sfo]", false);

            Assert.Contains("Survey[<http://www.sfo.cognitum.eu/Survey/29ed4b1d-fa55-479b-93aa-7773b30bda6b#>]", instances);

            var instances2 = feClient.GetInstancesOf("Survey[<http://www.sfo.cognitum.eu/Survey/29ed4b1d-fa55-479b-93aa-7773b30bda6b#>]", false);

            Assert.Contains("Survey[<http://www.sfo.cognitum.eu/Survey/29ed4b1d-fa55-479b-93aa-7773b30bda6b#>]", instances2);
        }
Exemplo n.º 3
0
        public void GetInstancesOfWhenInsertWithAnnotationsTest()
        {//BUG: SR-10
            var initialOntology = new List <string>()
            {
                "Every-single-thing has-label nothing-but (some string value).",
                "Every deal-criteria is a network-component.",
                "Every reputational-risk-component is a network-component.",
                "Every reputational-risk-network-deal-criteria is a deal-criteria.",
                "Every reputational-risk-network-deal-criteria is a reputational-risk-network-component.",
                "Every reputational-risk-top-outcome is a reputational-risk-network-component.",
                "Reputational-Risk is a reputational-risk-top-outcome.",
                "Reputational-Risk has-label equal-to 'Reputational Risk'.",
                "Reputational-Risk is a positive-outcome.",
                "Reputational-Risk has-network-id equal-to 'Net-re'.",
                "Reputational-Risk is a network.",
                "Deal-Criteria-2 influences-with-weight-of-1 Reputational-Risk."
            };

            var feClient = new CogniPySvr();

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

            var toInsert = new List <string>()
            {
                "Deal-Criteria-2 is a reputational-risk-network-deal-criteria.",
                "Deal-Criteria-2 is a reputational-risk-network-component.",
                "Deal-Criteria-2 has-sql-name equal-to ''.",
                "Deal-Criteria-2 has-availability equal-to 'Data-Available'.",
                "Deal-Criteria-2 has-unit equal-to ''.",
                "Deal-Criteria-2 has-aggregation equal-to 'None'.",
                "Annotations:\r\n_Deal-Criteria-2 Instance: node-label 'Importance'@en\r\n_Deal-Criteria-2 Instance: node-description 'Importance'@en\r\n."
            };

            feClient.KnowledgeInsert(string.Join("\r\n", toInsert), true, true);

            var instances = feClient.GetInstancesOf("a reputational-risk-network-component", false);

            Assert.AreEqual(2, instances.Count);
        }