/// <summary> /// Gets a Graph Reference for the given Graph URI. /// </summary> /// <param name="graphUri">Graph URI.</param> /// <returns></returns> public IGraph this[Uri graphUri] { get { if (_store.HasGraph(graphUri)) { return(_store[graphUri]); } else { Graph g = new Graph(); g.BaseUri = graphUri; _store.Add(g); return(g); } } }
public void GraphCollectionBasic1() { TripleStore store = new TripleStore(); Graph g = new Graph(); store.Add(g); Assert.True(store.HasGraph(g.BaseUri), "Graph Collection should contain the Graph"); Assert.Equal(g, store[g.BaseUri]); }
public void GraphCollectionBasic2() { TripleStore store = new TripleStore(); Graph g = new Graph(); g.LoadFromEmbeddedResource("VDS.RDF.Configuration.configuration.ttl"); store.Add(g); Assert.True(store.HasGraph(g.BaseUri), "Graph Collection should contain the Graph"); Assert.Equal(g, store[g.BaseUri]); }
public void GraphCollectionDiskDemand1() { TripleStore store = new TripleStore(new DiskDemandGraphCollection()); Graph g = new Graph(); g.LoadFromFile("resources\\InferenceTest.ttl"); g.BaseUri = new Uri("file:///" + Path.GetFullPath("resources\\InferenceTest.ttl")); Assert.IsTrue(store.HasGraph(g.BaseUri), "Graph Collection should contain the Graph"); Assert.AreEqual(g, store[g.BaseUri], "Graphs should be equal"); }
public void GraphCollectionWebDemand1() { TripleStore store = new TripleStore(new WebDemandGraphCollection()); Graph g = new Graph(); Uri u = new Uri("http://www.dotnetrdf.org/configuration#"); g.LoadFromUri(u); g.BaseUri = u; Assert.True(store.HasGraph(g.BaseUri), "Graph Collection should contain the Graph"); Assert.Equal(g, store[g.BaseUri]); }
public void GraphCollectionDiskDemand2() { //Test that on-demand loading does not kick in for pre-existing graphs TripleStore store = new TripleStore(new DiskDemandGraphCollection()); Graph g = new Graph(); g.LoadFromFile("resources\\InferenceTest.ttl"); g.BaseUri = new Uri("file:///" + Path.GetFullPath("resources\\InferenceTest.ttl")); Graph empty = new Graph(); empty.BaseUri = g.BaseUri; store.Add(empty); Assert.True(store.HasGraph(g.BaseUri), "Graph Collection should contain the Graph"); Assert.NotEqual(g, store[g.BaseUri]); }
public void GraphCollectionWebDemand2() { //Test that on-demand loading does not kick in for pre-existing graphs TripleStore store = new TripleStore(new WebDemandGraphCollection()); Graph g = new Graph(); Uri u = new Uri("http://www.dotnetrdf.org/configuration#"); g.LoadFromUri(u); g.BaseUri = u; Graph empty = new Graph(); empty.BaseUri = g.BaseUri; store.Add(empty); Assert.True(store.HasGraph(g.BaseUri), "Graph Collection should contain the Graph"); Assert.NotEqual(g, store[g.BaseUri]); }