Module:PublicationShowAbstract
From MaRDI portal
Documentation for this module may be created at Module:PublicationShowAbstract/doc
-- Required module containing helper methods
local helper = require('Module:HelperMethods')
-- Required modules for SPARQL queries and HTML table generation
local sparql = require('SPARQL')
local mwHtml = require('mw.html')
-- Main table to hold all functions
local p = {}
-- Function to convert JSON results into a space-separated string
function p.queryAbstractDB(QID)
local resultsString = ""
local safeList = helper.urlencode ( binding.value.value )
local row = mw.ext.externaldata.getDbData {
db = "AbstractDB",
parameters = safeID
}
if row then
local link = baseUrl .. "/w/index.php?title=+Special%3ASearch&search=%22" .. helper.urlencode(msc_result.msc_label) .. "%22&go=Go"
if resultsString ~= "" then
resultsString = resultsString .. "\n"
end
local nameAndLink = "[" .. link .. " " .. msc_result.msc_label .. " (" .. name .. ")]"
resultsString = resultsString .. nameAndLink
end
return resultsString
end
-- Function to build the list
function p.getAbstractForPaperQID(frame)
-- Retrieve target1 from frame arguments or return error message if not set
local target1 = frame.args[1]
if not target1 or target1 == '' then
return "No records found"
end
local abstract = p.queryAbstractDB(target1)
-- mw.log(abstract)
return abstract
end
return p