DOT file for Graphviz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

DOT file for Graphviz

Graham Chiu
Hi

Is the DOT file for Graphviz generated from creating a Relationship Graph saved anywhere?  I'm using Windows64 very latest version of Gramps.

Also, I'm wanting to add more data to the graph.
Where on github is the query from sqlite that generates the data that is then used to create the DOT file.

Thanks,

--
Graham Chiu


_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: DOT file for Graphviz

prculley
If you select "Graphviz file" as the report type, the DOT file is the saved format.


Note that Gramps has quite a bit of software between the graph code in my link and the sqlite queries.  The graphing code deals with Gramps objects and uses the db code to convert calls for these objects these to sqlite requests.  And the sqlite results are further processed back to Gramps objects for the graphing code.  And we have code between the graph code and the Graphviz input code.

Without knowing a bit more about what you are wanting to add, I don't know what else to say...

Paul C.

On Sun, Nov 24, 2019 at 11:49 PM Graham Chiu <[hidden email]> wrote:
Hi

Is the DOT file for Graphviz generated from creating a Relationship Graph saved anywhere?  I'm using Windows64 very latest version of Gramps.

Also, I'm wanting to add more data to the graph.
Where on github is the query from sqlite that generates the data that is then used to create the DOT file.

Thanks,

--
Graham Chiu
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel


_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: DOT file for Graphviz

Graham Chiu
What I want to do is create a custom graph.  I have Chinese names placed into the AKA field, and I want these to appear as part of the label.
Without doing any DB calls I see I can parse the GED file and change the DOT (.gv) file, and then call graphviz to do produce the descendant graph I want.
It would be nice to have that option in the Relationship Graph/Include options but I can do it this way for the moment.

I don't know if it's a bug or not, but for relatives that don't have anglo names I created names in Pinyin using an online Chinese to Pinyin converter.
These names display as expected in Gramps, but the GV file doesn't show the Pinyin font correctly.

Eg, Lián appears as Lián in the GV report file.


On Tue, 26 Nov 2019 at 06:59, Paul Culley <[hidden email]> wrote:
If you select "Graphviz file" as the report type, the DOT file is the saved format.


Note that Gramps has quite a bit of software between the graph code in my link and the sqlite queries.  The graphing code deals with Gramps objects and uses the db code to convert calls for these objects these to sqlite requests.  And the sqlite results are further processed back to Gramps objects for the graphing code.  And we have code between the graph code and the Graphviz input code.

Without knowing a bit more about what you are wanting to add, I don't know what else to say...

Paul C.

On Sun, Nov 24, 2019 at 11:49 PM Graham Chiu <[hidden email]> wrote:
Hi

Is the DOT file for Graphviz generated from creating a Relationship Graph saved anywhere?  I'm using Windows64 very latest version of Gramps.

Also, I'm wanting to add more data to the graph.
Where on github is the query from sqlite that generates the data that is then used to create the DOT file.

Thanks,

--
Graham Chiu
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel


--
Graham Chiu


_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: DOT file for Graphviz

prculley
The .gv files are written in utf-8, so if the program you are viewing them with doesn't recognize this correctly the names might display incorrectly.  I use notepad++ myself, which seems to work for ok.

I assume you know some Python, otherwise this will not be enough...

To modify the label for a person, you will want to start about line 619 in gvrelgraph.py.  The 'person' object has alternate names attached.  You will want to look for the AKA type name.

aka_name = None
for a_name in person.get_alternate_names:
    if a_name.type == NameType.AKA:
        aka_name = self._name_display.display_name(a_name)
        break
   
Then you can format the final p_name as desired from the main p_name (from the original code) and the aka_name (if it is not None).

Paul C.

On Mon, Nov 25, 2019 at 2:31 PM Graham Chiu <[hidden email]> wrote:
What I want to do is create a custom graph.  I have Chinese names placed into the AKA field, and I want these to appear as part of the label.
Without doing any DB calls I see I can parse the GED file and change the DOT (.gv) file, and then call graphviz to do produce the descendant graph I want.
It would be nice to have that option in the Relationship Graph/Include options but I can do it this way for the moment.

I don't know if it's a bug or not, but for relatives that don't have anglo names I created names in Pinyin using an online Chinese to Pinyin converter.
These names display as expected in Gramps, but the GV file doesn't show the Pinyin font correctly.

Eg, Lián appears as Lián in the GV report file.


On Tue, 26 Nov 2019 at 06:59, Paul Culley <[hidden email]> wrote:
If you select "Graphviz file" as the report type, the DOT file is the saved format.


Note that Gramps has quite a bit of software between the graph code in my link and the sqlite queries.  The graphing code deals with Gramps objects and uses the db code to convert calls for these objects these to sqlite requests.  And the sqlite results are further processed back to Gramps objects for the graphing code.  And we have code between the graph code and the Graphviz input code.

Without knowing a bit more about what you are wanting to add, I don't know what else to say...

Paul C.

On Sun, Nov 24, 2019 at 11:49 PM Graham Chiu <[hidden email]> wrote:
Hi

Is the DOT file for Graphviz generated from creating a Relationship Graph saved anywhere?  I'm using Windows64 very latest version of Gramps.

Also, I'm wanting to add more data to the graph.
Where on github is the query from sqlite that generates the data that is then used to create the DOT file.

Thanks,

--
Graham Chiu
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel


--
Graham Chiu


_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: DOT file for Graphviz

Graham Chiu
Thanks for the python code. I don't know python but it looks self explanatory.

I'm reading the GV file using Sublime Text.  The pinyin appears correctly in the GED file but it's incorrect in the GV file so I guess it may be a bug in that particular report code.
The accented characters appear correctly if I chose PNG image as output instead of Graphviz File.

On Tue, 26 Nov 2019 at 11:58, Paul Culley <[hidden email]> wrote:
The .gv files are written in utf-8, so if the program you are viewing them with doesn't recognize this correctly the names might display incorrectly.  I use notepad++ myself, which seems to work for ok.

I assume you know some Python, otherwise this will not be enough...

To modify the label for a person, you will want to start about line 619 in gvrelgraph.py.  The 'person' object has alternate names attached.  You will want to look for the AKA type name.

aka_name = None
for a_name in person.get_alternate_names:
    if a_name.type == NameType.AKA:
        aka_name = self._name_display.display_name(a_name)
        break
   
Then you can format the final p_name as desired from the main p_name (from the original code) and the aka_name (if it is not None).

Paul C.

On Mon, Nov 25, 2019 at 2:31 PM Graham Chiu <[hidden email]> wrote:
What I want to do is create a custom graph.  I have Chinese names placed into the AKA field, and I want these to appear as part of the label.
Without doing any DB calls I see I can parse the GED file and change the DOT (.gv) file, and then call graphviz to do produce the descendant graph I want.
It would be nice to have that option in the Relationship Graph/Include options but I can do it this way for the moment.

I don't know if it's a bug or not, but for relatives that don't have anglo names I created names in Pinyin using an online Chinese to Pinyin converter.
These names display as expected in Gramps, but the GV file doesn't show the Pinyin font correctly.

Eg, Lián appears as Lián in the GV report file.


On Tue, 26 Nov 2019 at 06:59, Paul Culley <[hidden email]> wrote:
If you select "Graphviz file" as the report type, the DOT file is the saved format.


Note that Gramps has quite a bit of software between the graph code in my link and the sqlite queries.  The graphing code deals with Gramps objects and uses the db code to convert calls for these objects these to sqlite requests.  And the sqlite results are further processed back to Gramps objects for the graphing code.  And we have code between the graph code and the Graphviz input code.

Without knowing a bit more about what you are wanting to add, I don't know what else to say...

Paul C.

On Sun, Nov 24, 2019 at 11:49 PM Graham Chiu <[hidden email]> wrote:
Hi

Is the DOT file for Graphviz generated from creating a Relationship Graph saved anywhere?  I'm using Windows64 very latest version of Gramps.

Also, I'm wanting to add more data to the graph.
Where on github is the query from sqlite that generates the data that is then used to create the DOT file.

Thanks,

--
Graham Chiu
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel


--
Graham Chiu


--
Graham Chiu


_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: DOT file for Graphviz

Graham Chiu
The accented characters issue has disappeared now.  Bizarre.  So, I won't file a bug report since I can no longer reproduce it.

I've managed to sort out the addition of the AKA names to the Graphviz file by pulling out the identities exported to gedcom file, and then inserting the AKA into the Graphviz label.
It's not wonderful as I can't generate a PDF file with the Chinese characters displayed correctly and have to use SVG.  I guess it's a missing font issue.

On Tue, 26 Nov 2019 at 13:10, Graham Chiu <[hidden email]> wrote:
Thanks for the python code. I don't know python but it looks self explanatory.

I'm reading the GV file using Sublime Text.  The pinyin appears correctly in the GED file but it's incorrect in the GV file so I guess it may be a bug in that particular report code.
The accented characters appear correctly if I chose PNG image as output instead of Graphviz File.

On Tue, 26 Nov 2019 at 11:58, Paul Culley <[hidden email]> wrote:
The .gv files are written in utf-8, so if the program you are viewing them with doesn't recognize this correctly the names might display incorrectly.  I use notepad++ myself, which seems to work for ok.

I assume you know some Python, otherwise this will not be enough...

To modify the label for a person, you will want to start about line 619 in gvrelgraph.py.  The 'person' object has alternate names attached.  You will want to look for the AKA type name.

aka_name = None
for a_name in person.get_alternate_names:
    if a_name.type == NameType.AKA:
        aka_name = self._name_display.display_name(a_name)
        break
   
Then you can format the final p_name as desired from the main p_name (from the original code) and the aka_name (if it is not None).

Paul C.

On Mon, Nov 25, 2019 at 2:31 PM Graham Chiu <[hidden email]> wrote:
What I want to do is create a custom graph.  I have Chinese names placed into the AKA field, and I want these to appear as part of the label.
Without doing any DB calls I see I can parse the GED file and change the DOT (.gv) file, and then call graphviz to do produce the descendant graph I want.
It would be nice to have that option in the Relationship Graph/Include options but I can do it this way for the moment.

I don't know if it's a bug or not, but for relatives that don't have anglo names I created names in Pinyin using an online Chinese to Pinyin converter.
These names display as expected in Gramps, but the GV file doesn't show the Pinyin font correctly.

Eg, Lián appears as Lián in the GV report file.


On Tue, 26 Nov 2019 at 06:59, Paul Culley <[hidden email]> wrote:
If you select "Graphviz file" as the report type, the DOT file is the saved format.


Note that Gramps has quite a bit of software between the graph code in my link and the sqlite queries.  The graphing code deals with Gramps objects and uses the db code to convert calls for these objects these to sqlite requests.  And the sqlite results are further processed back to Gramps objects for the graphing code.  And we have code between the graph code and the Graphviz input code.

Without knowing a bit more about what you are wanting to add, I don't know what else to say...

Paul C.

On Sun, Nov 24, 2019 at 11:49 PM Graham Chiu <[hidden email]> wrote:
Hi

Is the DOT file for Graphviz generated from creating a Relationship Graph saved anywhere?  I'm using Windows64 very latest version of Gramps.

Also, I'm wanting to add more data to the graph.
Where on github is the query from sqlite that generates the data that is then used to create the DOT file.

Thanks,

--
Graham Chiu
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel


--
Graham Chiu


--
Graham Chiu


--
Graham Chiu


_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel