/// <summary> /// Handles Triples by writing them using the underlying formatter /// </summary> /// <param name="t">Triple</param> /// <returns></returns> protected override bool HandleTripleInternal(Triple t) { _written++; _writer.WriteLine(_formatter.Format(t)); if (_written >= FlushInterval) { _written = 0; _writer.Flush(); } return(true); }
private void EnsureTestData(int triples, String file, ITripleFormatter formatter) { if (!File.Exists(file)) { Graph g = new Graph(); g.NamespaceMap.AddNamespace(String.Empty, new Uri("http://example.org/node#")); int padding = triples.ToString().Length; using (StreamWriter writer = new StreamWriter(file)) { for (int i = 1; i <= triples; i++) { IUriNode temp = g.CreateUriNode(":" + i); writer.WriteLine(formatter.Format(new Triple(temp, temp, temp))); } writer.Close(); } } }
private void EnsureTestData(int triples, String file, ITripleFormatter formatter) { if (!File.Exists(file)) { Graph g = new Graph(); g.NamespaceMap.AddNamespace(String.Empty, new Uri("http://example.org/node#")); int padding = triples.ToString().Length; using (StreamWriter writer = new StreamWriter(File.OpenWrite(file))) { for (int i = 1; i <= triples; i++) { IUriNode temp = g.CreateUriNode(":" + i); writer.WriteLine(formatter.Format(new Triple(temp, temp, temp))); } writer.Close(); } } //Force a GC prior to each of these tests GC.GetTotalMemory(true); }
/// <summary> /// Gets the String representation of a Triple using the given Triple Formatter. /// </summary> /// <param name="formatter">Formatter.</param> /// <returns></returns> public string ToString(ITripleFormatter formatter) { return(formatter.Format(this)); }