Wgraph:Sample Genealogy 3

From FollowTheScore
Revision as of 12:31, 21 July 2007 by Gero (talk | contribs) (New page: == We add a "semantic template" which hides the wgraph layout syntax completely == Can we go any further in our search for abstraction? Yes, we can put the semantics of genealogy in foreg...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

We add a "semantic template" which hides the wgraph layout syntax completely

Can we go any further in our search for abstraction? Yes, we can put the semantics of genealogy in foreground instead of the graphical aspect. This will open new doors. So our next step is to define a template which carries the semantics of the application domain.

  • In our example this means to define a genealogy template for a person which expects parameters like 'father' and 'mother'.
  • As not all parameters may be filled we have to take care for such situations.
  • Authors using the person template may add spaces and line breaks in the template call. We do not want to see these whitespace characters in the graph. WGL´s mechanism of string concatenation and white space stripping is quite helpful in this regard.

Now the source for our graph begins to look really nice:

{{#wgraph: svg | thumb = 80 |

   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 " Gero Scholz  
  "  { type  male
    label " Gero Scholz  
  " "\n*" "24.09.1956" }


edge from " Gero Scholz

  " to " Gero Scholz  
  " "_info" { type info }
 node " Gero Scholz  
  " "_info" { type info label "that & this" }

edge from " Gero Scholz

  " to "Rosa Scholz" {type marriage label "02.01.1987" }
 node " Rosa Scholz     "  { type female  label " Rosa Scholz     " "\n*" "05.07.1949" }


edge from " Rosa Scholz " to " Rosa Scholz " "_info" { type info }

 node " Rosa Scholz     " "_info" { type info label "this and that" }


 node " Bernhard Scholz "  { type male    label " Bernhard Scholz " "\n*" "31.07.1987" }

edge from " Bernhard Scholz " to "Rosa Scholz" {type mother} edge from " Bernhard Scholz " to "Gero Scholz" {type father}


 node " Andreas Scholz  "  { type male    label " Andreas Scholz  " "\n*" "18.01.1989" }

edge from " Andreas Scholz " to "Rosa Scholz" {type mother} edge from " Andreas Scholz " to "Gero Scholz" {type father}


 node " Lena Scholz     "  { type female  label " Lena Scholz     " "\n*" "14.03.1994" }

edge from " Lena Scholz " to "Rosa Scholz" {type mother} edge from " Lena Scholz " to "Gero Scholz" {type father}


}}

  {{Wgraph:Genealogy Graph}}
  {{Wgraph:Genealogy Person
   | Gero Scholz  
   | male
   | born = 24.09.1956
   | info = some additional information
   | married to = Rosa Scholz
   | marriage=02.01.1987
  }}
  {{Wgraph:Genealogy Person| Rosa Scholz     |female|born=05.07.1949|info=some additional information}}
  {{Wgraph:Genealogy Person| Bernhard Scholz |male  |born=31.07.1987|father=Gero Scholz|mother=Rosa Scholz}}
  {{Wgraph:Genealogy Person| Andreas Scholz  |male  |born=18.01.1989|father=Gero Scholz|mother=Rosa Scholz}}
  {{Wgraph:Genealogy Person| Lena Scholz     |female|born=14.03.1994|father=Gero Scholz|mother=Rosa Scholz}}
}}
continue with  Wgraph:Sample Genealogy 4 ..
back to        Wgraph:Sample Genealogy 2 ..