Difference between revisions of "Wgraph:Example 4"

From FollowTheScore
Jump to: navigation, search
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
In this example we do not use relations which were explicitly defined via template calls. Instead we use the normal hyperlinks.  
 
In this example we do not use relations which were explicitly defined via template calls. Instead we use the normal hyperlinks.  
  
Thus we loose some semantics but we can apply this kind of graph generation to any existing wiki contents!
+
Thus we lose some semantics but we can apply this kind of graph generation to any existing wiki contents!
  
 
To make the graph prettier, we assign colors to the categories (Impressionism = magenta, Expressionism = yellow).
 
To make the graph prettier, we assign colors to the categories (Impressionism = magenta, Expressionism = yellow).
Line 7: Line 7:
  
 
Our example shows links from articles of category "Painter" to other articles of category "Painter".
 
Our example shows links from articles of category "Painter" to other articles of category "Painter".
Note the birectional link between Renoir and Cezanne.
+
Note the bi-directional link between Renoir and Cezanne.<br>
 +
A bigger example can be found '''[[Special:Call/Catgraph,uses2=CalendarSingle,layout=forcedir,userparm=repulsion:300|here]].'''
  
 
In the SVG graph each node points to its wiki page.
 
In the SVG graph each node points to its wiki page.
<nowiki><pre>
+
 
 +
First we show the output of the DPL query which is embedded in the ''Wgraph'' definition:
 +
 
 +
{|class=wikitable
 +
!DPL result: The painters
 +
!DPL result: Their relations
 +
|-
 +
|
 +
{{#dpl:
 +
  |category=Painter
 +
    |addcategories=true
 +
}}
 +
|
 +
{{#dpl:
 +
  |category=Painter
 +
  |mode=userformat
 +
  |listseparators=,\n* [[%PAGE%]] -- [[%PAGESEL%]],,
 +
  |linksto={{#dpl:
 +
    |mode=userformat
 +
    |category=Painter
 +
    |listseparators=,%PAGE%¦,,
 +
  }}
 +
}}
 +
|}
 +
 
 +
----
 +
'''Below we see the graph and the WGL source which is generated by DPL;<br>
 +
The nodetype statements were written by hand to make the result more pretty:'''
 +
 
 
{{#wgraph: svg | thumb=40 | wgl |
 
{{#wgraph: svg | thumb=40 | wgl |
 +
 
   // the painters
 
   // the painters
 
   {{#dpl:
 
   {{#dpl:
Line 17: Line 47:
 
     |mode=userformat
 
     |mode=userformat
 
     |addcategories=true
 
     |addcategories=true
     |listseparators=,\n node '%PAGE%' { type = '%CATNAMES%' },,
+
     |listseparators=,\n node '%PAGE%' { type = '%CATNAMES%' },,
 
   }}
 
   }}
 +
 
   // their relations
 
   // their relations
 
   {{#dpl:
 
   {{#dpl:
 
     |category=Painter
 
     |category=Painter
 
     |mode=userformat
 
     |mode=userformat
     |listseparators=,\n edge from '%PAGE%' to '%PAGESEL%' {},,
+
     |listseparators=,\n edge from '%PAGE%' to '%PAGESEL%' {},,
 
     |linksto={{#dpl:
 
     |linksto={{#dpl:
 
       |mode=userformat
 
       |mode=userformat
Line 30: Line 61:
 
     }}
 
     }}
 
   }}
 
   }}
 +
 +
  // attribute settings for categories
 
   nodetype 'undefined node' { href '%%' }
 
   nodetype 'undefined node' { href '%%' }
 
   nodetype Impressionism { color lightmagenta href %% }
 
   nodetype Impressionism { color lightmagenta href %% }
 
   nodetype Expressionism { color lightyellow href %% }
 
   nodetype Expressionism { color lightyellow href %% }
}}
 
</pre></nowiki>
 
 
<nowiki><pre>
 
===== DPL, order by target article =====
 
{{#dpl:
 
  |category=Painter
 
  |mode=userformat
 
  |listseparators=,\n* [[%PAGESEL%]] - [[%PAGE%]],,
 
  |linksfrom={{#dpl:
 
    |mode=userformat
 
    |category=Painter
 
    |listseparators=,%PAGE%¦,,
 
  }}
 
 
}}
 
}}
  
===== DPL, order by source article =====
+
continue with the '''[[Wgraph:Sample Genealogy|Genealogy Sample]]''' (series of 8 lessons on graph construction)
{{#dpl:
+
back to          [[Wgraph:Example 3]] ..
  |category=Painter
 
  |mode=userformat
 
  |listseparators=,\n* [[%PAGE%]] -- [[%PAGESEL%]],,
 
  |linksto={{#dpl:
 
    |mode=userformat
 
    |category=Painter
 
    |listseparators=,%PAGE%¦,,
 
  }}
 
}}
 
</pre></nowiki>
 
  
 
[[Category:Wgraph]]
 
[[Category:Wgraph]]

Latest revision as of 10:05, 15 August 2007

In this example we do not use relations which were explicitly defined via template calls. Instead we use the normal hyperlinks.

Thus we lose some semantics but we can apply this kind of graph generation to any existing wiki contents!

To make the graph prettier, we assign colors to the categories (Impressionism = magenta, Expressionism = yellow). We could also make shapes dependent from (other) categories ..

Our example shows links from articles of category "Painter" to other articles of category "Painter". Note the bi-directional link between Renoir and Cezanne.
A bigger example can be found here.

In the SVG graph each node points to its wiki page.

First we show the output of the DPL query which is embedded in the Wgraph definition:

DPL result: The painters DPL result: Their relations

Below we see the graph and the WGL source which is generated by DPL;
The nodetype statements were written by hand to make the result more pretty:

{{#wgraph: svg | thumb=40 | wgl |

 // the painters
 
 node 'Van Gogh' { type = 'Expressionism, Painter' }
 node 'Renoir' { type = 'Impressionism, Painter' }
 node 'Cezanne' { type = 'Painter' }
 node 'Manet' { type = 'Painter' }
 node 'Signac' { type = 'Impressionism, Painter' }
 // their relations
 
 edge from 'Cezanne' to 'Renoir' {}
 edge from 'Manet' to 'Renoir' {}
 edge from 'Renoir' to 'Cezanne' {}
 edge from 'Signac' to 'Renoir' {}
 // attribute settings for categories
 nodetype 'undefined node' { href '%%' }
 nodetype Impressionism { color lightmagenta href %% }
 nodetype Expressionism { color lightyellow href %% }

}}

continue with the Genealogy Sample (series of 8 lessons on graph construction)
back to           Wgraph:Example 3 ..