
در صورت تمایل یک صفحهٔ توضیحات برای این پودمان اسکریبونتو ایجاد کنید. ویرایشگران میتوانند در صفحات تمرین (ایجاد | آینه) و آزمایشی (ایجاد) این پودمان را آزمایش کنند. لطفاً ردهها را به زیرصفحهٔ /توضیحات بیافزایید. زیرصفحههای این پودمان. |
local check = require('Module:Check2') local yesno = require('Module:Yesno') local cfgI18 = mw.loadData('Module:Wikidata2/i18n') local cfgParams = mw.loadData('Module:Wikidata2/Params') local cfgDelimiters = mw.loadData('Module:Wikidata2/Delimiters') local cfgFormats = mw.loadData('Module:Wikidata2/Formats') local cfgPOITypes = mw.loadData('Module:Wikidata2/POITypes') local cfgGeography = mw.loadData('Module:Wikidata2/Geography') local cfgUnits = mw.loadData('Module:Wikidata2/Units') local lang = mw.language.getContentLanguage() -- Auswertung und Prüfung von übergebenen Parametern local function wdGetParameter ( Frame, Params, Parameter ) local argsParent = Frame:getParent().args local argsFrame = Frame.args for key,value in pairs ( argsParent ) do argsParent[string.lower(key)] = value end for key,value in pairs ( argsFrame ) do argsParent[string.lower(key)] = value end return argsParent[Parameter] or argsFrame[Parameter] or Params[Parameter] end local function getEntityId () local entity = mw.wikibase.getEntityObject () local result = {} if ( entity ~= nil ) then result = { ["id"] = entity.id, ["hasID"] = true, ["errCode"] = 1, ["errMsg"] = cfgI18["getEntityId"]["1"], ["entity"] = entity } else result = { ["id"] = "", ["hasID"] = false, ["errCode"] = 0, ["errMsg"] = cfgI18["getEntityId"]["0"], ["entity"] = nil } end return result end local wdEntityId = getEntityId() local wd = {} function wd.formatNumberT ( number ) local decimalPosition = mw.ustring.find( number, ".", 1, true) local minus = mw.ustring.find( number, "-", 1, true) number = mw.ustring.gsub ( number, '%.', ',' ) if ( minus ) then number = mw.ustring.sub( number, 2) end if (not decimalPosition) then decimalPosition = mw.ustring.len ( number ) + 1; end if (decimalPosition > 4 ) then local i = decimalPosition - 3; while (i > 1) do number = mw.ustring.sub(number, 1, i - 1) .. '.' .. mw.ustring.sub( number, i ); decimalPosition = decimalPosition + 1; i = i - 3; end end if ( minus ) then number = '−' .. number end return number; end function wd.getLabel ( id ) local result = {} local label = '' if ( id == nil or id == "" or id == "self" ) then if ( wdEntityId.hasID ) then result = { ["label"] = mw.wikibase.label(), ["errCode"] = 1, ["errMsg"] = cfgI18["getLabel"]["1"] } else result = { ["label"] = "", ["errCode"] = 0, ["errMsg"] = cfgI18["getLabel"]["0"] } end else label = mw.wikibase.label ( id ) if ( label ~= nil ) then result = { ["label"] = label, ["errCode"] = 1, ["errMsg"] = cfgI18["getLabel"]["1"] } else result = { ["label"] = "", ["errCode"] = 2, ["errMsg"] = cfgI18["getLabel"]["2"] } end end return result end function wd.getLabelLang ( id, lang ) local result = {} local label = '' if ( id == nil or id == "" or id == "self" ) then -- local entity = mw.wikibase.getEntityObject () if ( wdEntityId.hasID ) then result = { ["label"] = wdEntityId.entity:getLabel( lang ), ["errCode"] = 1, ["errMsg"] = cfgI18["getLabelLang"]["1"] } else result = { ["label"] = "", ["errCode"] = 0, ["errMsg"] = cfgI18["getLabelLang"]["0"] } end else local entity = mw.wikibase.getEntityObject(id) if ( entity ~= nil ) then label = entity:getLabel( lang ) if ( label ~= nil ) then result = { ["label"] = label, ["errCode"] = 1, ["errMsg"] = cfgI18["getLabelLang"]["1"] } else result = { ["label"] = "", ["errCode"] = 0, ["errMsg"] = cfgI18["getLabelLang"]["0"] } end else result = { ["label"] = "", ["errCode"] = 2, ["errMsg"] = cfgI18["getLabelLang"]["2"] } end end return result end function wd.getSiteLink ( id, wiki ) local result = {} local sitelink = {} if ( wiki == nil ) then wiki = 'dewikivoyage' end if ( id == nil or id == "" or id == "self" ) then -- local entity = mw.wikibase.getEntityObject () if ( wdEntityId.hasID ) then if ( wdEntityId.entity.sitelinks ~= nil ) then sitelink = wdEntityId.entity.sitelinks[wiki] if ( sitelink == nil ) then result = { ["sitelink"] = '', ["errCode"] = 0, ["errMsg"] = cfgI18["getSiteLink"]["0"] } else result = { ["sitelink"] = sitelink.title, ["errCode"] = 1, ["errMsg"] = cfgI18["getSiteLink"]["1"] } end else result = { ["sitelink"] = '', ["errCode"] = 3, ["errMsg"] = cfgI18["getSiteLink"]["3"] } end else result = { ["sitelink"] = '', ["errCode"] = 2, ["errMsg"] = cfgI18["getSiteLink"]["2"] } end else local entity = mw.wikibase.getEntityObject(id) if ( entity ~= nil ) then if ( entity.sitelinks ~= nil ) then sitelink = entity.sitelinks[wiki] if ( sitelink == nil ) then result = { ["sitelink"] = '', ["errCode"] = 0, ["errMsg"] = cfgI18["getSiteLink"]["0"] } else result = { ["sitelink"] = sitelink.title, ["errCode"] = 1, ["errMsg"] = cfgI18["getSiteLink"]["1"] } end else result = { ["sitelink"] = '', ["errCode"] = 3, ["errMsg"] = cfgI18["getSiteLink"]["3"] } end else result = { ["sitelink"] = '', ["errCode"] = 2, ["errMsg"] = cfgI18["getSiteLink"]["2"] } end end return result end -- zählt die Einträge einer Eigenschaft function wd.getPropertyCount ( claim ) -- local count = 0 -- for k,v in pairs ( claim ) do count = count + 1 end -- return count; return #claim end function wd.getBestStatement ( id, property ) local result = {} local statement = {} if ( id == nil or id == "" or id == "self" ) then if ( wdEntityId.hasID ) then statement = wdEntityId.entity:getBestStatements( property ) if ( next(statement) == nil ) then result = { ["statement"] = '', ["errCode"] = 0, ["errMsg"] = cfgI18["getStatement"]["0"], ["count"] = 0 } else result = { ["statement"] = statement, ["errCode"] = 1, ["errMsg"] = cfgI18["getStatement"]["1"], ["count"] = wd.getPropertyCount ( statement ) } end else result = { ["statement"] = '', ["errCode"] = 2, ["errMsg"] = cfgI18["getStatement"]["2"], ["count"] = 0 } end else local entity = mw.wikibase.getEntityObject(id) if ( entity ~= nil ) then statement = entity:getBestStatements( property ) if ( next(statement) == nil ) then result = { ["statement"] = '', ["errCode"] = 0, ["errMsg"] = cfgI18["getStatement"]["0"], ["count"] = 0 } else result = { ["statement"] = statement, ["errCode"] = 1, ["errMsg"] = cfgI18["getStatement"]["1"], ["count"] = wd.getPropertyCount ( statement ) } end else result = { ["statement"] = '', ["errCode"] = 2, ["errMsg"] = cfgI18["getStatement"]["2"], ["count"] = 0 } end end return result end function wd.getStatementAll ( id, property ) local result = {} local statement = '' if ( id == nil or id == "" or id == "self" ) then -- local entity = mw.wikibase.getEntityObject () if ( wdEntityId.hasID ) then statement = wdEntityId.entity:getBestStatements( property ) if ( next(statement) == nil ) then result = { ["statement"] = '', ["errCode"] = 0, ["errMsg"] = cfgI18["getStatement"]["0"], ["count"] = 0 } else result = { ["statement"] = wdEntityId.entity.claims[property], ["errCode"] = 1, ["errMsg"] = cfgI18["getStatement"]["1"], ["count"] = wd.getPropertyCount ( wdEntityId.entity.claims[property] ) } end else result = { ["statement"] = "", ["errCode"] = 0, ["errMsg"] = cfgI18["getStatement"]["0"], ["count"] = 0 } end else local entity = mw.wikibase.getEntityObject(id) if ( entity ~= nil ) then statement = entity.claims[property] if ( next(statement) == nil ) then result = { ["statement"] = '', ["errCode"] = 0, ["errMsg"] = cfgI18["getStatement"]["0"], ["count"] = 0 } else result = { ["statement"] = statement, ["errCode"] = 1, ["errMsg"] = cfgI18["getStatement"]["1"], ["count"] = wd.getPropertyCount ( statement ) } end else result = { ["statement"] = "", ["errCode"] = 2, ["errMsg"] = cfgI18["getStatement"]["2"], ["count"] = 0 } end end return result end function wd.Entity () return wdEntityId end function wd.EntityId () return wdEntityId.id end function wd.hasEntity () return wdEntityId.hasID end function wd.EntityIdErrCode () return wdEntityId.errCode end function wd.EntityIdErrText () return wdEntityId.errMsg end function wd.Label () return wd.getLabel().label end function wd.getQualifier ( property, qualifier, formatting, delimiter ) local formatString = formatting or '' local delimiterString = delimiter or ',' local result = { ["errCode"] = 0, ["errText"] = '', ["qualifier"] = '' } if property.qualifiers ~= nil then if property.qualifiers[qualifier] ~= nil then local out = {} for k,v in pairs(property.qualifiers[qualifier]) do if ( v.datavalue.type == 'time' ) then wdValue = v.datavalue.value.time -- Workaround für Timestamps, die nur ein Jahr repräsentieren wdValue = mw.ustring.gsub ( wdValue, '%-00%-00T00:00:00Z', '-01-01T00:00:00Z' ) if ( formatString ~= '' ) then wdValue = lang:formatDate ( formatString, wdValue ) end out[#out + 1] = wdValue end end result.errCode = 1 result.errText = cfgI18["getQualifier"]["1"] result.qualifier = table.concat(out, delimiterString) else result.errText = cfgI18["getQualifier"]["0"] end else result.errText = cfgI18["getQualifier"]["0"] end return result end function wd.getProperty ( claim, formatting, showRanking, label, parameters ) if ( claim[1] ~= nil ) then local wdValue = '' local delimiter = cfgDelimiters[claim[1].mainsnak.property] if ( delimiter == nil ) then delimiter = cfgDelimiters["default"] end if ( formatting == nil ) then formatting = 'default' end local formatString = cfgFormats[formatting] or cfgFormats["default"] local formatStringParameters = mw.ustring.match ( formatString, '//.-#' ) if ( formatStringParameters ~= nil ) then formatString = string.sub ( formatString, 1 , string.find ( formatString, formatStringParameters ) - 1 ) .. '#' end local qualifierParameters = mw.ustring.match ( formatString, '#QUALIFIER:.-#' ) or '' local qualifierParameter = mw.ustring.gsub( qualifierParameters, '#QUALIFIER:(.-):(.-)#', '%1' ) or '' local qualifierFormat = mw.ustring.gsub( qualifierParameters, '#QUALIFIER:(.-):(.-)#', '%2' ) or '' local qualifierResult = {} if ( showRanking == nil ) then showRanking = false end if ( label == nil ) then label = wd.getLabel().label end local out = {} if ( claim[1].mainsnak.datatype == 'wikibase-item' ) then for k,v in pairs ( claim ) do wdValue = wd.getLabel( "Q" .. v.mainsnak.datavalue.value["numeric-id"] ).label if ( wdValue == '' ) then wdValue = wd.getLabelLang( "Q" .. v.mainsnak.datavalue.value["numeric-id"], 'en' ).label end if ( formatStringParameters ~= nil ) then local tmpFormatStringParameters = string.sub ( formatStringParameters, 3 ) if ( string.sub ( tmpFormatStringParameters, 1, 9 ) == 'sitelink:' ) then local interwiki = string.sub ( tmpFormatStringParameters, 10 ) interwiki = mw.ustring.gsub( interwiki, '#', '' ) if ( interwiki ~= 'no' ) then local Link = wd.getSiteLink ( "Q" .. v.mainsnak.datavalue.value["numeric-id"], interwiki ) if ( Link.errCode == 1 ) then if ( interwiki == 'dewiki' ) then wdValue = '[[:w:' .. Link.sitelink .. '|' .. wdValue .. ']]' elseif ( interwiki == 'dewikivoyage' ) then wdValue = '[[' .. Link.sitelink .. '|' .. Link.sitelink:gsub ( '%(.*%)', '' ) .. ']]' end end end end else local deLink = wd.getSiteLink ( "Q" .. v.mainsnak.datavalue.value["numeric-id"] ) if ( deLink.errCode == 1 ) then wdValue = '[[' .. deLink.sitelink .. '|' .. wdValue .. ']]' end end wdValue = mw.ustring.gsub ( mw.ustring.gsub ( mw.ustring.gsub ( formatString, '#ID#', "Q" .. v.mainsnak.datavalue.value["numeric-id"] ), '#LABEL#', label ), '#PROPERTY#', wdValue ) if showRanking then out[#out + 1] = '<span class="wd-rank-' .. v.rank .. '">' .. wdValue .. '</span>' else out[#out + 1] = wdValue end end elseif ( claim[1].mainsnak.datatype == 'commonsMedia' ) then for k,v in pairs ( claim ) do wdValue = v.mainsnak.datavalue.value wdValue = mw.ustring.gsub ( formatString, '#PROPERTY#', wdValue ) out[#out + 1] = wdValue end elseif ( claim[1].mainsnak.datatype == 'quantity' ) then for k,v in pairs ( claim ) do wdValue = tostring ( tonumber ( v.mainsnak.datavalue.value.amount ) ) wdValue = mw.ustring.gsub ( mw.ustring.gsub ( formatString, '#FORMAT:T#', wd.formatNumberT ( wdValue ) ), '#PROPERTY#', wdValue ) if ( qualifierParameters ~= '' ) then qualifierResult = wd.getQualifier ( v, qualifierParameter, qualifierFormat ) wdValue = mw.ustring.gsub ( wdValue, qualifierParameters, qualifierResult.qualifier ) end local unit = cfgUnits[v.mainsnak.datavalue.value.unit] or '' wdValue = mw.ustring.gsub ( wdValue, '#UNIT#', unit ) if showRanking then out[#out + 1] = '<span class="wd-rank-' .. v.rank .. '">' .. wdValue .. '</span>' else out[#out + 1] = wdValue end end elseif ( claim[1].mainsnak.datatype == 'globe-coordinate' ) then local lat = '' local long = '' local precision = '' for k,v in pairs ( claim ) do lat = tonumber ( v.mainsnak.datavalue.value.latitude ) long = tonumber ( v.mainsnak.datavalue.value.longitude ) precision = tonumber ( v.mainsnak.datavalue.value.precision ) wdValue = mw.ustring.gsub ( mw.ustring.gsub ( mw.ustring.gsub ( formatString, '#LAT#', lat ), '#LONG#', long ), '#PRECISION#', precision ) if showRanking then out[#out + 1] = '<span class="wd-rank-' .. v.rank .. '">' .. wdValue .. '</span>' else out[#out + 1] = wdValue end end elseif ( claim[1].mainsnak.datatype == 'url' ) then for k,v in pairs ( claim ) do out[#out + 1] = mw.ustring.gsub ( mw.ustring.gsub ( mw.ustring.gsub ( formatString, '#PROPERTY#', v.mainsnak.datavalue.value ), '#PROPERTY_NO_HTTP#', v.mainsnak.datavalue.value:gsub ( 'https?://', '' ) ), '#LABEL#', label ) end elseif ( claim[1].mainsnak.datatype == 'string' ) then for k,v in pairs ( claim ) do out[#out + 1] = mw.ustring.gsub ( formatString, '#PROPERTY#', v.mainsnak.datavalue.value ) end end local propertyValue = table.concat(out, delimiter) if ( parameters ~= nil ) then for k,v in pairs ( parameters ) do propertyValue = mw.ustring.gsub ( propertyValue , '#PARAMETER' .. k .. '#', v ) end end return propertyValue else return '' end end -- Funktionen für spezielle Properties zur Verwendung in anderen Moduleen function wd.getDomain ( id ) local result = wd.getBestStatement ( id, 'P17' ) if ( result.errCode == 1 ) then local country = "Q" .. result.statement[1].mainsnak.datavalue.value["numeric-id"] result = wd.getBestStatement ( country, 'P78' ) if ( result.errCode == 1 ) then -- return wd.getLabel ( "Q" .. result.statement[1].mainsnak.datavalue.value["numeric-id"] ).label ) return mw.wikibase.label ( "Q" .. result.statement[1].mainsnak.datavalue.value["numeric-id"] ) else return '' end else return '' end end function wd.getCoordinates ( id ) local item = wd.getBestStatement ( id, 'P625' ) local result = { ["errCode"] = 0, ["lat"] = 0, ["long"] = 0, ["precision"] = 0 } result.errCode = item.errCode if ( item.errCode == 1 ) then result.lat = tonumber ( item.statement[1].mainsnak.datavalue.value.latitude ) result.long = tonumber ( item.statement[1].mainsnak.datavalue.value.longitude ) result.precision = tonumber ( item.statement[1].mainsnak.datavalue.value.precision ) end return result end function wd.getProvince ( id ) local newSearch = true local provinceID = id local provinceLabelID = '' local labelProvince = wd.getLabel().label local labelProvinceLink = '' local labelProvinceLabel = '' local isAn = {} local result = { ["errCode"] = 0, ["errTxt"] = '', ["errTxtShort"] = '', ["province"] = '', ["provinceLink"] = '', ["provinceLabel"] = 'Provinz' } local item = wd.getBestStatement ( id, 'P131' ) result.errCode = item.errCode while newSearch do if ( item.errCode == 1 and item.statement[1].mainsnak.datavalue ~= nil ) then provinceID = 'Q' .. item.statement[1].mainsnak.datavalue.value["numeric-id"] isAn = wd.getBestStatement ( provinceID, 'P31' ) if ( isAn.errCode == 1 ) then provinceLabelID = 'Q' .. isAn.statement[1].mainsnak.datavalue.value["numeric-id"] labelProvince = wd.getLabel ( provinceID ).label labelProvinceLabel = wd.getLabel ( provinceLabelID ).label if ( cfgGeography["counties"][provinceLabelID] ) then item = wd.getBestStatement ( provinceID, 'P131' ) --newSearch = false elseif ( cfgGeography["provinces"][provinceLabelID] ) then result.errCode = 1 result.errTxt = cfgI18["getProvince"]["1"] result.province = labelProvince labelProvinceLink = wd.getSiteLink ( provinceID ).sitelink if ( labelProvinceLink == '' ) then result.provinceLink = labelProvince else result.provinceLink = '[[' .. labelProvinceLink .. '|' .. mw.ustring.gsub( labelProvinceLink, '%s%(.*%)', '' ) .. ']]' end -- derzeit eigenes Label. Wenn Wikidata gewünscht: labelProvinceLabel benutzen result.provinceLabel = cfgGeography["provinces"][provinceLabelID] newSearch = false else result.errCode = 3 result.errTxt = cfgI18["getProvince"]["3"] .. provinceLabelID result.errTxtShort = 'unbekannte Verwaltungseinheit: [[:wikidata:' .. provinceLabelID .. '|' .. provinceLabelID .. ']] ([[Module:Wikidata2/Geography|edit]])[[Kategorie:Artikel mit unbekannter Verwaltungseinheit auf Wikidata]]' newSearch = false end else result.errCode = 2 result.errTxt = cfgI18["getProvince"]["2"] .. wd.getLabel ( provinceID ).label result.errTxtShort = 'Verwaltungseinheit [[:wikidata:' .. provinceID .. '|' .. provinceID .. ']] hat kein <em>ist ein(e)</em>[[Kategorie:Artikel mit unbekannter Verwaltungseinheit auf Wikidata]]' newSearch = false end else if ( provinceID == 'self' ) then provinceID = wd.EntityId() end result.errCode = 0 result.errTxt = cfgI18["getProvince"]["0"] result.errTxtShort = '[[:wikidata:' .. provinceID .. '|' .. labelProvince .. ']] hat keine übergeordnete Region.[[Kategorie:Artikel ohne übergeordnete Verwaltungseinheit auf Wikidata]]' newSearch = false end end return result end -- Funktionen zur Verwendung in Vorlagen function wd.LabelByID ( frame ) local display = '' local errorStr = '' local id = wdGetParameter ( frame, cfgParams["LabelByID"], "id" ) local result = wd.getLabel(id) display = result.label if ( result.errCode ~= 1 ) then errorStr = errorStr .. check._error ( 'Funktion <span style="font-weight: bold; font-style:italic">LabelByID</span>: ' .. result.errMsg .. "ID: " .. id, 'Wikidata2' ) end return errorStr .. check._testParams ( frame:getParent().args, cfgParams["LabelByID"], 'Wikidata2', 'lower' ) .. display end function wd.LabelLang ( frame ) local display = '' local lang= wdGetParameter ( frame, cfgParams["LabelLang"], "lang" ) local result = wd.getLabelLang ( 'self', lang ) if ( result.label ~= nil ) then display = result.label end return check._testParams ( frame:getParent().args, cfgParams["LabelLang"], "Wikidata2", 'lower' ) .. display end function wd.LabelLangByID ( frame ) local display = '' local id= wdGetParameter ( frame, cfgParams["LabelLang"], "id" ) local lang= wdGetParameter ( frame, cfgParams["LabelLang"], "lang" ) local result = wd.getLabelLang ( id, lang ) if ( result.label ~= nil ) then display = result.label end return check._testParams ( frame:getParent().args, cfgParams["LabelLangByID"], 'Wikidata2', 'lower' ) .. display end function wd.LabelLangByIDRaw ( id, lang ) return wd.getLabelLang ( id, lang ) end function wd.dumpEntity ( frame ) local vd = require('Module:VarDump') local display = '' local id = wdGetParameter ( frame, cfgParams["dumpEntity"], "id" ) local property = mw.ustring.gsub ( wdGetParameter ( frame, cfgParams["dumpEntity"], "p" ), 'p', 'P' ) if ( property == '' ) then display = display .. vd.dump ( mw.wikibase.getEntityObject(id) ) else display = display .. vd.dump ( wd.getStatementAll ( id, property ).statement ) end return check._testParams ( frame:getParent().args, cfgParams["dumpEntity"], "Wikidata2", 'lower' ) .. display end function wd.getValue ( frame ) local vd = require('Module:VarDump') local errorStr = '' local display = '' local result = {} local id = wdGetParameter ( frame, cfgParams["getValue"], "id" ) if ( id == 'self' ) then id = wdEntityId.id end local property = mw.ustring.gsub ( wdGetParameter ( frame, cfgParams["getValue"], "p" ), 'p', 'P' ) local ranking = wdGetParameter ( frame, cfgParams["getValue"], "ranking" ) local formatting = wdGetParameter ( frame, cfgParams["getValue"], "format" ) if (formatting == '' ) then formatting = property end local showRanking = wdGetParameter ( frame, cfgParams["getValue"], "showRanking" ) if ( ranking == 'all' ) then result = wd.getStatementAll ( id, property ) else result = wd.getBestStatement ( id, property ) end if ( result.errCode == 1 ) then display = display .. wd.getProperty ( result.statement, formatting, yesno ( showRanking ), wd.getLabel(id).label ) else errorStr = errorStr .. check._error ( 'FEHLER (Code: ' .. result.errCode .. '): ' .. result.errMsg .. '(ID= ' .. id .. ', Property= ' .. property .. ')', 'Wikidata2' ) if ( result.errCode == 2 ) then display = display .. '[[Kategorie:Artikel ohne Objekt auf Wikidata]]' end end -- display = display .. vd.dump ( result.statement ) return errorStr .. check._testParams ( frame:getParent().args, cfgParams["getValue"], 'Wikidata2', 'lower' ) .. display end function wd.getPOIType ( frame ) local errorStr = '' local display = '' local poiType = '' local result = {} local id = wdGetParameter ( frame, cfgParams["getValue"], "id" ) result = wd.getBestStatement ( id, 'P31' ) if ( result.errCode == 0 ) then -- Property nicht befüllt > Standard display = display .. cfgPOITypes["default"] elseif ( result.errCode == 1 ) then -- was gefunden, ersten Eintrag holen, wenn nichts brauchbares da, dann Standard poiType = cfgPOITypes["Q" .. result.statement[1].mainsnak.datavalue.value["numeric-id"]] if ( poiType == nil ) then poiType = cfgPOITypes["default"] end display = display .. poiType else -- kein Objekt mit der ID vorhanden: Fehlermeldung und Standardtyp display = display .. cfgPOITypes["default"] errorStr = errorStr .. check._error ( 'FEHLER (Code: ' .. result.errCode .. '): ' .. result.errMsg .. '(ID= ' .. id .. ')', 'Wikidata2' ) .. '[[Kategorie:Artikel ohne Objekt auf Wikidata]]' end return errorStr .. check._testParams ( frame:getParent().args, cfgParams["getPOIType"], 'Wikidata2', 'lower' ) .. display end function wd.getPOITypeDefault () return cfgPOITypes["default"] end function wd.getOfficialWebsite ( frame ) local display = '' local result = {} local text = wdGetParameter ( frame, cfgParams["getValue"], "text" ) local id = wdGetParameter ( frame, cfgParams["getValue"], "id" ) result = wd.getBestStatement ( id, 'P856' ) if ( result.errCode == 0 ) then -- Property nicht befüllt > Standard display = 'Eine offizielle Webseite ist nicht bekannt.<span class="wd-tools-message-inline"> Bitte auf [[:wikidata:' .. wdEntityId.id .. '|Wikidata]] nachtragen.</span>[[Kategorie:Artikel ohne offizielle Webseite auf Wikidata]]' elseif ( result.errCode == 1 ) then -- was gefunden, ersten Eintrag holen, wenn nichts brauchbares da, dann Standard display = display .. wd.getProperty ( result.statement, 'P856-link+site' ) if ( text ~= '' ) then display = '<span class="wikidata-content">' .. display .. '</span>' .. ' – ' .. text else if ( result.count == 1 ) then display = '<span class="wikidata-content">' .. display .. '</span>' .. ' – Offizielle Webseite von ' .. wd.getLabel(id).label elseif ( result.count > 1 ) then display = '<span class="wikidata-content">' .. display .. '</span>' .. ' – Offizielle Webseiten von ' .. wd.getLabel(id).label else end end else -- kein Objekt mit der ID vorhanden: Fehlermeldung und Standardtyp display = 'Eine offizielle Webseite ist nicht bekannt.<span class="wd-tools-message-inline"> Objekt bitte auf [[:wikidata:Wikidata:Main Page|Wikidata]] nachtragen.</span>[[Kategorie:Artikel ohne Objekt auf Wikidata]]' end return check._testParams ( frame:getParent().args, cfgParams["getOfficialWebsite"], 'Wikidata2', 'lower' ) .. display end return wd