Modul:LinkedWiki: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 1: | Zeile 1: | ||
local | local p = {} | ||
local | function p.infobox(f) | ||
mw.log( | |||
local linkedwiki = require 'linkedwiki' | |||
-- init the prefix | |||
local rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' | |||
local rdfs = 'http://www.w3.org/2000/01/rdf-schema#' | |||
local xsd = 'http://www.w3.org/2001/XMLSchema#' | |||
local wdt = 'http://www.wikidata.org/prop/direct/' | |||
local wd = 'http://www.wikidata.org/entity/' | |||
local p = 'http://www.wikidata.org/prop/' | |||
local pq = 'http://www.wikidata.org/prop/qualifier/' | |||
local ps = 'http://www.wikidata.org/prop/statement/' | |||
local dateFormat = "d M Y" | |||
local subject = f.args.iri or linkedwiki.getCurrentIRI(); --find the iri of the current page | |||
local object = linkedwiki.new(subject) | |||
--object:setDebug(true) | |||
object:removeSubject() -- delete all triples of this subject | |||
--compare data with Wikidata | |||
local iriWikidata = "" | |||
local objWikidata = nil | |||
local objWikidataTitle = "" | |||
local objWikidataLieuDeces = nil | |||
local objPapeFonction = nil | |||
local linkWikidata = "" | |||
if not linkedwiki.isEmpty(f.args['Wikidata ID']) then | |||
local idConfigWikidata = 'http://www.wikidata.org' | |||
local taglang = 'de' | |||
mw.log('test') | |||
iriWikidata = wd .. f.args['Wikidata ID'] | |||
objWikidata = linkedwiki.new(iriWikidata, idConfigWikidata, taglang) | |||
objWikidataTitle = linkedwiki.new(objWikidata:getValue(wdt .. 'P1476'), idConfigWikidata, taglang) | |||
linkWikidata = '[' .. iriWikidata .. ' ' .. f.args['Wikidata ID'] .. ']' | |||
end | |||
return objWikidataTitle:checkString(wdt .. "P1476", f.args['Titel']) | |||
end | |||
return p |
Version vom 15. April 2021, 22:01 Uhr
Die Dokumentation für dieses Modul kann unter Modul:LinkedWiki/Doku erstellt werden
local p = {}
function p.infobox(f)
local linkedwiki = require 'linkedwiki'
-- init the prefix
local rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
local rdfs = 'http://www.w3.org/2000/01/rdf-schema#'
local xsd = 'http://www.w3.org/2001/XMLSchema#'
local wdt = 'http://www.wikidata.org/prop/direct/'
local wd = 'http://www.wikidata.org/entity/'
local p = 'http://www.wikidata.org/prop/'
local pq = 'http://www.wikidata.org/prop/qualifier/'
local ps = 'http://www.wikidata.org/prop/statement/'
local dateFormat = "d M Y"
local subject = f.args.iri or linkedwiki.getCurrentIRI(); --find the iri of the current page
local object = linkedwiki.new(subject)
--object:setDebug(true)
object:removeSubject() -- delete all triples of this subject
--compare data with Wikidata
local iriWikidata = ""
local objWikidata = nil
local objWikidataTitle = ""
local objWikidataLieuDeces = nil
local objPapeFonction = nil
local linkWikidata = ""
if not linkedwiki.isEmpty(f.args['Wikidata ID']) then
local idConfigWikidata = 'http://www.wikidata.org'
local taglang = 'de'
mw.log('test')
iriWikidata = wd .. f.args['Wikidata ID']
objWikidata = linkedwiki.new(iriWikidata, idConfigWikidata, taglang)
objWikidataTitle = linkedwiki.new(objWikidata:getValue(wdt .. 'P1476'), idConfigWikidata, taglang)
linkWikidata = '[' .. iriWikidata .. ' ' .. f.args['Wikidata ID'] .. ']'
end
return objWikidataTitle:checkString(wdt .. "P1476", f.args['Titel'])
end
return p