public void StorageReadWriteSparqlSaveDefaultGraph() { try { Options.UriLoaderCaching = false; Graph g = new Graph(); FileLoader.Load(g, "InferenceTest.ttl"); g.BaseUri = null; //Save Graph to ReadWriteSparql ReadWriteSparqlConnector readWrite = ReadWriteSparqlTests.GetConnection(); readWrite.SaveGraph(g); Console.WriteLine("Graph saved to ReadWriteSparql OK"); //Now retrieve Graph from ReadWriteSparql Graph h = new Graph(); readWrite.LoadGraph(h, (Uri)null); Console.WriteLine(); foreach (Triple t in h.Triples) { Console.WriteLine(t.ToString(this._formatter)); } Assert.AreEqual(g, h, "Graphs should be equal"); Assert.IsNull(h.BaseUri, "Retrieved Graph should have a null Base URI"); } finally { Options.UriLoaderCaching = true; } }
public void StorageReadWriteSparqlSaveDefaultGraph() { try { SetUriLoaderCaching(false); Graph g = new Graph(); g.LoadFromFile("resources\\InferenceTest.ttl"); g.BaseUri = null; //Save Graph to ReadWriteSparql ReadWriteSparqlConnector readWrite = ReadWriteSparqlTests.GetConnection(); readWrite.SaveGraph(g); Console.WriteLine("Graph saved to ReadWriteSparql OK"); //Now retrieve Graph from ReadWriteSparql Graph h = new Graph(); readWrite.LoadGraph(h, (Uri)null); Console.WriteLine(); foreach (Triple t in h.Triples) { Console.WriteLine(t.ToString(this._formatter)); } Assert.Equal(g, h); Assert.Null(h.BaseUri); } finally { SetUriLoaderCaching(true); } }
public void StorageReadWriteSparqlSaveGraph() { try { SetUriLoaderCaching(false); Graph g = new Graph(); g.LoadFromFile("resources\\InferenceTest.ttl"); g.BaseUri = new Uri("http://example.org/readWriteTest"); //Save Graph to ReadWriteSparql ReadWriteSparqlConnector readWrite = ReadWriteSparqlTests.GetConnection(); readWrite.SaveGraph(g); Console.WriteLine("Graph saved to ReadWriteSparql OK"); //Now retrieve Graph from ReadWriteSparql Graph h = new Graph(); readWrite.LoadGraph(h, "http://example.org/readWriteTest"); Console.WriteLine(); foreach (Triple t in h.Triples) { Console.WriteLine(t.ToString(this._formatter)); } Assert.AreEqual(g, h, "Graphs should be equal"); } finally { SetUriLoaderCaching(true); } }