Example #1
0
        public void IsEmptyAfterClear()
        {
            TripleStore store = MakeTripleStoreWithOneDummyStatement();

            store.Clear();
            Assert.IsTrue(store.IsEmpty());
        }
Example #2
0
        public void IsEmptyIsNotTrueIfStatementAdded()
        {
            TripleStore store = MakeTripleStoreWithOneDummyStatement();

            Assert.IsFalse(store.IsEmpty());
            store.Clear();
        }
Example #3
0
        public void NewInstanceIsEmpty()
        {
            TripleStore store = MakeNewTripleStore();

            Assert.IsTrue(store.IsEmpty());
            store.Clear();
        }
Example #4
0
        public void GetResourceDenotedByDoesNotChangeIsEmptyFlag()
        {
            TripleStore store = MakeNewTripleStore();

            store.GetResourceDenotedBy(new UriRef("http://example.com/uri"));
            Assert.IsTrue(store.IsEmpty());
            store.Clear();
        }
Example #5
0
        public void EvaluateRule()
        {
            TripleStore store = MakeNewTripleStore();

            SimpleRuleProcessor ruleProcessor = new SimpleRuleProcessor();

            store.Add(new Statement(new UriRef("http://example.com/subj1"), new UriRef("http://example.com/pred"), new UriRef("http://example.com/obj1")));
            store.Add(new Statement(new UriRef("http://example.com/subj2"), new UriRef("http://example.com/pred"), new UriRef("http://example.com/obj2")));
            Rule rule = new Rule();

            rule.AddAntecedent(new Pattern(new Variable("var1"), new UriRef("http://example.com/pred"), new Variable("var2")));
            rule.AddConsequent(new Pattern(new Variable("var1"), new UriRef("http://example.com/newPred"), new Variable("var2")));

            ruleProcessor.Process(rule, store);

            Assert.IsFalse(store.IsEmpty(), "Destination is non-empty");

            Assert.IsTrue(store.Contains(new Statement(new UriRef("http://example.com/subj1"), new UriRef("http://example.com/newPred"), new UriRef("http://example.com/obj1"))), "Destination contains first match consequent");
            Assert.IsTrue(store.Contains(new Statement(new UriRef("http://example.com/subj2"), new UriRef("http://example.com/newPred"), new UriRef("http://example.com/obj2"))), "Destination contains second match consequent");

            store.Clear();
        }
Example #6
0
 /// <summary>Gets a value indicating whether the KnowledgeBase is empty or not.</summary>
 /// <returns>true if the KnowledgeBase contains any resource descriptions, false otherwise</returns>
 public virtual bool IsEmpty()
 {
     return(itsAssertions.IsEmpty());
 }