Extension:JSON

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

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#json1 name John Foo#json1 address Foo#json2 Foo#json2 city Boston Foo Has_subobject Foo#json1 Foo Has_subobject Foo#json2

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 or use SVN

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

Then append the following to LocalSettings.php of your MediaWiki installation:

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

In the example given at the beginning, the following additional triples will be generated: Foo#json1 Has_JSON_container Foo Foo#json2 Has_JSON_container Foo Foo#json1 Has_JSON_parent Foo Foo#json2 Has_JSON_parent Foo#json1

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.