Modulo:Wikidata: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m a marzo 2016 ritradotto "identificativo esterno" |
entity-not-found in getLabel non necessario, "or nil" superflui, rivista getId e riaggiunta _getId rimossa per errore, commenti |
||
Riga 370:
-------------------------------------------------------------------------------
--
local function hasQualifierValue(statement, qualifierId, qualifierValue)
local ret = false
Riga 385:
end
--
local function filterRankValue(claims, rank)
local ret = {}
Riga 396:
end
--
-- oppure nil se l'entity o la proprietà non esistono.
-- Gli statement
-- "rank", "qualifier", "qualifiertype" e "n"
local function getClaims(property, args)
Riga 471:
end
-- con args.qualifiertype=latest
if args.qualifier and args.qualifiertype == 'latest' then
local latest, latestTime
Riga 489:
end
-- con args.n
if args.n then
local n = tonumber(args.n)
Riga 499:
-------------------------------------------------------------------------------
-- Funzioni esportate per altri
-------------------------------------------------------------------------------
Riga 514:
end
--
-- la proprietà non esistono, o se per parametri di selezione gli statement sono zero.
function p._getProperty(args, rawTable)
Riga 520:
-- parametri posizionali
property = args[1] and string.upper(args[1])
if not property then
error(i18n.errors['property-param-not-provided'], 2)
Riga 526:
value = args[2]
-- fix uppercase
args.qualifier = args.qualifier and string.upper(args.qualifier)
if value then
Riga 538:
end
--
-- o nil se l'entity o la proprietà non esistono, o se per parametri di selezione non ci sono risultati.
function p._getQualifier(args)
Riga 544:
-- parametri posizionali
property = args[1] and string.upper(args[1])
if not property then
error(i18n.errors['property-param-not-provided'], 2)
end
qualifier = args[2] and string.upper(args[2])
if not qualifier then
error(i18n.errors['qualifier-param-not-provided'], 2)
Riga 571:
end
--
function p._indexOf(args)
local ret, property, value, claims
-- parametri posizionali
property = args[1] and string.upper(args[1])
if not property then
error(i18n.errors['property-param-not-provided'], 2)
Riga 599:
end
--
function p._N(args)
local property, claims
-- parametri posizionali
property = args[1] and string.upper(args[1])
if not property then
error(i18n.errors['property-param-not-provided'], 2)
Riga 637:
end
--
function p._instanceOf(args)
return p._propertyHasEntity('P31', args)
end
--
function p._subclassOf(args)
return p._propertyHasEntity('P279', args)
end
--
function p._getLabel(args)
▲ local entity = mw.wikibase.getEntity(entityId)
if not entity then▼
end▼
end
--
function p._getLink(args)
-- parametri posizionali
local entityId = args[1] and string.upper(args[1])
if not entityId then
error(i18n.errors['entityid-param-not-provided'], 2)
Riga 672 ⟶ 664:
end
--
function p._getDatatype(args)
local ret, property, entity, datatype
-- parametri posizionali
property = args[1] and string.upper(args[1])
if not property then
error(i18n.errors['property-param-not-provided'], 2)
Riga 717 ⟶ 709:
end
--
-- (nota: segue i redirect fermandosi al primo redirect collegato a un elemento)
local title = mw.title.new(titleString)▼
local ret
while title do▼
local id = mw.wikibase.getEntityIdForTitle(title.prefixedText)▼
if id then▼
return id▼
▲ local id = mw.wikibase.getEntityIdForTitle(title.prefixedText)
▲ if id then
break
else
title = title.redirectTarget▼
end▼
end
else
▲ title = title.redirectTarget
end
return
end
-------------------------------------------------------------------------------
▲function p.getId( frame )
-- Funzioni esportate per i template
-------------------------------------------------------------------------------
▲ return mw.wikibase.getEntityIdForCurrentPage()
▲ end
--
function p.getProperty(frame)
return select(2, xpcall(function()
return p._getProperty(getArgs(frame, { parentOnly = true }))
end, errhandler))
end
--
function p.getQualifier(frame)
return select(2, xpcall(function()
return p._getQualifier(getArgs(frame, { parentOnly = true }))
end, errhandler))
end
--
function p.indexOf(frame)
return select(2, xpcall(function()
return p._indexOf(getArgs(frame, { parentOnly = true }))
end, errhandler))
end
--
function p.N(frame)
return select(2, xpcall(function()
return p._N(getArgs(frame, { parentOnly = true }))
end, errhandler))
end
--
function p.getLabel(frame)
return select(2, xpcall(function()
return p._getLabel(getArgs(frame, { parentOnly = true }))
end, errhandler))
end
--
function p.getLink(frame)
return select(2, xpcall(function()
return p._getLink(getArgs(frame, { parentOnly = true }))
end, errhandler))
end
--
function p.instanceOf(frame)
return select(2, xpcall(function()
return p._instanceOf(getArgs(frame, { parentOnly = true })) and 1 or ''
end, errhandler))
end
--
function p.getDatatype(frame)
return select(2, xpcall(function()
return p._getDatatype(getArgs(frame, { parentOnly = true }))
end, errhandler))
-- Funzione per il template {{WikidataId}}
function p.getId(frame)
return select(2, xpcall(function()
return p._getId(getArgs(frame, { parentOnly = true }))
end, errhandler))
end
|