יחידה:מוזיקאי

מתוך ויקיפדיה, האנציקלופדיה החופשית

ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:מוזיקאי/תיעוד

local p = {}
--[[
Filters statements to statements with existing links only
]]
function p.filterInstrument( propertyVals )
	local tempVals = {}
    for i, property in ipairs(propertyVals) do
    	local propValue = property.mainsnak and property.mainsnak.datavalue
    	if propValue and propValue.value then
			if propValue.value['id'] ~= 'Q17172850' then
				table.insert(tempVals, property)
			end
		end
	end
	return tempVals
end

function endedMember(property)
	local hasEnd = property.qualifiers and property.qualifiers.P582
	local hasStart = property.qualifiers and property.qualifiers.P580
	local startAfterEnd = hasEnd and hasStart and #property.qualifiers.P582 < #property.qualifiers.P580
	return hasEnd and not startAfterEnd
end

function p.filterMembers( propertyVals )
	local tempVals = {}
    for i, property in ipairs(propertyVals) do
    	if not endedMember(property) then
    		table.insert(tempVals, property)
    	end
	end
	return tempVals
end

function p.filterPastMembers( propertyVals )
	local tempVals = {}
    for i, property in ipairs(propertyVals) do
    	if endedMember(property) then
    		table.insert(tempVals, property)
    	end
	end
	return tempVals
end

return p