Hey all,
I've created two new extensions that relate to describing the structure of a wiki.
1) GraphDataStructure - This class allows you to obtain a graph data structure (nodes and edges) for your wiki. It looks in the database for all articles, categories, images, templates, etc and creates a node record for these. Next, it finds the relationships between the nodes (page links, category association, redirects, image and template uses, etc). Once you have a set of nodes and edges, you can export the result set as XML. It is also possible to set an active node from a Title object and prune all nodes and edges not connected to this node. The class can also take the XML it exports and construct a new instance of the object.
2) SpecialGraphStructure - This is a front-end for the above extension at [[Special:GraphStructure]]. This special page provides a web interface to obtain XML for various sets of nodes, articles, etc. It also has a caching mechanism for GraphDataStructure. The way it works is the first time it loads, the graph data structure for the entire wiki is created (a resource-intensive operation for large wikis). The graph data structure is serialized for future reference. For subsequent requests for graphs, the serialized data is read in and the appropriate nodes and edges are extracted and XML is returned. The graphs for each query are cached, for optimal performance. The cache also cleans itself, for convenience.
It is worth noting that the extension creates a graph structure for your entire wiki, then scans this structure to extract necessary information. For this reason, the extension will be significantly slower on large wikis. I have it working on a wiki with ~4000 nodes, and the speed cost is minimal (after initial population anyway).
By themselves, these extensions aren't that exciting (unless you are the kind of person who enjoys a machine-readable format of your wiki structure. This is why I am working on another extension, SpecialGraphviz, which takes the XML output from Special::GraphStructure and converts it to Graphviz markup. In the prototype of this extension, I have a new tab/action on articles called "Visualize" which displays a Graphviz rendering of the article's relationship to other articles. The rendering is also an image map, so you can click on the nodes and be taken to the appropriate wiki page.
These extensions are in my Subversion repository at http://opensource.case.edu/svn/MediaWikiHacks/extensions/.
You may view a demo of SpecialGraphStructure at http://wiki.case.edu/Special:GraphStructure
If you have any suggestions or feature requests, just send me an e-mail.
Gregory Szorc gregory.szorc@gmail.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Heya,
On Saturday 02 September 2006 02:58, Gregory Szorc wrote:
Hey all,
I've created two new extensions that relate to describing the structure of a wiki.
[snip]
These extensions are in my Subversion repository at http://opensource.case.edu/svn/MediaWikiHacks/extensions/.
You may view a demo of SpecialGraphStructure at http://wiki.case.edu/Special:GraphStructure
If you have any suggestions or feature requests, just send me an e-mail.
That sounds very exciting. Could you be convinced to make it output Graph::Easy format, too? Or instead, because Graph::Easy can also output Graphviz code as backend, giving you best of both worlds.
More about Graph::Easy can be found here:
http://bloodgate.com/perl/graph/ http://bloodgate.com/perl/graph/manual/
Why you actually want this would be ascii/svg/html output of the resulting graph. :)
If you have any questions, please dont hesitate to email me.
All the best,
Tels
- -- Signed on Sat Sep 2 06:23:15 2006 with key 0x93B84C15. Visit my photo gallery at http://bloodgate.com/photos/ PGP key on http://bloodgate.com/tels.asc or per email.
"Retsina?" - "Ja, Papa?" - "Schach Matt." - "Is gut, Papa."
mediawiki-l@lists.wikimedia.org