Example #1
0
        public void InteropSemWebGraphConversion()
        {
            Graph g = new Graph();

            FileLoader.Load(g, "Turtle.ttl");

            MemoryStore mem = new MemoryStore();

            SemWebConverter.ToSemWeb(g, mem);

            Graph h = new Graph();

            SemWebConverter.FromSemWeb(mem, h);

            Assert.AreEqual(g, h, "1 - Graphs should have been equal");

            MemoryStore mem2 = new MemoryStore();

            SemWebConverter.ToSemWeb(h, mem2);

            Graph i = new Graph();

            SemWebConverter.FromSemWeb(mem2, i);

            Assert.AreEqual(h, i, "2 - Graphs should have been equal");
        }
Example #2
0
        public void InteropSemWebReadVia()
        {
            MemoryStore mem = new MemoryStore();

            mem.Import(new N3Reader("InferenceTest.ttl"));

            Console.WriteLine("SemWeb got the following Statements:");
            foreach (Statement stmt in mem)
            {
                Console.WriteLine(stmt.ToString());
            }
            Console.WriteLine();

            Graph g = new Graph();

            SemWebConverter.FromSemWeb(mem, g);

            Console.WriteLine("dotNetRDF got the following Triples via Conversion:");
            foreach (Triple t in g.Triples)
            {
                Console.WriteLine(t.ToString());
            }
            Console.WriteLine();

            Graph h = new Graph();

            FileLoader.Load(h, "InferenceTest.ttl");

            Console.WriteLine("dotNetRDF got the following Triples directly from the File:");
            foreach (Triple t in g.Triples)
            {
                Console.WriteLine(t.ToString());
            }
            Console.WriteLine();

            Assert.AreEqual(g, h, "Graphs should have ben equal");
        }