How can I use GraphVizWriter in dotNetRDF library?

284 views Asked by At

I want to know what syntax should I write to use GraphVizWriter to show my graph in a png format ?

I use dotNetRDF library.

private void button1_Click(object sender, EventArgs e)
    {

        Stream myStream = null;

        var parser = new Notation3Parser();
        var graph = new Graph();
        OpenFileDialog openFileDialog1 = new OpenFileDialog();
        openFileDialog1.Filter = "RDF files (*.n3)|*.n3";
        openFileDialog1.FilterIndex = 1;
        openFileDialog1.RestoreDirectory = true;
        openFileDialog1.Multiselect = false;

        if (openFileDialog1.ShowDialog() == DialogResult.OK)
        {
            try
            {
                if ((myStream = openFileDialog1.OpenFile()) != null)
                {
                    using (myStream)
                    {
                        string s = openFileDialog1.FileName.ToString();
                        string w= Directory.GetCurrentDirectory().ToString();
                        string Fname = openFileDialog1.SafeFileName.ToString();
                        File.Copy(s,Path.Combine(w,Fname),true);
                        Win32.AllocConsole();
                        s1 = Path.Combine(w, Fname);

                        showPath.Text = s1;
                        String parentvalueadress = this.s1;
                        showPath.Visible = true;
                        insertNodeButton.Visible = true;
                        delBut.Visible = true;


                        showNodes showNodes1 = new showNodes(s1);
                        g = showNodes1.returngraph();

                       Console.Read();
                       Win32.FreeConsole();


                       this.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
            }
        }

    }

first i read an n3 file format and then i wand to show my graph graphicaly

1

There are 1 answers

4
marapet On

It doesn't look like dotNetRDF produces png output directly. The mentioned class outputs dot files.

From the documentation of the library:

A Writer which generates GraphViz DOT Format files from an RDF Graph

You'd have to take the output and generate an actual image using Graphviz.