Freebase MediaWiki Extension
From Ascii20
This extension allows you to make Freebase queries from Mediawiki pages and display selected query clauses.
Using the extension is a two step operation: running the query and fetching the results.
Generally Mediawiki content contributors (users) will access Freebase data through a Mediawiki Template which wraps the query and formats the results for use in a page. In this way general Mediawiki content contributors need not know anything about the Freebase query language, data model or the operation of the Freebase Mediawiki Extension.
A simple query step:
{{#fb2q:firstquery | {"query":{"id":"/topic/en/harrison_ford", "ourlabel:guid":null} } | false}}
Note: The false argument assert we do not want the output in debugging mode. If we had set the last argument to true the JSON results of the query itself would have been returned.
A simple output retrieval step:
The Guid for Harrison Ford: {{#fb2r:firstquery |ourlabel | raw}}
The results of retrieval step
The Guid for Harrison Ford: #9202a8c04000641f8000000000058221
Note: The second argument specifies the output format
- "raw": escape all wiki markup [this is the default behavior]
- "html": allow HTML output to render in the wiki (for trusted output)
- "wiki": any wiki markup characters in the output will cause wiki behavior
If "wiki" had been specified he hash symbol in the guid would cause the output to appear as an ordered list as in:
The Guid for Harrison Ford:
- 9202a8c04000641f8000000000058221
Examples
- A simple example using MediaWiki templates as a way of wrapping the Freebase Extension. This hides the complexity of the MQL query and variable formatting from novice users.
- Recreating "infobox" like output through template formating and handling the retrieval of array properties
- Two Freebase Queries on one page.

