Wgraph:Sample Genealogy 4

From FollowTheScore
Jump to: navigation, search

We separate data and graph definition completely

Although we have reached a lot, we still have our genealogy data 'buried' within the graph definition. It would be much better if we could reuse that data in another context. We should aim for an architecture where the the author of genealogy information does not "write" or "draw" a graph but simply "declares" or "describes" facts about relations between persons.

This would allow us to present genealogy data in different ways. One of these ways could be a Wgraph, another way of representation could be a table. We may even choose to have different Wgraphs on the same data base. Let's see how we can reach that goal.

  • We move the invocations of the 'person' template to a separate article on Wgraph:Genealogy Data.
  • The graph definition is reduced to a call of the basic graph property templates (layout strategy, node types, edge types etc.)

Now we have reached complete separation of semantics and layout.

{{#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 " 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}



}}

  {{Wgraph:Genealogy Graph}}
  {{Wgraph:Genealogy Data}}
  • But how can we get the flexibility to draw different graphs of the same data?
  • How can we represent our genealogy data as a table?
  • Did you have a look at the genealogy data article? Its HTML representation looks awful because the template produces WGL code instead of a more readable output.
continue with  Wgraph:Sample Genealogy 5 ..
back to        Wgraph:Sample Genealogy 3 ..