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(propertypropertyId, args)
local entityId, claims, filteredClaims
Riga 435:
args.rank = args.rank or 'best'
if args.rank == 'best' then
claims = mw.wikibase.getBestStatements(entityId, propertypropertyId)
else
-- statements filtrati per rank
claims = mw.wikibase.getAllStatements(entityId, propertypropertyId)
claims = filterRankValue(claims, args.rank)
end
Riga 516:
-------------------------------------------------------------------------------
 
function p._getClaims(propertypropertyId, args)
return getClaims(propertypropertyId, args or {})
end
 
Riga 531:
-- la proprietà non esistono, o se per parametri di selezione gli statement sono zero.
function p._getProperty(args, rawTable)
local propertypropertyId, value, claims, ret
 
-- parametri posizionali
propertypropertyId = args[1] and string.upper(args[1])
if not propertypropertyId then
error(i18n.errors['property-param-not-provided'], 2)
end
Riga 545:
ret = formatUserValue(value, args)
elseif args.wd ~= 'no' then
claims = getClaims(propertypropertyId, args)
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 propertypropertyId, qualifier, value, claims, ret
 
-- parametri posizionali
propertypropertyId = args[1] and string.upper(args[1])
if not propertypropertyId then
error(i18n.errors['property-param-not-provided'], 2)
end
Riga 571:
ret = formatUserValue(value, args)
elseif args.wd ~= 'no' then
claims = getClaims(propertypropertyId, args)
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, propertypropertyId, value, claims
 
-- parametri posizionali
propertypropertyId = args[1] and string.upper(args[1])
if not propertypropertyId then
error(i18n.errors['property-param-not-provided'], 2)
end
Riga 599:
end
 
claims = getClaims(propertypropertyId, args)
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 propertypropertyId, claims
 
-- parametri posizionali
propertypropertyId = args[1] and string.upper(args[1])
if not propertypropertyId then
error(i18n.errors['property-param-not-provided'], 2)
end
-- get claims
claims = getClaims(propertypropertyId, args)
 
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(propertypropertyId, args)
local statements = p._getProperty({property propertyId, from = args.from, formatting = 'raw' }, true)
if statements then
for _, statement in ipairs(statements) do
Riga 682:
-- Restituisce il datatype di una proprietà Wikidata.
function p._getDatatype(args)
local propertypropertyId, entity
 
-- parametri posizionali
propertypropertyId = args[1] and string.upper(args[1])
if not propertypropertyId then
error(i18n.errors['property-param-not-provided'], 2)
end
 
entity = mw.wikibase.getEntity(propertypropertyId)
if not entity then
error(i18n.errors['entity-not-found'], 2)