Wgraph:Sample Genealogy 5

From FollowTheScore
Revision as of 13:52, 21 July 2007 by Gero (talk | contribs)
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 Scholz 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 Scholz 1. Except that the template names have changed to Wgraph:Person its editable contents is the same as before.

Dynasty data in tabular representation

--- no dynasty data found. ---

The table was generated by the following DPL script:

<dpl>
  category = Dynasty
  namespace=Wgraph
  noresultsheader= --- no dynasty data found. ---
  titlematch = % Scholz 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 x {label "--- no dynasty data found. ---"}
 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 = % Scholz 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 ..