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

            //Try extending the list
            List <INode> items = Enumerable.Range(11, 10).Select(i => i.ToLiteral(g)).OfType <INode>().ToList();

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

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

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

            for (int i = 0; i < items.Count; i++)
            {
                Assert.AreEqual(items[i], listItems[i + 10], "Items were not in list in correct order");
            }

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

            //Try extending the list
            List <INode> items = Enumerable.Range(11, 10).Select(i => i.ToLiteral(g)).OfType <INode>().ToList();

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

            Assert.Equal(items.Count * 4, g.Triples.Count);
            List <INode> listItems = g.GetListItems(listRoot).ToList();

            Assert.Equal(items.Count * 2, listItems.Count);

            for (int i = 0; i < items.Count; i++)
            {
                Assert.Equal(items[i], listItems[i + 10]);
            }

            g.RetractList(listRoot);
            Assert.Equal(0, g.Triples.Count);
        }
Esempio n. 3
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. 4
0
        public void GraphListsError1()
        {
            Graph g = new Graph();

            g.GetListItems(g.CreateBlankNode());
        }
Esempio n. 5
0
        public void GraphListsError1()
        {
            Graph g = new Graph();

            Assert.Throws <RdfException>(() => g.GetListItems(g.CreateBlankNode()));
        }