public void StorageAllegroGraphDeleteGraph2() { AllegroGraphConnector agraph = AllegroGraphTests.GetConnection(); Uri graphUri = null; agraph.DeleteGraph(graphUri); Graph g = new Graph(); FileLoader.Load(g, "resources\\InferenceTest.ttl"); g.BaseUri = graphUri; agraph.SaveGraph(g); Graph h = new Graph(); agraph.LoadGraph(h, graphUri); Assert.False(h.IsEmpty, "Graph should not be empty after loading"); Assert.Equal(g, h); agraph.DeleteGraph(graphUri); h = new Graph(); agraph.LoadGraph(h, graphUri); Assert.True(h.IsEmpty, "Graph should be equal after deletion"); Assert.NotEqual(g, h); }
public void StorageAllegroGraphDeleteGraph1() { AllegroGraphConnector agraph = AllegroGraphTests.GetConnection(); Uri graphUri = new Uri("http://example.org/AllegroGraph/delete"); Graph g = new Graph(); FileLoader.Load(g, "resources\\InferenceTest.ttl"); g.BaseUri = graphUri; agraph.SaveGraph(g); Graph h = new Graph(); agraph.LoadGraph(h, graphUri); Assert.IsFalse(h.IsEmpty, "Graph should not be empty after loading"); Assert.AreEqual(g, h, "Graphs should have been equal"); agraph.DeleteGraph(graphUri); h = new Graph(); agraph.LoadGraph(h, graphUri); Assert.IsTrue(h.IsEmpty, "Graph should be equal after deletion"); Assert.AreNotEqual(g, h, "Graphs should not be equal after deletion"); }
public void StorageAllegroGraphSaveEmptyGraph3() { AllegroGraphConnector agraph = AllegroGraphTests.GetConnection(); Uri graphUri = null; Console.WriteLine("Deleting any existing graph"); agraph.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"); agraph.SaveGraph(g); Console.WriteLine("Non-empty graph saved"); Graph h = new Graph(); agraph.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"); agraph.SaveGraph(g); Console.WriteLine("Empty graph saved"); h = new Graph(); agraph.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)); }
public void StorageAllegroGraphSaveEmptyGraph2() { AllegroGraphConnector agraph = AllegroGraphTests.GetConnection(); Uri graphUri = new Uri("http://example.org/AllegroGraph/empty2"); Console.WriteLine("Deleting any existing graph"); agraph.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"); agraph.SaveGraph(g); Console.WriteLine("Non-empty graph saved"); Graph h = new Graph(); agraph.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"); agraph.SaveGraph(g); Console.WriteLine("Empty graph saved"); h = new Graph(); agraph.LoadGraph(h, graphUri); Assert.True(h.IsEmpty, "Graph should be empty after loading"); Assert.Equal(g, h); }