Modulo:Wikidata/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
mNessun oggetto della modifica |
m rinominata property in propertyId, come per entityId e nel manuale |
||
Riga 424:
-- Gli statement restituiti sono eventualmente filtrati in base ai parametri:
-- "rank", "qualifier", "qualifiertype" e "n"
local function getClaims(
local entityId, claims, filteredClaims
Riga 435:
args.rank = args.rank or 'best'
if args.rank == 'best' then
claims = mw.wikibase.getBestStatements(entityId,
else
-- statements filtrati per rank
claims = mw.wikibase.getAllStatements(entityId,
claims = filterRankValue(claims, args.rank)
end
Riga 516:
-------------------------------------------------------------------------------
function p._getClaims(
return getClaims(
end
Riga 531:
-- la proprietà non esistono, o se per parametri di selezione gli statement sono zero.
function p._getProperty(args, rawTable)
local
-- parametri posizionali
if not
error(i18n.errors['property-param-not-provided'], 2)
end
Riga 545:
ret = formatUserValue(value, args)
elseif args.wd ~= 'no' then
claims = getClaims(
ret = (claims and #claims > 0) and formatStatements(claims, args, rawTable) or nil
end
Riga 555:
-- o nil se l'entity o la proprietà non esistono, o se per parametri di selezione non ci sono risultati.
function p._getQualifier(args)
local
-- parametri posizionali
if not
error(i18n.errors['property-param-not-provided'], 2)
end
Riga 571:
ret = formatUserValue(value, args)
elseif args.wd ~= 'no' then
claims = getClaims(
if claims and #claims > 0 then
local formattedQualifiers = {}
Riga 587:
-- Restituisce l'indice dello statement con il valore richiesto, o nil se non trovato.
function p._indexOf(args)
local ret,
-- parametri posizionali
if not
error(i18n.errors['property-param-not-provided'], 2)
end
Riga 599:
end
claims = getClaims(
if claims and #claims > 0 then
args.formatting = 'raw'
Riga 615:
-- Restituisce il numero di statement di una proprietà di Wikidata.
function p._N(args)
local
-- parametri posizionali
if not
error(i18n.errors['property-param-not-provided'], 2)
end
-- get claims
claims = getClaims(
return claims and #claims or 0
Riga 630:
-- Restituisce true se la propriertà specificata ha come valore
-- almeno uno tra gli entityId passati come argomento.
function p._propertyHasEntity(
local statements = p._getProperty({
if statements then
for _, statement in ipairs(statements) do
Riga 682:
-- Restituisce il datatype di una proprietà Wikidata.
function p._getDatatype(args)
local
-- parametri posizionali
if not
error(i18n.errors['property-param-not-provided'], 2)
end
entity = mw.wikibase.getEntity(
if not entity then
error(i18n.errors['entity-not-found'], 2)
|