יחידה:Wikidata – הבדלי גרסאות

תוכן שנמחק תוכן שנוסף
מאין תקציר עריכה
אין תקציר עריכה
שורה 277:
end
return result
end
 
-- Check if the 'qualifierId' exists on the 'property' of given 'id'
function p.isClaimExist(property, qualifierId, id)
-- get wikidata entity
local entity = mw.wikibase.getEntityObject(id or nil)
if not entity then
return false
end
-- fetch the first claim of satisfying the given property
local claims = findClaims(entity, property)
if not claims or not claims[1] then
return false
end
-- get initial sort indices
local sortindices = {}
for idx in pairs(claims) do
sortindices[#sortindices + 1] = idx
end
-- check if there is an element
local claim = claims[sortindices[1]]
result, error = getValueOfClaim(claim, qualifierId, parameter)
return result ~= nil
end