ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	David van Diepen <david@diepenvan.nl>
Subject: Re: Genealogy and context
Date: Wed, 3 Mar 2021 15:16:26 +0100	[thread overview]
Message-ID: <5f08a391-fb42-157b-9b8e-0735758d1bb9@xs4all.nl> (raw)
In-Reply-To: <704bd1f681a0f83115894bae8524460488f65160.camel@diepenvan.nl>

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
___________________________________________________________________________________

  parent reply	other threads:[~2021-03-03 14:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28 18:32 David van Diepen
2021-03-01 18:41 ` Henning Hraban Ramm
2021-03-03 14:16 ` Hans Hagen [this message]
2021-03-03 15:33 David van Diepen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5f08a391-fb42-157b-9b8e-0735758d1bb9@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=david@diepenvan.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).