Difference between revisions of "WikiTask Tutorial/Temperature example"
Jump to navigation
Jump to search
(→graph) |
|||
(One intermediate revision by the same user not shown) | |||
Line 62: | Line 62: | ||
"Cloud" -> "cloudy" [label="today"]; | "Cloud" -> "cloudy" [label="today"]; | ||
"Cloud" -> "partly" [label="yesterday"]; | "Cloud" -> "partly" [label="yesterday"]; | ||
− | "Cloud" -> "sunny" [label=" | + | "Cloud" -> "sunny" [label="tomorrow"]; |
} | } | ||
</graphviz> | </graphviz> | ||
+ | http://diagrams.bitplan.com/render/png/0xf344c175.png |
Latest revision as of 13:48, 2 February 2021
SiDIF input for temperature example
This is some SiDIF input. It has the id='temperature'
Temperature today cool
Temperature yesterday modest
Temperature tomorrow warm
Cloud today cloudy
Cloud yesterday partly
Cloud tommorrow sunny
Freemarker template for graphviz triplegraphs
The following template generates a graphviz representation of the triples defined by the SiDIF-input. This template is identified by the id='wikitasktemplate'.
<#assign rankdir="TB"/>
<#assign triples=tripleStore.getTriples()/>
== Triple graph ==
<graphviz format='svg'>
digraph ${wikiTask.input} {
rankdir="${rankdir}";
<#list triples as triple>
"${triple.subject}" -> "${triple.object}" [label="${triple.predicate}"];
</#list>
}
</graphviz>
WikiTask for temperature example
The wikitask uses the input with the id='temperature' and the template with the id='triplegraph' to create the given targetpage
{{wikitask|cmd=runtemplate|input=temperature|template=triplegraph|targetpage=WikiTask Tutorial/temperature}}
Just click on the green "run" button to try it out: runtemplate -> WikiTask Tutorial/temperature
expected result
First the wiki markup generated is shown and then the graph as it is rendered by the graphviz extension.
wiki markup
<graphviz format='svg'> digraph temperature_expected_result { rankdir="TB"; "Temperature" -> "cool" [label="today"]; "Temperature" -> "modest" [label="yesterday"]; "Temperature" -> "warm" [label="tomorrow"]; "Cloud" -> "cloudy" [label="today"]; "Cloud" -> "partly" [label="yesterday"]; "Cloud" -> "sunny" [label="tomorrow"]; } </graphviz>
graph