/// <summary> /// Creates a new NTriples Writer Context with custom settings. /// </summary> /// <param name="g">Graph to write.</param> /// <param name="output">TextWriter to write to.</param> /// <param name="syntax">NTriples Syntax mode.</param> /// <param name="prettyPrint">Pretty Print Mode.</param> /// <param name="hiSpeed">High Speed Mode.</param> public NTriplesWriterContext(IGraph g, TextWriter output, NTriplesSyntax syntax, bool prettyPrint, bool hiSpeed) : base(g, output, WriterCompressionLevel.Default, prettyPrint, hiSpeed) { Syntax = syntax; _formatter = new NTriplesFormatter(Syntax); _uriFormatter = (IUriFormatter)_formatter; }
public void SparqlUpdate() { TripleStore store = new TripleStore(); SparqlUpdateParser parser = new SparqlUpdateParser(); //Generate a Command SparqlParameterizedString cmdString = new SparqlParameterizedString(); cmdString.CommandText = "LOAD <http://dbpedia.org/resource/Southampton> INTO <http://example.org/Soton>"; //Parse the command into a SparqlUpdateCommandSet SparqlUpdateCommandSet cmds = parser.ParseFromString(cmdString); //Create an Update Processor using our dataset and apply the updates LeviathanUpdateProcessor processor = new LeviathanUpdateProcessor(store); processor.ProcessCommandSet(cmds); //We should now have a Graph in our dataset as a result of the LOAD update //So we'll retrieve this and print it to the Console IGraph g = store.Graphs[new Uri("http://example.org/Soton")]; NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in g.Triples) { Console.WriteLine(t.ToString(formatter)); } }
public void ParsingGraphHandlerImplicitMerging() { Graph g = new Graph(); EmbeddedResourceLoader.Load(g, "VDS.RDF.Configuration.configuration.ttl"); g.SaveToFile("graph_handler_tests_temp.ttl"); Graph h = new Graph(); TurtleParser parser = new TurtleParser(); parser.Load(h, "graph_handler_tests_temp.ttl"); Assert.False(g.IsEmpty, "Graph should not be empty"); Assert.True(g.NamespaceMap.HasNamespace("dnr"), "Graph should have the dnr: Namespace"); Assert.False(h.IsEmpty, "Graph should not be empty"); Assert.True(h.NamespaceMap.HasNamespace("dnr"), "Graph should have the dnr: Namespace"); Assert.Equal(g, h); parser.Load(h, "graph_handler_tests_temp.ttl"); Assert.Equal(g.Triples.Count + 2, h.Triples.Count); Assert.NotEqual(g, h); NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in h.Triples.Where(x => !x.IsGroundTriple)) { Console.WriteLine(t.ToString(formatter)); } }
public void WritingNTriplesBlankNodeIDs1() { NTriplesFormatter formatter = new NTriplesFormatter(NTriplesSyntax.Original); Graph g = new Graph(); // Simple IDs which are valid in Original NTriples and RDF 1.1 NTriples IBlankNode b = g.CreateBlankNode("simple"); this.TestBNodeFormatting(b, formatter, "_:simple"); b = g.CreateBlankNode("simple1234"); this.TestBNodeFormatting(b, formatter, "_:simple1234"); // Complex IDs which are only valid in RDF 1.1 NTriples // When using Original syntax these should be rewritten b = g.CreateBlankNode("complex-dash"); this.TestBNodeFormatting(b, formatter, "_:autos1"); b = g.CreateBlankNode("complex_underscore"); this.TestBNodeFormatting(b, formatter, "_:autos2"); b = g.CreateBlankNode("complex.dot"); this.TestBNodeFormatting(b, formatter, "_:autos3"); b = g.CreateBlankNode("complex-dash_underscore.dot"); this.TestBNodeFormatting(b, formatter, "_:autos4"); b = g.CreateBlankNode("комплекс"); this.TestBNodeFormatting(b, formatter, "_:autos5"); }
public void ParsingUriLoaderDBPedia1() { if (!TestConfigManager.GetSettingAsBoolean(TestConfigManager.UseRemoteParsing)) { throw new SkipTestException("Test Config marks Remote Parsing as unavailable, test cannot be run"); } int defaultTimeout = Options.UriLoaderTimeout; try { Options.HttpDebugging = true; SetUriLoaderCaching(false); Options.UriLoaderTimeout = 45000; Graph g = new Graph(); UriLoader.Load(g, new Uri("http://dbpedia.org/resource/Barack_Obama")); NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in g.Triples) { Console.WriteLine(t.ToString(formatter)); } Assert.False(g.IsEmpty, "Graph should not be empty"); } finally { Options.HttpDebugging = false; SetUriLoaderCaching(true); Options.UriLoaderTimeout = defaultTimeout; } }
public void ParsingUsingGraphHandlerExplicitTest(String tempFile, IRdfReader parser, bool nsCheck) { Graph g = new Graph(); EmbeddedResourceLoader.Load(g, "VDS.RDF.Configuration.configuration.ttl"); g.SaveToFile(tempFile); Graph h = new Graph(); GraphHandler handler = new GraphHandler(h); parser.Load(handler, tempFile); NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in h.Triples) { Console.WriteLine(t.ToString(formatter)); } Assert.False(g.IsEmpty, "Graph should not be empty"); Assert.True(g.NamespaceMap.HasNamespace("dnr"), "Graph should have the dnr: Namespace"); Assert.False(h.IsEmpty, "Graph should not be empty"); if (nsCheck) { Assert.True(h.NamespaceMap.HasNamespace("dnr"), "Graph should have the dnr: Namespace"); } Assert.Equal(g, h); }
private void TestUpdate(IInMemoryQueryableStore store, IGraph expected, String update) { SparqlUpdateCommandSet cmds = this._updateParser.ParseFromString(update); LeviathanUpdateProcessor processor = new LeviathanUpdateProcessor(store); processor.ProcessCommandSet(cmds); Assert.True(store.HasGraph(null), "Store should have a default unnamed Graph"); IGraph result = store[null]; NTriplesFormatter formatter = new NTriplesFormatter(); Console.WriteLine("Result Data"); foreach (Triple t in result.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); Console.WriteLine("Expected Data"); foreach (Triple t in expected.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); Assert.Equal(expected, result); }
public void ServiceDescriptionOptionsRequestOnSparqlServer4() { EnsureIIS(); String server = TestConfigManager.GetSetting(TestConfigManager.LocalGraphStoreUpdateUri); Console.WriteLine("Making an OPTIONS request to the web demos SPARQL Server Update Endpoint at " + server); Console.WriteLine(); NTriplesFormatter formatter = new NTriplesFormatter(); HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(server); request.Method = "OPTIONS"; request.Accept = MimeTypesHelper.HttpAcceptHeader; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { IRdfReader parser = MimeTypesHelper.GetParser(response.ContentType); Graph g = new Graph(); parser.Load(g, new StreamReader(response.GetResponseStream())); TestTools.ShowGraph(g); Assert.IsFalse(g.IsEmpty, "A non-empty Service Description Graph should have been returned"); response.Close(); } }
public void EscapedSpacesInIrisMustNotBeDoubleEscaped2() { var formatter = new NTriplesFormatter(NTriplesSyntax.Rdf11); var formatOutput = formatter.FormatUri(new Uri("http://example.org/foo+bar")); formatOutput.Should().Be("http://example.org/foo+bar"); }
public void ParsingUriLoaderDBPedia() { int defaultTimeout = Options.UriLoaderTimeout; try { Options.HttpDebugging = true; Options.UriLoaderCaching = false; Options.UriLoaderTimeout = 45000; Graph g = new Graph(); UriLoader.Load(g, new Uri("http://dbpedia.org/resource/Barack_Obama")); NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in g.Triples) { Console.WriteLine(t.ToString(formatter)); } Assert.IsFalse(g.IsEmpty, "Graph should not be empty"); } finally { Options.HttpDebugging = false; Options.UriLoaderCaching = true; Options.UriLoaderTimeout = defaultTimeout; } }
public void ParsingGraphHandlerImplicitMerging() { Graph g = new Graph(); EmbeddedResourceLoader.Load(g, "VDS.RDF.Configuration.configuration.ttl"); g.SaveToFile("temp.ttl"); Graph h = new Graph(); TurtleParser parser = new TurtleParser(); parser.Load(h, "temp.ttl"); Assert.IsFalse(g.IsEmpty, "Graph should not be empty"); Assert.IsTrue(g.NamespaceMap.HasNamespace("dnr"), "Graph should have the dnr: Namespace"); Assert.IsFalse(h.IsEmpty, "Graph should not be empty"); Assert.IsTrue(h.NamespaceMap.HasNamespace("dnr"), "Graph should have the dnr: Namespace"); Assert.AreEqual(g, h, "Graphs should be equal"); parser.Load(h, "temp.ttl"); Assert.AreEqual(g.Triples.Count + 2, h.Triples.Count, "Triples count should now be 2 higher due to the merge which will have replicated the 2 triples containing Blank Nodes"); Assert.AreNotEqual(g, h, "Graphs should no longer be equal"); NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in h.Triples.Where(x => !x.IsGroundTriple)) { Console.WriteLine(t.ToString(formatter)); } }
public static void ShowGraph(IGraph g) { try { Console.Write("Graph URI: "); if (g.BaseUri != null) { Console.WriteLine(g.BaseUri.ToString()); } else { Console.WriteLine("NULL"); } Console.WriteLine(g.Triples.Count + " Triples"); NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in g.Triples.ToList()) { Console.WriteLine(t.ToString(formatter)); } } catch (ArgumentOutOfRangeException) { // Weird error that happens on the AppVeyor CI build Console.WriteLine("ArgumentOutOfRangeException raused while formatting RDF graph"); } }
public void ParsingRdfXmlEmptyStrings() { NTriplesFormatter formatter = new NTriplesFormatter(); RdfXmlParser domParser = new RdfXmlParser(RdfXmlParserMode.DOM); Graph g = new Graph(); domParser.Load(g, "resources\\empty-string-rdfxml.rdf"); Console.WriteLine("DOM Parser parsed OK"); foreach (Triple t in g.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); RdfXmlParser streamingParser = new RdfXmlParser(RdfXmlParserMode.Streaming); Graph h = new Graph(); streamingParser.Load(h, "resources\\empty-string-rdfxml.rdf"); Console.WriteLine("Streaming Parser parsed OK"); foreach (Triple t in h.Triples) { Console.WriteLine(t.ToString(formatter)); } Assert.AreEqual(g, h, "Graphs should be equal"); }
public void ParsingRdfXmlWithUrlEscapedNodes2() { //Originally submitted by Rob Styles as part of CORE-251, modified somewhat during debugging process NTriplesFormatter formatter = new NTriplesFormatter(); RdfXmlParser domParser = new RdfXmlParser(RdfXmlParserMode.DOM); Graph g = new Graph(); domParser.Load(g, "resources\\urlencodes-in-rdfxml.rdf"); foreach (Triple t in g.Triples) { Console.WriteLine(t.ToString(formatter)); } Uri encoded = new Uri("http://example.com/some%20encoded%2FUri"); Uri unencoded = new Uri("http://example.com/some encoded/Uri"); Assert.IsTrue(EqualityHelper.AreUrisEqual(encoded, unencoded), "URIs should be equivalent"); IUriNode encodedNode = g.GetUriNode(encoded); Assert.IsNotNull(encodedNode, "The encoded node should be returned by its encoded URI"); IUriNode unencodedNode = g.GetUriNode(unencoded); Assert.IsNotNull(unencodedNode, "The unencoded node should be returned by its unencoded URI"); IUriNode pred = g.CreateUriNode(new Uri("http://example.org/schema/encoded")); Assert.IsTrue(g.ContainsTriple(new Triple(encodedNode, pred, g.CreateLiteralNode("true"))), "The encoded node should have the property 'true' from the file"); Assert.IsTrue(g.ContainsTriple(new Triple(unencodedNode, pred, g.CreateLiteralNode("false"))), "The unencoded node should have the property 'false' from the file"); }
public void WritingNTriplesBlankNodeIDs2() { NTriplesFormatter formatter = new NTriplesFormatter(NTriplesSyntax.Rdf11); Graph g = new Graph(); // Simple IDs which are valid in Original NTriples and RDF 1.1 NTriples IBlankNode b = g.CreateBlankNode("simple"); this.TestBNodeFormatting(b, formatter, "_:simple"); b = g.CreateBlankNode("simple1234"); this.TestBNodeFormatting(b, formatter, "_:simple1234"); // Complex IDs which are only valid in RDF 1.1 NTriples // When using RDF 1.1 syntax these will be left as-is b = g.CreateBlankNode("complex-dash"); this.TestBNodeFormatting(b, formatter, "_:complex-dash"); b = g.CreateBlankNode("complex_underscore"); this.TestBNodeFormatting(b, formatter, "_:complex_underscore"); b = g.CreateBlankNode("complex.dot"); this.TestBNodeFormatting(b, formatter, "_:complex.dot"); b = g.CreateBlankNode("complex-dash_underscore.dot"); this.TestBNodeFormatting(b, formatter, "_:complex-dash_underscore.dot"); b = g.CreateBlankNode("комплекс"); this.TestBNodeFormatting(b, formatter, "_:комплекс"); }
public void WritingCollectionCompressionComplex2() { Graph g = new Graph(); g.LoadFromFile("resources\\complex-collections.nt"); CompressingTurtleWriterContext context = new CompressingTurtleWriterContext(g, Console.Out); WriterHelper.FindCollections(context); NTriplesFormatter formatter = new NTriplesFormatter(); foreach (KeyValuePair <INode, OutputRdfCollection> kvp in context.Collections) { _output.WriteLine("Collection Root - " + kvp.Key.ToString(formatter)); _output.WriteLine("Collection Triples (" + kvp.Value.Triples.Count + ")"); foreach (Triple t in kvp.Value.Triples) { _output.WriteLine(t.ToString(formatter)); } _output.WriteLine(""); } this.CheckCompressionRoundTrip(g); }
public void NonAsciiCharactersMustNotBeEscaped() { var formatter = new NTriplesFormatter(NTriplesSyntax.Rdf11); var formatOutput = formatter.FormatUri(new Uri("http://example.org/渋谷駅")); formatOutput.Should().Be("http://example.org/渋谷駅"); }
public void StorageStardogLoadNamedGraph() { StardogConnector stardog = StardogTests.GetConnection(); // Ensure graph exists Graph g = new Graph(); g.LoadFromEmbeddedResource("VDS.RDF.Configuration.configuration.ttl"); g.BaseUri = new Uri("http://example.org/graph"); stardog.SaveGraph(g); // Load it back from the store Graph h = new Graph(); stardog.LoadGraph(h, new Uri("http://example.org/graph")); NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in h.Triples) { Console.WriteLine(t.ToString(formatter)); } Assert.False(h.IsEmpty); Assert.Equal(g, h); }
public void EscapeSequenceInOriginalStringMustNotBeDoubleEscaped() { var formatter = new NTriplesFormatter(NTriplesSyntax.Rdf11); var formatOutput = formatter.FormatUri(new Uri("http://example.org/September%2C 2020")); formatOutput.Should().Be("http://example.org/September%2C%202020"); }
public void StorageVirtuosoLoadGraphWithNullHandler() { NTriplesFormatter formatter = new NTriplesFormatter(); VirtuosoManager manager = VirtuosoTest.GetConnection(); try { Assert.IsNotNull(manager); Console.WriteLine("Got the Virtuoso Manager OK"); //Add the Test Date to Virtuoso Graph testData = new Graph(); FileLoader.Load(testData, "resources\\Turtle.ttl"); testData.BaseUri = new Uri("http://example.org/virtuoso/tests/null"); manager.SaveGraph(testData); Console.WriteLine("Saved the Test Data to Virtuoso"); NullHandler handler = new NullHandler(); manager.LoadGraph(handler, testData.BaseUri); } finally { if (manager != null) { manager.Dispose(); } } }
public void IncompleteEscapeSequenceGetsEscaped(string input, string expected) { var formatter = new NTriplesFormatter(NTriplesSyntax.Rdf11); var formatOutput = formatter.FormatUri(new Uri(input)); formatOutput.Should().Be(expected); }
private void TestConstruct(IInMemoryQueryableStore store, IGraph expected, String query) { SparqlQuery q = this._parser.ParseFromString(query); LeviathanQueryProcessor processor = new LeviathanQueryProcessor(AsDataset(store)); Object results = processor.ProcessQuery(q); if (results is IGraph) { IGraph result = (IGraph)results; NTriplesFormatter formatter = new NTriplesFormatter(); Console.WriteLine("Result Data"); foreach (Triple t in result.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); Console.WriteLine("Expected Data"); foreach (Triple t in expected.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); Assert.Equal(expected, result); } else { Assert.True(false, "Did not get a Graph as expected"); } }
public void ServiceDescriptionOptionsRequestOnSparqlServer2() { EnsureIIS(); String path = TestConfigManager.GetSetting(TestConfigManager.LocalGraphStoreUri) + "some/long/path/elsewhere"; Console.WriteLine("Making an OPTIONS request to the web demos SPARQL Server at " + path); Console.WriteLine("This Test tries to ensure that the URI resolution works correctly"); Console.WriteLine(); NTriplesFormatter formatter = new NTriplesFormatter(); HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(path); request.Method = "OPTIONS"; request.Accept = MimeTypesHelper.HttpAcceptHeader; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { IRdfReader parser = MimeTypesHelper.GetParser(response.ContentType); Graph g = new Graph(); parser.Load(g, new StreamReader(response.GetResponseStream())); TestTools.ShowGraph(g); Assert.IsFalse(g.IsEmpty, "A non-empty Service Description Graph should have been returned"); response.Close(); } }
public static void ShowDifferences(GraphDiffReport report) { NTriplesFormatter formatter = new NTriplesFormatter(); if (report.AreEqual) { Console.WriteLine("Graphs are Equal"); Console.WriteLine(); Console.WriteLine("Blank Node Mapping between Graphs:"); foreach (KeyValuePair <INode, INode> kvp in report.Mapping) { Console.WriteLine(kvp.Key.ToString(formatter) + " => " + kvp.Value.ToString(formatter)); } } else { Console.WriteLine("Graphs are non-equal"); Console.WriteLine(); Console.WriteLine("Triples added to 1st Graph to give 2nd Graph:"); foreach (Triple t in report.AddedTriples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); Console.WriteLine("Triples removed from 1st Graph to given 2nd Graph:"); foreach (Triple t in report.RemovedTriples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); Console.WriteLine("Blank Node Mapping between Graphs:"); foreach (KeyValuePair <INode, INode> kvp in report.Mapping) { Console.WriteLine(kvp.Key.ToString(formatter) + " => " + kvp.Value.ToString(formatter)); } Console.WriteLine(); Console.WriteLine("MSGs added to 1st Graph to give 2nd Graph:"); foreach (IGraph msg in report.AddedMSGs) { Console.WriteLine(msg.Triples.Count + " Triple(s):"); foreach (Triple t in msg.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); } Console.WriteLine(); Console.WriteLine("MSGs removed from 1st Graph to give 2nd Graph:"); foreach (IGraph msg in report.RemovedMSGs) { Console.WriteLine(msg.Triples.Count + " Triple(s):"); foreach (Triple t in msg.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); } } }
public void PercentCharactersArePreservedInUriFormatting() { var formatter = new NTriplesFormatter(NTriplesSyntax.Rdf11); var u = new Uri("http://a.example/%66oo-bar"); var formatOutput = formatter.FormatUri(u); formatOutput.Should().Be("http://a.example/%66oo-bar"); }
public void WritingNTriplesVsTurtleNonAsciiCharsSpeed() { StringBuilder builder = new StringBuilder(); for (int i = 128; i <= 255; i++) { builder.Append((char)i); } INode n = new NodeFactory().CreateLiteralNode(builder.ToString()); const int repeatCount = 10000; // Write 10,000 times with NTriplesFormatter Stopwatch timer = new Stopwatch(); INodeFormatter formatter = new NTriplesFormatter(); System.IO.StringWriter strWriter = new System.IO.StringWriter(); timer.Start(); for (var i = 0; i < repeatCount; i++) { strWriter.WriteLine(formatter.Format(n)); } timer.Stop(); Console.WriteLine("NTriples Formatter Time Elapsed: " + timer.Elapsed); TimeSpan ntriplesTime = timer.Elapsed; timer.Reset(); // Write 10,000 times with NTriplesFormatter in RDF 1.1 mode formatter = new NTriplesFormatter(NTriplesSyntax.Rdf11); strWriter = new System.IO.StringWriter(); timer.Start(); for (var i = 0; i < repeatCount; i++) { strWriter.WriteLine(formatter.Format(n)); } timer.Stop(); Console.WriteLine("NTriples Formatter (RDF 1.1) Time Elapsed: " + timer.Elapsed); //TimeSpan ntriples11Time = timer.Elapsed; timer.Reset(); // Write and check round trip with Turtle and compare speed strWriter = new System.IO.StringWriter(); formatter = new UncompressedTurtleFormatter(); timer.Start(); for (var i = 0; i < repeatCount; i++) { strWriter.WriteLine(formatter.Format(n)); } timer.Stop(); Console.WriteLine("Turtle Write Time Elapsed: " + timer.Elapsed); TimeSpan turtleTime = timer.Elapsed; // Compare Speed Assert.IsTrue(turtleTime.CompareTo(ntriplesTime) == -1); }
public static void ShowMapping(GraphDiffReport report) { NTriplesFormatter formatter = new NTriplesFormatter(); Console.WriteLine("Blank Node Mapping between Graphs:"); foreach (KeyValuePair <INode, INode> kvp in report.Mapping) { Console.WriteLine(kvp.Key.ToString(formatter) + " => " + kvp.Value.ToString(formatter)); } }
private static string ConvertTriples(IEnumerable <IEntityQuad> removedQuads, INodeFactory factory) { var formatter = new NTriplesFormatter(); var quads = from quad in removedQuads let subject = quad.Subject.UnWrapNode(factory) let predicate = quad.Predicate.UnWrapNode(factory) let @object = quad.Object.UnWrapNode(factory) select new Triple(subject, predicate, @object).ToString(formatter); return(string.Join(Environment.NewLine, quads)); }
public void WritingSerializeOwnOneOfVeryLarge() { //Create the Graph for the Test and Generate a List of URIs Graph g = new Graph(); List <IUriNode> nodes = new List <IUriNode>(); for (int i = 1; i <= 10000; i++) { nodes.Add(g.CreateUriNode(new Uri("http://example.org/Class" + i))); } //Use the thingOneOf to generate the Triples thingOneOf(g, nodes.ToArray()); //Dump as NTriples to the Console NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in g.Triples) { Console.WriteLine(t.ToString(formatter)); } Console.WriteLine(); //Now try to save as RDF/XML IRdfWriter writer = new RdfXmlWriter(); writer.Save(g, "owl-one-of.rdf"); Console.WriteLine("Saved OK using RdfXmlWriter"); Console.WriteLine(); writer = new PrettyRdfXmlWriter(); ((ICompressingWriter)writer).CompressionLevel = WriterCompressionLevel.Medium; writer.Save(g, "owl-one-of-pretty.rdf"); Console.WriteLine("Saved OK using PrettyRdfXmlWriter"); Console.WriteLine(); //Now check that the Graphs are all equivalent Graph h = new Graph(); h.LoadFromFile("owl-one-of.rdf"); Assert.Equal(g, h); Console.WriteLine("RdfXmlWriter serialization was OK"); Console.WriteLine(); Graph j = new Graph(); j.LoadFromFile("owl-one-of-pretty.rdf"); Assert.Equal(g, j); Console.WriteLine("PrettyRdfXmlWriter serialization was OK"); }
public void ParsingGraphHandlerImplicitTurtle() { Graph g = new Graph(); EmbeddedResourceLoader.Load(g, "VDS.RDF.Configuration.configuration.ttl"); NTriplesFormatter formatter = new NTriplesFormatter(); foreach (Triple t in g.Triples) { Console.WriteLine(t.ToString(formatter)); } Assert.False(g.IsEmpty, "Graph should not be empty"); Assert.True(g.NamespaceMap.HasNamespace("dnr"), "Graph should have the dnr: Namespace"); }