Semantic MediaWiki and related extensions
|
The following functions are provided by the mw.smw
package.
mw.smw.ask
and mw.smw.getQueryResult
Both functions allow you to retrieve data from your smw store. The difference lies in the returned table. Where mw.smw.ask
returns a very simplistic result set (its values are all pre-formatted and already type cast), mw.smw.getQueryResult
leaves you with full control over your returned data, giving you abundant information but delegates all the data processing to you.
In other words:
ask
is a quick and easy way to get data which is already pre-processed and may not suite your needs entirely. However, it utilizes native SMW functionality like printout formatting (see smwdoc for more information)getQueryResult
gets you the full result set in the same format provided by the apiFor more information see the sample results in https://github.com/SemanticMediaWiki/SemanticScribunto/blob/master/docs/mw.smw.ask.md "`mw.smw.ask`" and https://github.com/SemanticMediaWiki/SemanticScribunto/blob/master/docs/mw.smw.getQueryResult.md "`mw.smw.getQueryResult`".
For a detailed description of the #invoke
function, please have a look at the Lua reference manual.
ScribuntoLuaLibrary
is the interface for functions that are made available in the mw.smw
package and can be extended easily with the expectation that some guidelines are followed to ensure future maintainability and release stability.
ScribuntoLuaLibrary::register
LuaAskResultProcessor
, LibraryFactory
) to separate necessary work stepsPHP
and Lua
components to ensure that both parts are equally tested and correspond to each other in the expected outcome