-1

GraphVizWriter を使用してグラフを png 形式で表示するには、どの構文を記述すればよいか知りたいですか?

dotNetRDF ライブラリを使用します。

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);
            }
        }

    }

最初に n3 ファイル形式を読み取り、次にグラフをグラフィカルに表示したい

4

1 に答える 1

1

dotNetRDF が png 出力を直接生成するようには見えません。上記のクラスは、ドット ファイルを出力します。

ライブラリのドキュメントから:

RDF グラフから GraphViz DOT 形式のファイルを生成するライター

出力を取得し、 Graphvizを使用して実際の画像を生成する必要があります。

于 2011-10-17T11:44:31.973 に答える