public void ParsingUsingPagingHandler2(String tempFile, IRdfReader parser) { Graph g = new Graph(); EmbeddedResourceLoader.Load(g, "VDS.RDF.Configuration.configuration.ttl"); g.SaveToFile(tempFile); Graph h = new Graph(); PagingHandler handler = new PagingHandler(new GraphHandler(h), 0); parser.Load(handler, tempFile); Assert.IsTrue(h.IsEmpty, "Graph should be empty"); }
private static void ParsingUsingPagingHandler2(String tempFile, IRdfReader parser) { Graph g = new Graph(); EmbeddedResourceLoader.Load(g, "VDS.RDF.Configuration.configuration.ttl"); g.SaveToFile(tempFile); Graph h = new Graph(); PagingHandler handler = new PagingHandler(new GraphHandler(h), 0); parser.Load(handler, tempFile); Assert.True(h.IsEmpty, "Graph should be empty"); }
public void ParsingUsingPagingHandler3(String tempFile, IRdfReader parser) { Graph g = new Graph(); EmbeddedResourceLoader.Load(g, "VDS.RDF.Configuration.configuration.ttl"); g.SaveToFile(tempFile); Graph h = new Graph(); PagingHandler handler = new PagingHandler(new GraphHandler(h), -1, 100); parser.Load(handler, tempFile); Assert.IsFalse(h.IsEmpty, "Graph should not be empty"); Assert.AreEqual(g.Triples.Count - 100, h.Triples.Count, "Should have 100 less triples than original graph as first 100 triples are skipped"); }
private static void ParsingUsingPagingHandler3(String tempFile, IRdfReader parser) { Graph g = new Graph(); EmbeddedResourceLoader.Load(g, "VDS.RDF.Configuration.configuration.ttl"); g.SaveToFile(tempFile); Graph h = new Graph(); PagingHandler handler = new PagingHandler(new GraphHandler(h), -1, 100); parser.Load(handler, tempFile); Assert.False(h.IsEmpty, "Graph should not be empty"); Assert.Equal(g.Triples.Count - 100, h.Triples.Count); }
private static void ParsingUsingPagingHandler(String tempFile, IRdfReader parser) { Graph g = new Graph(); EmbeddedResourceLoader.Load(g, "VDS.RDF.Configuration.configuration.ttl"); g.SaveToFile(tempFile); Graph h = new Graph(); PagingHandler handler = new PagingHandler(new GraphHandler(h), 25); parser.Load(handler, tempFile); h.Retract(h.Triples.Where(t => !t.IsGroundTriple).ToList()); NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in h.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); Assert.False(h.IsEmpty, "Graph should not be empty"); Assert.True(h.Triples.Count <= 25, "Graphs should have <= 25 Triples"); Graph i = new Graph(); handler = new PagingHandler(new GraphHandler(i), 25, 25); parser.Load(handler, tempFile); i.Retract(i.Triples.Where(t => !t.IsGroundTriple)); foreach (Triple t in i.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); Assert.False(i.IsEmpty, "Graph should not be empty"); Assert.True(i.Triples.Count <= 25, "Graphs should have <= 25 Triples"); GraphDiffReport report = h.Difference(i); Assert.False(report.AreEqual, "Graphs should not be equal"); Assert.Equal(i.Triples.Count, report.AddedTriples.Count()); Assert.Equal(h.Triples.Count, report.RemovedTriples.Count()); }
public void ParsingMultiHandlerGraphAndPaging() { EnsureTestData(); Graph g = new Graph(); Graph h = new Graph(); GraphHandler handler1 = new GraphHandler(g); PagingHandler handler2 = new PagingHandler(new GraphHandler(h), 100); MultiHandler handler = new MultiHandler(new IRdfHandler[] { handler1, handler2 }); TurtleParser parser = new TurtleParser(); parser.Load(handler, "temp.ttl"); Assert.AreEqual(101, g.Triples.Count, "Triples should have been limited to 101 (1st Graph)"); Assert.AreEqual(100, h.Triples.Count, "Triples should have been limited to 100 (2nd Graph)"); Assert.AreNotEqual(g.Triples.Count, h.Triples.Count, "Expected different number of Triples"); Assert.AreNotEqual(g, h, "Expected Graphs to not be equal"); }
public void ParsingMultiHandlerGraphAndPaging() { EnsureTestData(); Graph g = new Graph(); Graph h = new Graph(); GraphHandler handler1 = new GraphHandler(g); PagingHandler handler2 = new PagingHandler(new GraphHandler(h), 100); MultiHandler handler = new MultiHandler(new IRdfHandler[] { handler1, handler2 }); TurtleParser parser = new TurtleParser(); parser.Load(handler, "multi_handler_tests_temp.ttl"); Assert.Equal(101, g.Triples.Count); Assert.Equal(100, h.Triples.Count); Assert.NotEqual(g.Triples.Count, h.Triples.Count); Assert.NotEqual(g, h); }
public void ParsingChainedHandlerGraphAndPaging() { EnsureTestData(); Graph g = new Graph(); Graph h = new Graph(); GraphHandler handler1 = new GraphHandler(g); PagingHandler handler2 = new PagingHandler(new GraphHandler(h), 100); ChainedHandler handler = new ChainedHandler(new IRdfHandler[] { handler1, handler2 }); TurtleParser parser = new TurtleParser(); parser.Load(handler, "temp.ttl"); Assert.AreEqual(101, g.Triples.Count, "Triples should have been limited to 101 (1st Graph)"); Assert.AreEqual(100, h.Triples.Count, "Triples should have been limited to 100 (2nd Graph)"); Assert.AreNotEqual(g.Triples.Count, h.Triples.Count, "Expected different number of Triples"); Assert.AreNotEqual(g, h, "Expected Graphs to not be equal"); }
public void ParsingChainedHandlerGraphAndPaging2() { EnsureTestData(); Graph g = new Graph(); Graph h = new Graph(); GraphHandler handler1 = new GraphHandler(g); PagingHandler handler2 = new PagingHandler(new GraphHandler(h), 100); ChainedHandler handler = new ChainedHandler(new IRdfHandler[] { handler2, handler1 }); TurtleParser parser = new TurtleParser(); parser.Load(handler, "chained_handler_tests_temp.ttl"); Assert.Equal(100, g.Triples.Count); Assert.Equal(100, h.Triples.Count); Assert.Equal(g.Triples.Count, h.Triples.Count); Assert.Equal(g, h); }
public void ParsingUsingPagingHandler(String tempFile, IRdfReader parser) { Graph g = new Graph(); EmbeddedResourceLoader.Load(g, "VDS.RDF.Configuration.configuration.ttl"); g.SaveToFile(tempFile); Graph h = new Graph(); PagingHandler handler = new PagingHandler(new GraphHandler(h), 25); parser.Load(handler, tempFile); h.Retract(h.Triples.Where(t => !t.IsGroundTriple)); NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in h.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); Assert.IsFalse(h.IsEmpty, "Graph should not be empty"); Assert.IsTrue(h.Triples.Count <= 25, "Graphs should have <= 25 Triples"); Graph i = new Graph(); handler = new PagingHandler(new GraphHandler(i), 25, 25); parser.Load(handler, tempFile); i.Retract(i.Triples.Where(t => !t.IsGroundTriple)); foreach (Triple t in i.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); Assert.IsFalse(i.IsEmpty, "Graph should not be empty"); Assert.IsTrue(i.Triples.Count <= 25, "Graphs should have <= 25 Triples"); GraphDiffReport report = h.Difference(i); Assert.IsFalse(report.AreEqual, "Graphs should not be equal"); Assert.AreEqual(i.Triples.Count, report.AddedTriples.Count(), "Should be " + i.Triples.Count + " added Triples"); Assert.AreEqual(h.Triples.Count, report.RemovedTriples.Count(), "Should be " + h.Triples.Count + " removed Triples"); }