public void RdfUpdate_AvailableInGraph() { var f = new NodeFactory(); var rdf = new RdfData(f); var g1 = f.BlankSelf(); var g2 = f.BlankSelf(); var graphPreUpdates = rdf.GetGraph(g1, g2); //add directly via rdf data. var sub = rdf.Uri("x:/s1"); var pred = rdf.Uri("x:/p1"); var val = rdf.New("text"); rdf.Assert(g1, sub, pred, val); rdf.Assert(g2, sub, pred, val); //immediately have the owned quad, //but not the data from other graph. Assert.AreEqual(1, graphPreUpdates.Query.Count, "Got the new entry"); var graphReInit = rdf.GetGraph(g1, g2); Assert.AreEqual(2, graphReInit.Query.Count, "Re-access graph gets latest"); }
public void GraphIds_Ordered() { var rdf = new RdfData(new NodeFactory()); var g1 = rdf.BlankSelf("test"); rdf.Assert(g1, rdf.Blank(g1), rdf.Uri("a:pred"), rdf.New(123)); var graphs = rdf.GraphIds; Assert.AreEqual(3, graphs.Length); Assert.AreEqual(rdf.System, graphs.ElementAt(0)); Assert.AreEqual(rdf.Default, graphs.ElementAt(1)); }
public void WriteTripleData() { var rdf = new RdfData(new NodeFactory()); var target = new NTripleFile(Files.AppDataDir.GetFile( nameof(NTripleFileTests), nameof(WriteTripleData) + ".nt")); var g = rdf.BlankSelf("g1"); rdf.Assert(g, rdf.Uri("x:sub1"), rdf.Uri("x:age"), rdf.New(23)); target.Write(rdf.GetGraph(g)).Wait(); }