Wgraph:Sample Genealogy 5

From FollowTheScore
Revision as of 20:54, 17 October 2009 by Gero (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

We use DPL and different sets of templates

The trick is to use three different sets of templates.

  • The first (basic) set of templates produces a nice, readable representation.
  • The second set produces a text line which can be used as a table row
  • The third set of templates produces WGL code.

Obviously now the semantics of our knowledge is fully in the focus. Producing some kind of listing -- be it tabular or graphical -- becomes a side aspect. Therefore it is quite natural to


  • We put our data into a new article, Wgraph:Dynasty Smith 1 in our example. This article is much more readable than our previous attempt. When viewing this document the first set of templates is used. The document will probably contain additional data or pictures beyond the basic facts which are contained in the template call.
  • We create a table with the help of DPL. We select some or all Dynasty articles, pick the template calls to 'Person' and replace these calls by alternate calls to Wgraph:Person.tab. Template substitution is one of DPL´s strengths, so this is fairly easy. The table can contain all fields which are used in the template call or only a subset of them.
  • We create the graph by embedding a similar DPL statement into the body of our wgraph call. Again it is up to the "WGL template" which parameter it is interested in. It will only take those parameters which are needed for building the graph. The "WGL template" creates a graph definition which still has a high level of abstraction. Therefore it is possible to make changes to the graph by simply adding WGL statements before or after the DPL invocation. To demonstrate this effec we skipped the comment boxes and changed the orientation of the graph.

That's all.

And here we go:

Dynasty data in its normal view

Have a look at the article about Wgraph:Dynasty Smith 1. Except that the template names have changed to Wgraph:Person its editable contents is the same as before.

Dynasty data in tabular representation

Person born died father mother married to info
John Smith 21.06.1952 Bella Smith 01.03.1985 that & this
Bella Smith 03.04.1955 this and that
Dave Smith 30.05.1986 John Smith Bella Smith
Paul Smith 28.02.1988 John Smith Bella Smith
Susan Smith 04.06.1995 John Smith Bella Smith

The table was generated by the following DPL script:

<dpl>
  category = Dynasty
  namespace=Wgraph
  noresultsheader= --- no dynasty data found. ---
  titlematch = % Smith 1
  mode=userformat
  include={Wgraph:Person}.tab
  listseparators=\n{|class=sortable\n!Person\n!born\n!died\n!father\n!mother\n!married to\n!info\n|-,\n,,\n|}
  secseparators=\n
  multisecseparators=\n
</dpl>

Dynasty data in graphical representation

{{#wgraph: svg | thumb = 40 |

   nodetype male    { shape box color #ddddff bordercolor #9999ff width 140 textwidth 20 }
 nodetype female  { shape box color #ffdddd bordercolor #ff9999 width 140 textwidth 20 }
 edgetype father   { color #7777ff backarrowsize 10 backarrowstyle solid arrowsize 0 }
 edgetype mother   { color #ff7777 backarrowsize 10 backarrowstyle solid arrowsize 0 }
 edgetype marriage { kind rightnear arrowstyle line  backarrowstyle line backarrowsize 10 color #ff77ff }
 nodetype info     { color #f0f0f0 borderstyle dashed bordercolor #e0e0e0 }
 edgetype info     { kind near arrowstyle none linestyle dotted color lightgray }
 nodetype 'undefined node' { bordercolor red 
                          // label '%%?' 
 }
 orientation bottom_to_top
 splines yes


   node " John Smith      "  { 

type male label " John Smith " "\n*" "21.06.1952"

 }


edge from " John Smith " to " John Smith " "_info" { type info }

 node " John Smith      " "_info" { type info label "that & this" }

edge from " John Smith " to "Bella Smith" {type marriage label "01.03.1985" }

 node " Bella Smith     "  { 

type female label " Bella Smith " "\n*" "03.04.1955"

 }


edge from " Bella Smith " to " Bella Smith " "_info" { type info }

 node " Bella Smith     " "_info" { type info label "this and that" }
 node " Dave Smith      "  { 

type male label " Dave Smith " "\n*" "30.05.1986"

 }

edge from " Dave Smith " to "Bella Smith" {type mother} edge from " Dave Smith " to "John Smith" {type father}


 node " Paul Smith      "  { 

type male label " Paul Smith " "\n*" "28.02.1988"

 }

edge from " Paul Smith " to "Bella Smith" {type mother} edge from " Paul Smith " to "John Smith" {type father}


 node " Susan Smith     "  { 

type female label " Susan Smith " "\n*" "04.06.1995"

 }

edge from " Susan Smith " to "Bella Smith" {type mother} edge from " Susan Smith " to "John Smith" {type father}


 skip_edgetypes info
 orientation    left_to_right

}}

The graph was generated by the following combination of wgraph and DPL:

{{#wgraph: svg | thumb = 40 |
  {{Wgraph:Genealogy Graph}}
  {{#dpl:
   | category = Dynasty
   | namespace= Wgraph
   | titlematch = % Smith 1
   | noresultsheader= node x {label "--- no dynasty data found. ---"}
   | mode=userformat
   | include={Wgraph:Person}.wgl
  }}
  skip_edgetypes info
  orientation    left_to_right
}}
continue with  Wgraph:Sample Genealogy 6 ..
back to        Wgraph:Sample Genealogy 4 ..