public void StorageDydraDeleteGraph() { try { Options.HttpDebugging = true; Graph orig = new Graph(); orig.LoadFromEmbeddedResource("VDS.RDF.Configuration.configuration.ttl"); orig.BaseUri = new Uri("http://example.org/storage/dydra/delete"); DydraConnector dydra = DydraTests.GetConnection(); dydra.SaveGraph(orig); Graph g = new Graph(); dydra.LoadGraph(g, orig.BaseUri); if (orig.Triples.Count == g.Triples.Count) { GraphDiffReport report = orig.Difference(g); if (!report.AreEqual) { TestTools.ShowDifferences(report); } Assert.AreEqual(orig, g, "Graphs should be equal"); } else { Assert.IsTrue(g.HasSubGraph(orig), "Original Graph should be a sub-graph of retrieved Graph"); } //Now delete the Graph dydra.DeleteGraph(orig.BaseUri); //And retrieve it again g = new Graph(); dydra.LoadGraph(g, orig.BaseUri); Assert.IsTrue(g.IsEmpty, "Graph should be empty as was deleted from repository"); Assert.AreNotEqual(orig, g, "Graphs should not be equal"); } finally { Options.HttpDebugging = false; } }
public void StorageDydraLoadGraphWithHandler() { try { Options.HttpDebugging = true; Graph orig = new Graph(); orig.LoadFromEmbeddedResource("VDS.RDF.Configuration.configuration.ttl"); orig.BaseUri = new Uri("http://example.org/storage/dydra/tests/counting"); DydraConnector dydra = DydraTests.GetConnection(); dydra.DeleteGraph(orig.BaseUri); dydra.SaveGraph(orig); CountHandler handler = new CountHandler(); dydra.LoadGraph(handler, orig.BaseUri); Assert.AreEqual(orig.Triples.Count, handler.Count, "Triple Counts should be equal"); } finally { Options.HttpDebugging = false; } }