Extension:Semantic Graph

Prerequisites
You must have a working graphviz installation (see: http://www.graphviz.org/)
 * Tested against MW 1.13
 * Semantic MediaWiki 1.4.0, issues with most 1.6 version of SMW
 * Semantic Forms 1.3.7

If your path to dot (which you can find by the command 'which dot') is not /usr/bin/dot then you will extra steps during configuration (see below)

Installations Steps
Get the files from https://sourceforge.net/projects/semanticgraph/ 1) extract the files into the extensions directory of your MediaWiki e.g:	tar -xvf SemanticGraph.tar.gz /extensions/SemanticGraph

2) Download the freemind applet jar file from: http://surfnet.dl.sourceforge.net/sourceforge/freemind/freemind-browser-0_7_1.zip

extract the file "freemind.jar" and put it in the directory: /extensions/SemanticGraph/libs where is the install path of your MediaWiki.

(this file is actually included in the download above so this step is not necessary)

3) Download the hypergraph applet and graph document type declaration from wget http://hypergraph.sourceforge.net/hyperapplet.jar wget http://hypergraph.sourceforge.net/GraphXML.dtd and put it in the directory: /images/hypergraph (you may need to create this) where $IP is the install path of your mediawiki. ensuring that the apache user (e.g. www-data or apache) has write access to the /images/hypergraph directory e.g.: chown www-data:www-data $IP/images/hypergraph

NOTE: If upacking from the sourceforge packages: Hypergraph is a bit funny in that it has to be in the same directory as the output graph file which is /images/hypergraph so you need to move (or symbolic link) the two files hypergraph.jar & graph.dtd from " /extensions/SemanticGraph/libs" to the " /images/hypergraph" so that the generated graph and the applet files are all in the same place. Assuming you are running debian, and you have write access to the apache directory, the sequence of commands would be:

mkdir /images/hypergraph chown www-data:www-data /images/hypergraph cp /extensions/SemanticGraph/libs/hypergraph.jar /images/hypergraph cp /extensions/SemanticGraph/libs/GraphXML.dtd /images/hypergraph

Taking care to correctly substitute you wiki directory filepath for I think for other distros the apache username is different (www or apache)...

4) put the following line in your $IP/LocalSettings.php:	require_once(' /extensions/SemanticGraph/includes/SemanticGraph2.php');

5) relaxing mimetype checking and allowing mm files to be uploaded: see Manual:Configuring file uploads basically add the following to your LocalSettings.php:	$wgFileExtensions[] = 'mm';	$wgVerifyMimeType = false;

Extra LocalSettings.php configuration
the extension defines the settings object $wgSemanticGraphSettings. There are a number of useful things you can change here by including the following lines in your LocalSettings.php e.g.: $wgSemanticGraphSettings->dotCommand = '/path/to/dot'; $wgSemanticGraphSettings->neatoCommand = '/path/to/neato'; $wgSemanticGraphSettings->mmAppletPath = 'http://URL/to/freemind.jar'; $wgSemanticGraphSettings->maxToDispUnfolded = 10; //when displaying a 		// freemind map by default any branch with more than 10 items starts folded // this can be overridden by the fold=none|level1|level2|level3|large option Those with MS operating systems will probably need to do something to these path variables

Usage
There are 4 parser functions provided by the extension. They are: All of them have similar syntax which can be displayed inline by doing e.g. Tree functions generally require a single root resource to be specified, network graph functions can have a comma seperated list.
 * - generated mindmap tree from semantic network, category tree or wiki links
 * - generated dot network graph
 * - generated hypergraph graph
 * display an uploaded mind map with dynamic linking to the wiki.

It should be possible to use the output of a query as the definition of a resource list for a graph if you specify the 'format=template' and 'link=none' option in the query.

Known Issues

 * colouring of the graphs is not yet implemented.
 * ideally the functions should be integrated with the semantic result formats. There are subtle differences though in that this will iteratively perform semantic network browsing, and this will also do non semantic (e.g. category and wiki link maps). Also this integrates functionally with semantic forms extensions
 * the querying is done quite inefficiently at the moment especially for semantic networks.
 * caching is not managed at all.
 * hypergraphing could only be done through a nasty hack using iframes as the applet does not like to be in a different directory from its data files. Clicking on hypergraph hyperlinks results in the target being opened in the iframe rather that the enclosing page, which is not ideal.