public void StorageSesameDeleteGraph2() { SesameHttpProtocolConnector sesame = SesameTests.GetConnection(); Uri graphUri = null; sesame.DeleteGraph(graphUri); Graph g = new Graph(); FileLoader.Load(g, "resources\\InferenceTest.ttl"); g.BaseUri = graphUri; sesame.SaveGraph(g); Graph h = new Graph(); sesame.LoadGraph(h, graphUri); Assert.False(h.IsEmpty, "Graph should not be empty after loading"); Assert.Equal(g, h); sesame.DeleteGraph(graphUri); h = new Graph(); sesame.LoadGraph(h, graphUri); Assert.True(h.IsEmpty, "Graph should be equal after deletion"); Assert.NotEqual(g, h); }
public void StorageSesameDeleteGraph1() { SesameHttpProtocolConnector sesame = SesameTests.GetConnection(); Uri graphUri = new Uri("http://example.org/Sesame/delete"); Graph g = new Graph(); FileLoader.Load(g, "resources\\InferenceTest.ttl"); g.BaseUri = graphUri; sesame.SaveGraph(g); Graph h = new Graph(); sesame.LoadGraph(h, graphUri); Assert.IsFalse(h.IsEmpty, "Graph should not be empty after loading"); Assert.AreEqual(g, h, "Graphs should have been equal"); sesame.DeleteGraph(graphUri); h = new Graph(); sesame.LoadGraph(h, graphUri); Assert.IsTrue(h.IsEmpty, "Graph should be equal after deletion"); Assert.AreNotEqual(g, h, "Graphs should not be equal after deletion"); }
/// <summary> /// Clear repository - delete graph /// </summary> public void ClearRepository() { using (SesameHttpProtocolConnector connector = new SesameHttpProtocolConnector(RtvSloConfig.RepositoryUrl, RtvSloConfig.RepositoryName)) { if (connector.IsReady) { connector.DeleteGraph(RepositoryHelper.BaseUrl.ToUri()); } else { this._logger.FatalFormat("RepositoryService, Clear, SesameHttpProtocolConnector is not ready"); } } }
public void StorageSesameSaveEmptyGraph2() { SesameHttpProtocolConnector sesame = SesameTests.GetConnection(); Uri graphUri = new Uri("http://example.org/Sesame/empty2"); Console.WriteLine("Deleting any existing graph"); sesame.DeleteGraph(graphUri); Console.WriteLine("Existing graph deleted"); // First create a non-empty graph Graph g = new Graph(); g.BaseUri = graphUri; g.Assert(g.CreateBlankNode(), g.CreateUriNode("rdf:type"), g.CreateUriNode(new Uri("http://example.org/BNode"))); Console.WriteLine("Saving non-empty graph"); sesame.SaveGraph(g); Console.WriteLine("Non-empty graph saved"); Graph h = new Graph(); sesame.LoadGraph(h, graphUri); Assert.False(h.IsEmpty, "Graph should not be empty after loading"); Assert.Equal(g, h); // Now attempt to save an empty graph as well g = new Graph(); g.BaseUri = graphUri; Console.WriteLine("Attempting to save empty graph with same name"); sesame.SaveGraph(g); Console.WriteLine("Empty graph saved"); h = new Graph(); sesame.LoadGraph(h, graphUri); Assert.True(h.IsEmpty, "Graph should be empty after loading"); Assert.Equal(g, h); }
public void StorageSesameSaveEmptyGraph3() { SesameHttpProtocolConnector sesame = SesameTests.GetConnection(); Uri graphUri = null; Console.WriteLine("Deleting any existing graph"); sesame.DeleteGraph(graphUri); Console.WriteLine("Existing graph deleted"); // First create a non-empty graph Graph g = new Graph(); g.BaseUri = graphUri; g.Assert(g.CreateBlankNode(), g.CreateUriNode("rdf:type"), g.CreateUriNode(new Uri("http://example.org/BNode"))); Console.WriteLine("Saving non-empty graph"); sesame.SaveGraph(g); Console.WriteLine("Non-empty graph saved"); Graph h = new Graph(); sesame.LoadGraph(h, graphUri); Assert.False(h.IsEmpty, "Graph should not be empty after loading"); Assert.Equal(g, h); // Now attempt to overwrite with an empty graph g = new Graph(); g.BaseUri = graphUri; Console.WriteLine("Attempting to save empty graph with same name"); sesame.SaveGraph(g); Console.WriteLine("Empty graph saved"); h = new Graph(); sesame.LoadGraph(h, graphUri); // Since saving to default graph does not overwrite the graph we've just retrieved must contain the empty graph as a sub-graph Assert.True(h.HasSubGraph(g)); }