Esempio n. 1
0
        public void GraphLists3()
        {
            Graph g        = new Graph();
            INode listRoot = this.TestListsBasic(g);

            //Try removing items from the list
            List <INode> items = Enumerable.Range(1, 10).Where(i => i % 2 == 0).Select(i => i.ToLiteral(g)).OfType <INode>().ToList();

            g.RemoveFromList(listRoot, items);
            TestTools.ShowGraph(g);

            Assert.AreEqual(items.Count * 2, g.Triples.Count, "Expected " + (items.Count * 2) + " Triples");
            List <INode> listItems = g.GetListItems(listRoot).ToList();

            Assert.AreEqual(items.Count * 2, listItems.Count * 2, "Expected " + (items.Count * 2) + " Items in the List");

            for (int i = 0; i < items.Count; i++)
            {
                Assert.IsFalse(listItems.Contains(items[i]), "Item " + items[i].ToString() + " which should have been removed from the list is still present");
            }

            g.RetractList(listRoot);
            Assert.AreEqual(0, g.Triples.Count, "Should be no triples after the list is retracted");
        }
Esempio n. 2
0
        public void GraphListsError5()
        {
            Graph g = new Graph();

            g.RemoveFromList <int>(g.CreateBlankNode(), Enumerable.Range(1, 10), i => i.ToLiteral(g));
        }
Esempio n. 3
0
        public void GraphListsError5()
        {
            Graph g = new Graph();

            Assert.Throws <RdfException>(() => g.RemoveFromList <int>(g.CreateBlankNode(), Enumerable.Range(1, 10), i => i.ToLiteral(g)));
        }