Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 2
0
        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();
                }
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 /// <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));
 }