Difference between revisions of "Wgraph:Sample Genealogy 3"

From FollowTheScore
Jump to: navigation, search
(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...)
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== We add a "semantic template" which hides the wgraph layout syntax completely ==
+
== We add a "semantic template" which hides ''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'''.  
 
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'''.  
Line 12: Line 12:
 
   {{Wgraph:Genealogy Graph}}
 
   {{Wgraph:Genealogy Graph}}
 
   {{Wgraph:Genealogy Person
 
   {{Wgraph:Genealogy Person
   | Gero Scholz  
+
   | John Smith  
 
   | male
 
   | male
   | born = 24.09.1956
+
   | born = 21.06.1952
 
   | info = that & this
 
   | info = that & this
   | married to = Rosa Scholz
+
   | married to = Bella Smith
   | marriage=02.01.1987
+
   | marriage=01.03.1985
 
   }}
 
   }}
   {{Wgraph:Genealogy Person| Rosa Scholz     |female|born=05.07.1949|info=this and that}}
+
   {{Wgraph:Genealogy Person| Bella Smith     |female|born=03.04.1955|info=this and that}}
   {{Wgraph:Genealogy Person| Bernhard Scholz |male  |born=31.07.1987|father=Gero Scholz|mother=Rosa Scholz}}
+
   {{Wgraph:Genealogy Person| Dave Smith      |male  |born=30.05.1986|father=John Smith|mother=Bella Smith}}
   {{Wgraph:Genealogy Person| Andreas Scholz  |male  |born=18.01.1989|father=Gero Scholz|mother=Rosa Scholz}}
+
   {{Wgraph:Genealogy Person| Paul Smith      |male  |born=28.02.1988|father=John Smith|mother=Bella Smith}}
   {{Wgraph:Genealogy Person| Lena Scholz     |female|born=14.03.1994|father=Gero Scholz|mother=Rosa Scholz}}
+
   {{Wgraph:Genealogy Person| Susan Smith     |female|born=04.06.1995|father=John Smith|mother=Bella Smith}}
 
}}
 
}}
 
<pre><nowiki>
 
<pre><nowiki>
 +
{{#wgraph: svg | thumb = 80 |
 
   {{Wgraph:Genealogy Graph}}
 
   {{Wgraph:Genealogy Graph}}
 
   {{Wgraph:Genealogy Person
 
   {{Wgraph:Genealogy Person
   | Gero Scholz  
+
   | John Smith  
 
   | male
 
   | male
   | born = 24.09.1956
+
   | born = 21.06.1952
   | info = some additional information
+
   | info = that & this
   | married to = Rosa Scholz
+
   | married to = Bella Smith
   | marriage=02.01.1987
+
   | marriage=01.03.1985
 
   }}
 
   }}
   {{Wgraph:Genealogy Person| Rosa Scholz     |female|born=05.07.1949|info=some additional information}}
+
   {{Wgraph:Genealogy Person| Bella Smith     |female|born=03.04.1955|info=this and that}}
   {{Wgraph:Genealogy Person| Bernhard Scholz |male  |born=31.07.1987|father=Gero Scholz|mother=Rosa Scholz}}
+
   {{Wgraph:Genealogy Person| Dave Smith      |male  |born=30.05.1986|father=John Smith|mother=Bella Smith}}
   {{Wgraph:Genealogy Person| Andreas Scholz  |male  |born=18.01.1989|father=Gero Scholz|mother=Rosa Scholz}}
+
   {{Wgraph:Genealogy Person| Paul Smith      |male  |born=28.02.1988|father=John Smith|mother=Bella Smith}}
   {{Wgraph:Genealogy Person| Lena Scholz     |female|born=14.03.1994|father=Gero Scholz|mother=Rosa Scholz}}
+
   {{Wgraph:Genealogy Person| Susan Smith     |female|born=04.06.1995|father=Gero Scholz|mother=Rosa Scholz}}
 
}}
 
}}
 
</nowiki></pre>
 
</nowiki></pre>

Latest revision as of 20:46, 17 October 2009

We add a "semantic template" which hides 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 " 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: svg | thumb = 80 | 
  {{Wgraph:Genealogy Graph}}
  {{Wgraph:Genealogy Person
   | John Smith  
   | male
   | born = 21.06.1952
   | info = that & this
   | married to = Bella Smith
   | marriage=01.03.1985
  }}
  {{Wgraph:Genealogy Person| Bella Smith     |female|born=03.04.1955|info=this and that}}
  {{Wgraph:Genealogy Person| Dave Smith      |male  |born=30.05.1986|father=John Smith|mother=Bella Smith}}
  {{Wgraph:Genealogy Person| Paul Smith      |male  |born=28.02.1988|father=John Smith|mother=Bella Smith}}
  {{Wgraph:Genealogy Person| Susan Smith     |female|born=04.06.1995|father=Gero Scholz|mother=Rosa Scholz}}
}}
continue with  Wgraph:Sample Genealogy 4 ..
back to        Wgraph:Sample Genealogy 2 ..