Modulo:Wikidata/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m fix spazi |
fix getClaims, più filtri insieme |
||
Riga 59:
local function getClaims( options )
local claims,
if not options.property then
Riga 72:
return -- formatError( 'entity-not-found' )
end
if entity.claims == nil or
entity.claims[property] == nil or
Riga 80:
end
▲ for i = 0, #entity.claims[property] do
▲ -- statements filtrati per rank
for i, claim in pairs(claims) do
▲ if statement.rank == options.rank then
if claim.rank ==
end
-- statements filtrati per qualifier▼
▲ end
if statement.qualifiers and statement.qualifiers[options.qualifier] then▼
if options.qualifier then
filteredClaims = {}
for i, claim in pairs(claims) do
if options.qualifiervalue then
if hasQualifierValue(
table.insert(
end
else
table.insert(
end
end
▲ else
▲ table.insert( claims, statement )
end
claims = filteredClaims
end
-- eventualmente ritorna solo l'n-esimo elemento
if options.n then
local n = tonumber( options.n )
if filteredClaims then
claims = (n and n <= #claims) and { claims[n] } or {} else
claims = (n and n <= #claims + 1) and { claims[n - 1] } or {}
end
end
|