Extension:Page Schemas

Description
Page Schemas is a MediaWiki extension that allows for defining all the schema information about a "class", or data type - for naming, display, data input, and browsing - within a single piece of XML contained within a category page. This XML could then be used to generate all the necessary additional pages needed to put the schema into effect, such as template pages and, if Semantic MediaWiki is installed, property pages. The XML could then also be edited via some kind of editing interface, preventing users from having to generate or modify it by hand.

Page Schemas would allow other extensions to define their own fields to add to the XML, using hooks. To start with, it's planned that the extensions Semantic MediaWiki, Semantic Forms and Semantic Drilldown would hook into the Page Schemas code to add their own fields.

Page Schemas would most likely define two special pages: 'Special:EditSchema' and 'Special:GenerateClassPages'. 'Special:EditSchema' would allow for creating or editing the XML via the helper form, while 'Special:GenerateClassPages' would essentially provide a button that would let the administrator create the template(s), semantic properties, form, filter(s), etc. automatically from the XML definition. 'Special:GenerateClassPages' would most likely also include checkboxes for each of the pages to be generated, to let administrators choose not to override certain wiki pages that already exist.

Possible XML structure
Here is some possible XML to be contained within a page called "Category:Cities", used to define the "City" data type. This section defines the name of the category, the name of the form, and information for a single field of that class, "Population".

 City   Pop.  Number 12,23   text <Size>20</Size> </semanticforms:FormInput> <semanticdrilldown:Filter> Population</Label> </semanticdrilldown:Filter> </Field> ...	</Template> ... </PageSchema>

Code and download
You can download the code via SVN from the MediaWiki source code repository, at http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/PageSchemas/. From a command line, you can call the following:

To view the code online, including version history for each file, you can go here.

Installation
After you've obtained a 'PageSchemas' directory, place this directory within the main MediaWiki 'extensions' directory. Then, in the file 'LocalSettings.php' in the main MediaWiki directory, add the following line:

Author
Page Schemas was written by Ankit Garg as part of Google Summer of Code, 2011 and was mentored by Yaron Koren

Version
Page Schemas is currently at version 0.0.1.