Module:MySPARQL

From TITAF TANGOWIKI
Revision as of 20:13, 21 March 2025 by Donxello (talk | contribs)

Documentation for this module may be created at Module:MySPARQL/doc

local sparql = require('SPARQL') -- Load the SPARQL binding

local p = {}

function p.debugQuery(frame)
    local sparqlQuery = frame.args[1]
    local queryResults = sparql.runQuery(sparqlQuery)

    -- If queryResults is nil, return an error message
    if not queryResults then
        return "SPARQL query failed! Check endpoint and extension."
    end

    -- Return full JSON output to analyze
    return mw.text.jsonEncode(queryResults)
end

return p