Modul:ProyekWiki Bahasa/pemeliharaan/peta/rawdata/2: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
←Membuat halaman berisi 'local p = {} function p.query(frame) -- Define the endpoint and query local endpointUrl = "https://query.wikidata.org/sparql" local sparqlQuery = [[ SELECT ?id ?idLabel ?head (SAMPLE(?pop) AS ?populasi) (SAMPLE(?ison) AS ?iso) (SAMPLE(?glotton) AS ?glotto) (SAMPLE(?img) AS ?img_) (SAMPLE(?gmbr) AS ?gmbr_) (MIN(?partyId) AS ?geo) WHERE { ?id wdt:P31 wd:Q34770 . ?id...' Tag: Suntingan perangkat seluler Suntingan peramban seluler Suntingan seluler lanjutan |
Tidak ada ringkasan suntingan Tag: Suntingan perangkat seluler Suntingan peramban seluler Suntingan seluler lanjutan |
||
Baris 1:
local p = {}
function p.
-- Define the SPARQL endpoint URL and the query
local endpointUrl =
local sparqlQuery = [[
(SAMPLE(?pop) AS ?populasi)
(SAMPLE(?ison) AS ?iso)
Baris 12 ⟶ 14:
(SAMPLE(?gmbr) AS ?gmbr_)
(MIN(?partyId) AS ?geo)
-- The rest of your query goes here
WHERE {
bd:serviceParam wikibase:language ?head rdfs:label ?headLabel . ?id rdfs:label ?idLabel . }
OPTIONAL { ?id wdt:P220 ?ison . } ?link schema:about ?head .
?link schema:isPartOf <https://wiki-indonesia.club/> .
?link2 schema:about ?id .
?link2 schema:isPartOf <https://wiki-indonesia.club/> .
-- Add the remaining parts of your WHERE clause here
}
GROUP BY ?id ?idLabel ?head ?headLabel ?link2 ?link ?geo
]]
--
local url = endpointUrl .. '?query=' .. urlEncode(sparqlQuery) .. '&format=json'
▲ local http = require("mw.http")
▲ local json = require("mw.text.json")
-- Fetch data from Wikidata
local
headers = { [
}
--
local data = json(result.body)
end
local result = ""▼
for i, binding in ipairs(data.results.bindings) do▼
function p.showData()
local data =
-- Convert data into wikitext or HTML for display
▲ return result
▲ else
output = output .. "* " .. item.idLabel.value .. ": " .. item.populasi.value .. "\n"
end
return output
end
|