示例#1
0
        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");
        }
示例#2
0
        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));
        }
示例#3
0
        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();
        }