ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Genealogy  and context
@ 2021-02-28 18:32 David van Diepen
  2021-03-01 18:41 ` Henning Hraban Ramm
  2021-03-03 14:16 ` Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: David van Diepen @ 2021-02-28 18:32 UTC (permalink / raw)
  To: ntg-context

Hello,

My son is very much interested in genealogy. He already has collected
information on thousands of people. Now it would be nice to be able to
present this information in the form of a book. There is a possibility
to have this done by a commercial service, however then it's not
possible to adapt the format or to insert custom text. Media can be
added but not in the way we like it.

Genealogical information is stored as structured data. I have added a
fragment of an Gramps XML file below. In such a file there are events,
people, families and other groupings of data and these are linked by
handles.

What we would like to produce is a book with a number of blocks on
every page describing a family: Father, mother, dates of birth and
death, date of marriage, occupations and children. It would also be
good it there are references to the grandparents. 

My question is: Where should I get started with a project in which a
document is generated automatically from data? As far as I know context
should be very suitable for this but I don't have any experience with
this. Until now I've used context to make documents without any data
being added automatically, except for the bibliography.  

Thank you in advance,

David van Diepen

Example Gramps XML file is below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE database PUBLIC "-//Gramps//DTD Gramps XML 1.7.1//EN"
"http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
<database xmlns="http://gramps-project.org/xml/1.7.1/">
  <header>
    <created date="2021-02-03" version="5.1.2"/>
    <researcher>
    </researcher>
  </header>
  <events>
      <event handle="_eaa1eb8157f4e812f219719a7b" change="1612382260"
id="E1746">
      <type>Birth</type>
      <dateval val="1886-05-01"/>
      <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
      <citationref hlink="_eaa1eb815867f8610a89cf6ce74"/>
    </event>
    <event handle="_eaa1eb8158f53693508394c0c48" change="1612382260"
id="E1747">
      <type>Death</type>
      <dateval val="1886-05-18"/>
      <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
      <citationref hlink="_eaa1eb815964a4157b91beb0bcb"/>
    </event>
    <event handle="_eaa1eb99c423cc862cf41d591a7" change="1612382270"
id="E6977">
      <type>Marriage</type>
      <dateval val="1883-03-11"/>
      <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
      <citationref hlink="_eaa1eb99c4870fe758b76275a86"/>
    </event>
  </events>
  <people>   
      <person handle="_eaa1eb8157e1aa01007c5a920d1" change="1612382260"
id="I0987">
      <gender>F</gender>
      <name type="Birth Name">
        <first>Catharina</first>
        <surname>Geldof</surname>
      </name>
      <eventref hlink="_eaa1eb8157f4e812f219719a7b" role="Primary"/>
      <eventref hlink="_eaa1eb8158f53693508394c0c48" role="Primary"/>
      <childof hlink="_eaa1eb79b3313e7e3c96019665c"/>
    </person> 
     <person handle="_eaa1eb7a37226ca41e414cd2f36" change="1612382258"
id="I0049">
      <gender>M</gender>
      <name type="Birth Name">
        <first>Cornelis</first>
        <surname>Geldof</surname>
      </name>
      <eventref hlink="_eaa1eb7a3735b3bd6acb1a5aa1c" role="Primary"/>
      <eventref hlink="_eaa1eb7a3831437df21bf3f6924" role="Primary"/>
      <eventref hlink="_eaa1eb7a3942a2fb185331a9edf" role="Primary"/>
      <childof hlink="_eaa1eb7a39a2dfce87e06b0adab"/>
      <parentin hlink="_eaa1eb79b3313e7e3c96019665c"/>
    </person>
    <person handle="_eaa1eb7a3a54ad77d5f29a821c9" change="1612382258"
id="I0050">
      <gender>F</gender>
      <name type="Birth Name">
        <first>Maatje</first>
        <surname>de Voogd</surname>
      </name>
      <eventref hlink="_eaa1eb7a3a731714abad9183560" role="Primary"/>
      <eventref hlink="_eaa1eb7a3b74da1e4ff36adcaab" role="Primary"/>
      <eventref hlink="_eaa1eb7a3c8685236291abfcbc9" role="Primary"/>
      <childof hlink="_eaa1eb7a3cd3853b21c39baab9a"/>
      <parentin hlink="_eaa1eb79b3313e7e3c96019665c"/>
    </person>   
  </people>
  <families>    
    <family handle="_eaa1eb79b3313e7e3c96019665c" change="1612382261"
id="F0016">
      <rel type="Married"/>
      <father hlink="_eaa1eb7a37226ca41e414cd2f36"/>
      <mother hlink="_eaa1eb7a3a54ad77d5f29a821c9"/>
      <eventref hlink="_eaa1eb99c423cc862cf41d591a7" role="Family"/>
      <childref hlink="_eaa1eb79b0b8526fca40e502ca"/>
      <childref hlink="_eaa1eb815521c4281a23ee688d2"/>
      <childref hlink="_eaa1eb8157e1aa01007c5a920d1"/>
      <childref hlink="_eaa1eb815a9647c05a8560739f3"/>
      <childref hlink="_eaa1eb815d632b4145a6a964cd1"/>
      <childref hlink="_eaa1eb81603107eb844e1d0a1ce"/>
      <childref hlink="_eaa1eb816306fa3946fe9a88f1b"/>
      <childref hlink="_eaa1eb81651258b725548dba1dc"/>
      <childref hlink="_eaa1eb8167243fc0ae5b90986c1"/>
      <childref hlink="_eaa1eb818cf2e229c88b97b192e"/>
      <childref hlink="_eaa1eb818ec579ca7141aa0efbe"/>
      <childref hlink="_eaa1eb8191314350b99ec3ade67"/>
    </family>
 </families>

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Genealogy  and context
  2021-02-28 18:32 Genealogy and context David van Diepen
@ 2021-03-01 18:41 ` Henning Hraban Ramm
  2021-03-03 14:16 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Henning Hraban Ramm @ 2021-03-01 18:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 28.02.2021 um 19:32 schrieb David van Diepen <david@diepenvan.nl>:
> 
> Genealogical information is stored as structured data. I have added a
> fragment of an Gramps XML file below. In such a file there are events,
> people, families and other groupings of data and these are linked by
> handles.
> 
> What we would like to produce is a book with a number of blocks on
> every page describing a family: Father, mother, dates of birth and
> death, date of marriage, occupations and children. It would also be
> good it there are references to the grandparents. 

Hi David,

I’m also using Gramps (for my personal family tree and for research for a historical novel), and I always wondered if it wouldn’t be possible to create nicer family trees and other charts using ConTeXt/MetaPost. But I still can’t handle XML in ConTeXt nor MetaPost myself.

I’d suggest to first create a sample layout to have a clear target – how would you like to present your data?

Since Gramps XML is not very straightforward (many crossreferences) it _might_ make sense to use a preprocessor (XSLT) and convert it to XML or Lua tables that you can use with the bibliography module.
I’m quite sure it’s possible to do it completely in ConTeXt/Lua, but if you’d like to have configurable output, you’d probably create something similar to the bib module.

I’m looking forward to what you will create! (And I think it would be an excellent topic for a talk at the ConTeXt meeting and/or an article in the ConTeXt journal!)

Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Genealogy and context
  2021-02-28 18:32 Genealogy and context David van Diepen
  2021-03-01 18:41 ` Henning Hraban Ramm
@ 2021-03-03 14:16 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2021-03-03 14:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users, David van Diepen

On 2/28/2021 7:32 PM, David van Diepen wrote:
> Hello,
> 
> My son is very much interested in genealogy. He already has collected
> information on thousands of people. Now it would be nice to be able to
> present this information in the form of a book. There is a possibility
> to have this done by a commercial service, however then it's not
> possible to adapt the format or to insert custom text. Media can be
> added but not in the way we like it.
> 
> Genealogical information is stored as structured data. I have added a
> fragment of an Gramps XML file below. In such a file there are events,
> people, families and other groupings of data and these are linked by
> handles.
> 
> What we would like to produce is a book with a number of blocks on
> every page describing a family: Father, mother, dates of birth and
> death, date of marriage, occupations and children. It would also be
> good it there are references to the grandparents.
> 
> My question is: Where should I get started with a project in which a
> document is generated automatically from data? As far as I know context
> should be very suitable for this but I don't have any experience with
> this. Until now I've used context to make documents without any data
> being added automatically, except for the bibliography.
> 
> Thank you in advance,
> 
> David van Diepen
> 
> Example Gramps XML file is below:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE database PUBLIC "-//Gramps//DTD Gramps XML 1.7.1//EN"
> "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
> <database xmlns="http://gramps-project.org/xml/1.7.1/">
>    <header>
>      <created date="2021-02-03" version="5.1.2"/>
>      <researcher>
>      </researcher>
>    </header>
>    <events>
>        <event handle="_eaa1eb8157f4e812f219719a7b" change="1612382260"
> id="E1746">
>        <type>Birth</type>
>        <dateval val="1886-05-01"/>
>        <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
>        <citationref hlink="_eaa1eb815867f8610a89cf6ce74"/>
>      </event>
>      <event handle="_eaa1eb8158f53693508394c0c48" change="1612382260"
> id="E1747">
>        <type>Death</type>
>        <dateval val="1886-05-18"/>
>        <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
>        <citationref hlink="_eaa1eb815964a4157b91beb0bcb"/>
>      </event>
>      <event handle="_eaa1eb99c423cc862cf41d591a7" change="1612382270"
> id="E6977">
>        <type>Marriage</type>
>        <dateval val="1883-03-11"/>
>        <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
>        <citationref hlink="_eaa1eb99c4870fe758b76275a86"/>
>      </event>
>    </events>
>    <people>
>        <person handle="_eaa1eb8157e1aa01007c5a920d1" change="1612382260"
> id="I0987">
>        <gender>F</gender>
>        <name type="Birth Name">
>          <first>Catharina</first>
>          <surname>Geldof</surname>
>        </name>
>        <eventref hlink="_eaa1eb8157f4e812f219719a7b" role="Primary"/>
>        <eventref hlink="_eaa1eb8158f53693508394c0c48" role="Primary"/>
>        <childof hlink="_eaa1eb79b3313e7e3c96019665c"/>
>      </person>
>       <person handle="_eaa1eb7a37226ca41e414cd2f36" change="1612382258"
> id="I0049">
>        <gender>M</gender>
>        <name type="Birth Name">
>          <first>Cornelis</first>
>          <surname>Geldof</surname>
>        </name>
>        <eventref hlink="_eaa1eb7a3735b3bd6acb1a5aa1c" role="Primary"/>
>        <eventref hlink="_eaa1eb7a3831437df21bf3f6924" role="Primary"/>
>        <eventref hlink="_eaa1eb7a3942a2fb185331a9edf" role="Primary"/>
>        <childof hlink="_eaa1eb7a39a2dfce87e06b0adab"/>
>        <parentin hlink="_eaa1eb79b3313e7e3c96019665c"/>
>      </person>
>      <person handle="_eaa1eb7a3a54ad77d5f29a821c9" change="1612382258"
> id="I0050">
>        <gender>F</gender>
>        <name type="Birth Name">
>          <first>Maatje</first>
>          <surname>de Voogd</surname>
>        </name>
>        <eventref hlink="_eaa1eb7a3a731714abad9183560" role="Primary"/>
>        <eventref hlink="_eaa1eb7a3b74da1e4ff36adcaab" role="Primary"/>
>        <eventref hlink="_eaa1eb7a3c8685236291abfcbc9" role="Primary"/>
>        <childof hlink="_eaa1eb7a3cd3853b21c39baab9a"/>
>        <parentin hlink="_eaa1eb79b3313e7e3c96019665c"/>
>      </person>
>    </people>
>    <families>
>      <family handle="_eaa1eb79b3313e7e3c96019665c" change="1612382261"
> id="F0016">
>        <rel type="Married"/>
>        <father hlink="_eaa1eb7a37226ca41e414cd2f36"/>
>        <mother hlink="_eaa1eb7a3a54ad77d5f29a821c9"/>
>        <eventref hlink="_eaa1eb99c423cc862cf41d591a7" role="Family"/>
>        <childref hlink="_eaa1eb79b0b8526fca40e502ca"/>
>        <childref hlink="_eaa1eb815521c4281a23ee688d2"/>
>        <childref hlink="_eaa1eb8157e1aa01007c5a920d1"/>
>        <childref hlink="_eaa1eb815a9647c05a8560739f3"/>
>        <childref hlink="_eaa1eb815d632b4145a6a964cd1"/>
>        <childref hlink="_eaa1eb81603107eb844e1d0a1ce"/>
>        <childref hlink="_eaa1eb816306fa3946fe9a88f1b"/>
>        <childref hlink="_eaa1eb81651258b725548dba1dc"/>
>        <childref hlink="_eaa1eb8167243fc0ae5b90986c1"/>
>        <childref hlink="_eaa1eb818cf2e229c88b97b192e"/>
>        <childref hlink="_eaa1eb818ec579ca7141aa0efbe"/>
>        <childref hlink="_eaa1eb8191314350b99ec3ade67"/>
>      </family>
>   </families>

\startbuffer[test]
<?xml version="1.0" encoding="UTF-8"?>
<database xmlns="http://gramps-project.org/xml/1.7.1/">
   <header>
     <created date="2021-02-03" version="5.1.2"/>
     <researcher>
     </researcher>
   </header>
   <events>
       <event handle="_eaa1eb8157f4e812f219719a7b" change="1612382260" 
id="E1746">
       <type>Birth</type>
       <dateval val="1886-05-01"/>
       <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
       <citationref hlink="_eaa1eb815867f8610a89cf6ce74"/>
     </event>
     <event handle="_eaa1eb8158f53693508394c0c48" change="1612382260" 
id="E1747">
       <type>Death</type>
       <dateval val="1886-05-18"/>
       <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
       <citationref hlink="_eaa1eb815964a4157b91beb0bcb"/>
     </event>
     <event handle="_eaa1eb99c423cc862cf41d591a7" change="1612382270" 
id="E6977">
       <type>Marriage</type>
       <dateval val="1883-03-11"/>
       <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
       <citationref hlink="_eaa1eb99c4870fe758b76275a86"/>
     </event>
   </events>
   <people>
       <person handle="_eaa1eb8157e1aa01007c5a920d1" change="1612382260" 
id="I0987">
       <gender>F</gender>
       <name type="Birth Name">
         <first>Catharina</first>
         <surname>Geldof</surname>
       </name>
       <eventref hlink="_eaa1eb8157f4e812f219719a7b" role="Primary"/>
       <eventref hlink="_eaa1eb8158f53693508394c0c48" role="Primary"/>
       <childof hlink="_eaa1eb79b3313e7e3c96019665c"/>
     </person>
      <person handle="_eaa1eb7a37226ca41e414cd2f36" change="1612382258" 
id="I0049">
       <gender>M</gender>
       <name type="Birth Name">
         <first>Cornelis</first>
         <surname>Geldof</surname>
       </name>
       <eventref hlink="_eaa1eb7a3735b3bd6acb1a5aa1c" role="Primary"/>
       <eventref hlink="_eaa1eb7a3831437df21bf3f6924" role="Primary"/>
       <eventref hlink="_eaa1eb7a3942a2fb185331a9edf" role="Primary"/>
       <childof hlink="_eaa1eb7a39a2dfce87e06b0adab"/>
       <parentin hlink="_eaa1eb79b3313e7e3c96019665c"/>
     </person>
     <person handle="_eaa1eb7a3a54ad77d5f29a821c9" change="1612382258" 
id="I0050">
       <gender>F</gender>
       <name type="Birth Name">
         <first>Maatje</first>
         <surname>de Voogd</surname>
       </name>
       <eventref hlink="_eaa1eb7a3a731714abad9183560" role="Primary"/>
       <eventref hlink="_eaa1eb7a3b74da1e4ff36adcaab" role="Primary"/>
       <eventref hlink="_eaa1eb7a3c8685236291abfcbc9" role="Primary"/>
       <childof hlink="_eaa1eb7a3cd3853b21c39baab9a"/>
       <parentin hlink="_eaa1eb79b3313e7e3c96019665c"/>
     </person>
   </people>
   <families>
     <family handle="_eaa1eb79b3313e7e3c96019665c" change="1612382261" 
id="F0016">
       <rel type="Married"/>
       <father hlink="_eaa1eb7a37226ca41e414cd2f36"/>
       <mother hlink="_eaa1eb7a3a54ad77d5f29a821c9"/>
       <eventref hlink="_eaa1eb99c423cc862cf41d591a7" role="Family"/>
       <childref hlink="_eaa1eb8157e1aa01007c5a920d1"/>
     </family>
  </families>
</database>
\stopbuffer

%  mapping

\startxmlsetups xml:mysetups
     \xmlsetsetup{#1}{database|families|family|person|childref}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:mysetups}

\startxmlsetups xml:database
     \xmlfirst{#1}{/families}
\stopxmlsetups

\startxmlsetups xml:families
     \xmlall{#1}{/family}
\stopxmlsetups

\startxmlsetups xml:person
     \starttabulate[|||]
         \BC name    \NC \xmlfirst{#1}{name/first/text()} \NC \NR
         \BC surname \NC \xmlfirst{#1}{name/surname/text()} \NC \NR
         \BC gender  \NC \xmlfirst{#1}{gender} \NC \NR
     \stoptabulate
\stopxmlsetups

\startxmlsetups xml:childref
%     \startsubsubject[title=Child]
 
\xmlfirst{main}{/database/people/person[@handle='\xmlatt{#1}{hlink}']}
%     \stopsubsubject
\stopxmlsetups

\startxmlsetups xml:family
     \xmldoif {#1}{/father} {
         \startsubject[title=Father]
 
\xmlfirst{main}{/database/people/person[@handle='\xmlattribute{#1}{/father}{hlink}']}
         \stopsubject
     }
     \xmldoif {#1}{/mother} {
         \startsubject[title=Mother]
 
\xmlfirst{main}{/database/people/person[@handle='\xmlattribute{#1}{/mother}{hlink}']}
         \stopsubject
     }
     \xmldoif {#1}{/childref} {
         \startsubject[title=Children]
             \xmlall{#1}{/childref}
         \stopsubject
     }
\stopxmlsetups

\starttext
%     \xmlprocess{main}{somefile.xml}{}
     \xmlprocessbuffer{main}{test}{}
\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Genealogy  and context
@ 2021-03-03 15:33 David van Diepen
  0 siblings, 0 replies; 4+ messages in thread
From: David van Diepen @ 2021-03-03 15:33 UTC (permalink / raw)
  To: ntg-context

Hello Hraban and Hans,

Thank you Hraban for your enthusiasm. Very nice to hear that this might
be useful for other people too, I was kind of hoping that actually. As
soon as I have some results I'll share them with you, we might be able
to collaborate. 

Thank you Hans for making this working piece of code, that's great!
That will get me started allright.

Kind regards, David

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-03 15:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-28 18:32 Genealogy and context David van Diepen
2021-03-01 18:41 ` Henning Hraban Ramm
2021-03-03 14:16 ` Hans Hagen
2021-03-03 15:33 David van Diepen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).