Re: [NTG-context] Genealogy and context

2021-03-03 Thread David van Diepen
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
___


Re: [NTG-context] Genealogy and context

2021-03-03 Thread Hans Hagen

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:


http://gramps-project.org/xml/1.7.1/grampsxml.dtd;>
http://gramps-project.org/xml/1.7.1/;>
   
 
 
 
   
   
   
   Birth
   
   
   
 
 
   Death
   
   
   
 
 
   Marriage
   
   
   
 
   
   
   
   F
   
 Catharina
 Geldof
   
   
   
   
 
  
   M
   
 Cornelis
 Geldof
   
   
   
   
   
   
 
 
   F
   
 Maatje
 de Voogd
   
   
   
   
   
   
 
   
   
 
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
 
  


\startbuffer[test]

http://gramps-project.org/xml/1.7.1/;>
  



  
  
  id="E1746">

  Birth
  
  
  

id="E1747">

  Death
  
  
  

id="E6977">

  Marriage
  
  
  

  
  
  id="I0987">

  F
  
Catharina
Geldof
  
  
  
  

 id="I0049">

  M
  
Cornelis
Geldof
  
  
  
  
  
  

id="I0050">

  F
  
Maatje
de Voogd
  
  
  
  
  
  

  
  
id="F0016">

  
  
  
  
  

 

\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
___


Re: [NTG-context] Genealogy and context

2021-03-01 Thread Henning Hraban Ramm

> Am 28.02.2021 um 19:32 schrieb David van Diepen :
> 
> 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
___


[NTG-context] Genealogy and context

2021-02-28 Thread David van Diepen
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:


http://gramps-project.org/xml/1.7.1/grampsxml.dtd;>
http://gramps-project.org/xml/1.7.1/;>
  



  
  
  
  Birth
  
  
  


  Death
  
  
  


  Marriage
  
  
  

  
 
  
  F
  
Catharina
Geldof
  
  
  
  
 
 
  M
  
Cornelis
Geldof
  
  
  
  
  
  


  F
  
Maatje
de Voogd
  
  
  
  
  
  
   
  
  

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  

 

___
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
___