Module:WikidataIB/sandbox1: Difference between revisions

Content deleted Content added
upgrade getValue to functionality of getValueAndQuals
getValueAndQuals consolidated into getValue
Line 628:
return assembleoutput(out, frame.args, entity.id, propertyID)
end
 
 
-------------------------------------------------------------------------------
-- _getvalueandquals processes public function p.getValueAndQuals
--
local function _getvalueandquals(frame, entity, props, filter, propertyID, qualID)
local out = propertyvalueandquals(props, frame.args, filter, qualID)
return assembleoutput(out, frame.args, entity.id, propertyID)
end
 
 
 
Line 726 ⟶ 716:
end
return _getvalue(frame, errorOrEntity, props, filter, propertyID)
end
 
 
-------------------------------------------------------------------------------
-- getValueAndQuals takes property ID and optional qualifier ID (qual)
-- returns values for a property along with values of matching qualifiers
-- implements getValue functionality
p.getValueAndQuals = function(frame)
if not frame.args[1] then
frame.args = frame:getParent().args
if not frame.args[1] then return i18n.errors["No property supplied"] end
end
local propertyID = mw.text.trim(frame.args[1] or "")
 
local success, errorOrEntity, props = parseInput(frame, frame.args[2], propertyID)
if not success then
return errorOrEntity
end
 
-- qualID is a string containing the property ID of the qualifier(s) to be returned
-- if qualID = "ALL" then all qualifiers returned
-- if nothing or an empty string is passed set it nil -> no qualifiers returned
local qualID = mw.text.trim(frame.args.qual or ""):upper()
if qualID == "" then qualID = nil end
 
local function filter(claim)
return true
end
return _getvalueandquals(frame, errorOrEntity, props, filter, propertyID, qualID)
end