Extension:JSON

This extension is an extension of the Semantic MediaWiki extension. It simplifies modeling complex data structure on a semantic wiki using the JSON syntax.

What This Extension Does
This extension introduces a parser function "json". Example: suppose we are on page Foo with the wiki script:

The JSON extension will create the following triples Foo Has_subobject Foo#json1 Foo#json1 name John Foo#json1 address Foo#json2 Foo#json2 city Boston

Note: Property:Has subobject is a special property defined by SMW since 1.7 WIthout using the JSON syntax, a wiki editor may have to explicitly create a set of short wiki pages or SMW subobjects (> SMW 1.7). The JSON syntax is shorter, and makes it easier to import data from JSON-enabled Web APIs

Dependency
This extension is dependent on SMW 1.7 or later. It will not work without SMW.

Download and Install
Download http://smwbp.googlecode.com/svn/trunk/mediawiki/extensions/JSON/JSON.php

Or use SVN svn co http://smwbp.googlecode.com/svn/trunk/mediawiki/extensions/JSON/JSON.php

Add the code to the "WIKI-PATH/extentions/JSON" folder.

Then append the following to LocalSettings.php of your MediaWiki installation: require_once ("$IP/extensions/JSON/JSON.php");

Usage
Syntax

You can query the generated semantic annotation using ask query as usual. To browse, e.g., Foo#json1, go to Special:Browse/Foo-23json1

The extension introduces two special properties
 * Property:Has JSON container - link a JSON node (a JSON object or part of it) to the page that contains it
 * Property:Has JSON parent - link a JSON node to its parent node

Print a table of JSON nodes on a page, their parent JSON node, and their "name" property if exists.

Print the hierarchy of JSON objects contained on a page (this query requires Semantic Result Format 1.7.1 for tree format):

Limitations
Currently the extension does not support list

Related Extensions

 * Extension:External_Data - retrieve data from external sources with various formats, including JSON.