Module:SMW
From devsummit
Documentation for this module may be created at Module:SMW/doc
-- Module:SMW
local p = {}
-- Return results
function p.ask(frame)
if not mw.smw then
return "mw.smw module not found"
end
if frame.args[1] == nil then
return "no parameter found"
end
local queryResult = mw.smw.getQueryResult( frame.args )
if queryResult == nil then
return "(no values)"
end
if type( queryResult ) == "table" then
local myResult = ""
for k,v in pairs( queryResult.results ) do
if v.fulltext and v.fullurl then
myResult = myResult .. k .. " | " .. v.fulltext .. " " .. v.fullurl .. " | " .. "<br/>"
else
myResult = myResult .. k .. " | no page title for result set available (you probably specified ''mainlabel=-')"
end
end
return myResult
end
return queryResult
end
return p