SourceForge.net Logo

Semantic graph extensions

This is a set of parser functions, #smm, #sgraph, #shypergraph and #mm2 to derive graphs from the semantic and non-semantic relationships of a Semantic Mediawiki with functional integration with the Semantic forms extension. At the moment I haven't got a web demo of it available within a wiki but here are some of the outputs to give you a flavour. The software is GPL
Please see the README file for some further info on usage, or if you get the extension installed then an error in the usage should generate a summary of the syntax, and highlight mistakes made. (e.g. typing {{#smm:help}} will output a summary of the options).
NOTE: All the in graph links have been removed in the examples below because they would be pointing to a localhost development server.
Click to go to get the code...


Graph as dot map

This shows a small graph built from the content of the wiki, this one happens to be an acyclic network with single parentage, but the function is built to display networks. This is based on a partial rewrite of the mediawiki graphviz extension and relies on a server installation of GraphViz.It has support for dot, neato, circo and the other rendering engines supplied with graphviz
The function creates links to the underlying pages, and if the pages don't yet exist then allows for integration with the semantic forms extension, in that a new form can be created and pre-populated based on that property. (by default these are coloured red or blue)
The parser function syntax for generating this map was:
{{#sgraph:resource=Interoperability ...this could have been a comma seperated list of pages
|property=hasSubtopic
|depth=3
|engine=dot
|svg=true
}}
This output format is a javascript svg file. It may not work on all browsers - tested on firefox. There is also support for png.


Graph as Freemind map

This shows a Freemind map generated from a semantic network of parent-child relationships. The colouring indicates whether the nodes exist within the wiki or are simply referred to and don't yet exist. Normally the links are populated to click through to the page corresponding to the node, or if the page doesn't exist again you can direct it to a semantic form to input structured data.
The parser function syntax for generating this map was:
{{#smm:resource=Health informatics topics
|property=hasSubtopic
|depth=10
|height=800
|editform=Rsrc
|editquery=Rsrc[label]=@CHILD@&Rsrc[subtopicOf]=@PARENT@
}}
The last line defines how the semantic form is prepopulated.
If you omit a property the map will be generated using the wiki links, unless the resource is a category in which case it will generate a category tree. There are a number of folding options to control the display - in this map it is defaulting to folding branches with more than 10 items in it. Cyclic dependencies are identified during the map creation and broken so that it can be displayed as a tree.


Click to download...

Displaying an extenal mindmap

If you upload a Freemind map onto a wiki (see the README file for more details on enablig this) there is another parser function which has syntax such as:
{{#mm2:image=uploadedmapname.mm
|editform=...form...
|editquery=...querystring...
}}
The function creates a copy of the map with links to content within the wiki if it can find pages based on the text of the Freemind nodes. This allows for some brainstorming around the content of a wiki to be done in Freemind, and the wiki to be authored using semantic forms, or the normal edit page, if you are not semantically inclined. The linked mindmap can be downloaded and manipulated and re-uploaded.


Graph as Hypergraph

The same underlying information can be presented as a network graph using Hypergraph. There are some fundamental differences here, the network does not need to be expressed as a tree, the map can take multiple resources as input, and (theoretically at least) multiple properties as well, these can be passed as a comma seperated list. The parser function syntax for generating this graph was:
{{#shypergraph:resource=Health informatics topics
|property=hasSubtopic
|depth=10
|height=800
|editform=Rsrc
|editquery=Rsrc[label]=@CHILD@
}}
Click and drag the graph to explore - look at HL7 nodes for most detail


Possible complex uses


Future directions / known issues

Please let me know of issues / problems / suggestions through the sourceforge lists
Thanks
Rob.


Syntax summary for the functions

This is the default help message displayed if the functions encounter invalid input:

USAGE: {{#smm:property=value|property=value1,value2,value3|...}}

propertytypelistvaluescheckshelp
resourcepage
  • mand
  • someexist
the root node of the mind map, if a category the tree will be a category tree
propertypage
  • someexist
the property to traverse, if this is empty the tree will be built from wiki links
depthnum
heightstring
editformstringa form name that can be used to edit red links, without "Form:"
editquerystringa query string that will be passed to semantic forms, seperator is ampersand
foldstring
  • level1
  • level2
  • level3
  • none
  • large
folding of generated map: by default branches with more than 10 items are folded

USAGE: {{#mm2:property=value|property=value1,value2,value3|...}}

propertytypelistvaluescheckshelp
imagepage
  • mand
  • someexist
a page name in the image namespace that refers to an uploaded freemind map e.g. Image:map.mm, also map.mm should work
heightstring
editformstringa form name that can be used to edit red links, without "Form:"
editquerystringa query string that will be passed to semantic forms, seperator is ampersand
foldstring
  • level1
  • level2
  • level3
  • none
  • large

USAGE: {{#sgraph:property=value|property=value1,value2,value3|...}}

propertytypelistvaluescheckshelp
resourcepage1
  • mand
  • someexist
the initial nodes of the graph, can be one or many, if all are categories the graph will be a category graph
propertypage
  • someexist
the properties to traverse for links, can be one or many, if this is empty the graph will be built from wiki links
depthnumdeep graphs can be expensive
enginestring
  • dot
  • neato
  • circo
  • twopi
  • fdp
editformstringa form name that can be used to edit red links, without "Form:"
editquerystringa query string that will be passed to semantic forms, seperator is ampersand
dotoptionsstringa dot string which is inserted at the top of the graph

USAGE: {{#shypergraph:property=value|property=value1,value2,value3|...}}

propertytypelistvaluescheckshelp
resourcepage1
  • mand
  • someexist
a set of pages that define the initial nodes of the graph, if all are catgories it will be a category graph
propertypage1
  • someexist
a set of properties that will be followed, if empty wikilinks will be used
coloursstring1
  • black
  • blue
  • cyan
  • darkGray
  • gray
  • green
  • lightGray
  • magenta
  • orange
  • pink
  • red
  • white
  • yellow
a list of colours for the property links - not yet implemented
depthnum
widthstring
heightstring
editformstringa form name that can be used to edit red links, without "Form:"
editquerystringa query string that will be passed to semantic forms, seperator is ampersand