<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FMarsupium%2FObject</id>
	<title>Module:Sandbox/Marsupium/Object - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FMarsupium%2FObject"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Marsupium/Object&amp;action=history"/>
	<updated>2026-04-21T04:47:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sandbox/Marsupium/Object&amp;diff=145779&amp;oldid=prev</id>
		<title>imported&gt;Marsupium: implement &quot;street number&quot; (P670)) qualifier of &quot;located on street&quot; (P669) claims</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Marsupium/Object&amp;diff=145779&amp;oldid=prev"/>
		<updated>2022-06-23T10:01:35Z</updated>

		<summary type="html">&lt;p&gt;implement &amp;quot;street number&amp;quot; (P670)) qualifier of &amp;quot;located on street&amp;quot; (P669) claims&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local wd = require(&amp;#039;Module:Wd&amp;#039;)&lt;br /&gt;
local wikidata = require(&amp;#039;Module:Wikidata&amp;#039;)&lt;br /&gt;
-- local wikidataIB = require(&amp;#039;Module:WikidataIB&amp;#039;)&lt;br /&gt;
local coordinates = require(&amp;#039;Module:Coordinates&amp;#039;)&lt;br /&gt;
-- local mapframe = require(&amp;#039;Module:Mapframe&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local function findLabel(qid)&lt;br /&gt;
	local langs = {&amp;#039;en&amp;#039;, &amp;#039;de&amp;#039;}&lt;br /&gt;
	local label&lt;br /&gt;
	local i = 0&lt;br /&gt;
	while not label and i &amp;lt;= #langs do&lt;br /&gt;
		i = i + 1&lt;br /&gt;
		label = mw.wikibase.getLabelByLang(qid, langs[i])&lt;br /&gt;
	end&lt;br /&gt;
	return label&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.object(frame)&lt;br /&gt;
	local args = frame:getParent().args&lt;br /&gt;
	local qid = mw.text.trim(frame.args[1]) or &amp;#039;Q4115189&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	-- name&lt;br /&gt;
	local sitelink = mw.wikibase.getSitelink(qid)&lt;br /&gt;
	local label = findLabel(qid) or qid&lt;br /&gt;
	local linkedLabel = sitelink and (&amp;#039;[[&amp;#039; .. sitelink .. &amp;#039;|&amp;#039; .. label .. &amp;#039;]]&amp;#039;) or label&lt;br /&gt;
	local nativeLabel = wd._properties( {&amp;#039;multilanguage&amp;#039;, qid, &amp;#039;P1705&amp;#039;} )&lt;br /&gt;
	nativeLabel = (nativeLabel and nativeLabel ~= &amp;#039;&amp;#039; and mw.ustring.format(&amp;#039;/&amp;lt;small&amp;gt;%s&amp;lt;/small&amp;gt;&amp;#039;, nativeLabel)) or &amp;#039;&amp;#039;&lt;br /&gt;
	local name = linkedLabel .. nativeLabel .. &amp;#039; [[File:Wikidata-logo.svg|12px|Wikidata|link=//www.wikidata.org/wiki/&amp;#039;&lt;br /&gt;
	.. qid .. &amp;#039;]][[File:Wikidata-Reasonator_small_logo.svg|12px|Reasonator|link=//tools.wmflabs.org/reasonator/test/?q=&amp;#039;&lt;br /&gt;
	.. qid .. &amp;#039;]]&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	-- time&lt;br /&gt;
	local demolished = false&lt;br /&gt;
	local timesList = {}&lt;br /&gt;
	local demolitionDate = wd._properties({qid, &amp;#039;P576&amp;#039;})&lt;br /&gt;
	demolitionDate = demolitionDate ~= &amp;#039;&amp;#039; and (&amp;#039;demolished: &amp;#039; .. demolitionDate) or nil&lt;br /&gt;
	local inception = wikidata.claim({args={&amp;#039;P571&amp;#039;, id=qid}})&lt;br /&gt;
	timesList[#timesList+1] = inception&lt;br /&gt;
	local startTime = wikidata.claim({args={&amp;#039;P580&amp;#039;, id=qid}})&lt;br /&gt;
	local endTime = wikidata.claim({args={&amp;#039;P582&amp;#039;, id=qid}})&lt;br /&gt;
	local timespan = (startTime or endTime) and ((startTime or &amp;#039;&amp;#039;) .. &amp;#039;-&amp;#039; .. (endTime or &amp;#039;&amp;#039;))&lt;br /&gt;
	timesList[#timesList+1] = timespan&lt;br /&gt;
	local conservationStatus = wd._properties({&amp;#039;raw&amp;#039;, qid, &amp;#039;P5816&amp;#039;})&lt;br /&gt;
	local architecturalStyle = wikidata.claim({args={&amp;#039;P149&amp;#039;, id=qid, list=&amp;#039;, &amp;#039;, parameter=&amp;#039;link&amp;#039;}})&lt;br /&gt;
	timesList[#timesList+1] = (architecturalStyle and mw.ustring.format(&amp;#039;&amp;lt;small&amp;gt;%s&amp;lt;/small&amp;gt;&amp;#039;, architecturalStyle)) &lt;br /&gt;
	if demolitionDate or (conservationStatus == &amp;#039;Q56556915&amp;#039;) then&lt;br /&gt;
		demolished = true&lt;br /&gt;
		timesList[#timesList+1] = demolitionDate&lt;br /&gt;
		timesList[#timesList+1] = &amp;#039;demolished or destroyed&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local timesAndStyles = table.concat(timesList, &amp;#039;; &amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	-- architect&lt;br /&gt;
	local architect = wikidata.claim({args={&amp;#039;P84&amp;#039;, id=qid, list=&amp;#039;, &amp;#039;, parameter=&amp;#039;link&amp;#039;}}) or &amp;#039;&amp;#039;&lt;br /&gt;
	-- architect sortkey&lt;br /&gt;
	local architectSort = &amp;#039;&amp;#039;&lt;br /&gt;
	local bestArchStmts = mw.wikibase.getBestStatements(qid, &amp;#039;P84&amp;#039;)&lt;br /&gt;
	if bestArchStmts[1] and bestArchStmts[1].mainsnak.datavalue then&lt;br /&gt;
		-- no &amp;quot;datavalue&amp;quot; for unknown value&lt;br /&gt;
		local bestArchID = bestArchStmts[1].mainsnak.datavalue.value.id&lt;br /&gt;
		local bestFamilyNameStmts = mw.wikibase.getBestStatements(bestArchID, &amp;#039;P734&amp;#039;)&lt;br /&gt;
		if bestFamilyNameStmts[1] and bestFamilyNameStmts[1].mainsnak.datavalue then&lt;br /&gt;
			local bestFamilyNameID = bestFamilyNameStmts[1].mainsnak.datavalue.value.id&lt;br /&gt;
			local i = 0&lt;br /&gt;
			while not label and i &amp;lt;= #langs do&lt;br /&gt;
				i = i + 1&lt;br /&gt;
				label = mw.wikibase.getLabelByLang(qid, langs[i])&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			local architectSortValue = findLabel(bestFamilyNameID)&lt;br /&gt;
			architectSort = architectSortValue and mw.ustring.format(&amp;#039;data-sort-value=&amp;quot;%s&amp;quot;|&amp;#039;, architectSortValue) or &amp;#039;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- image&lt;br /&gt;
	local image = wikidata.claim({args={&amp;#039;P18&amp;#039;, id=qid}})&lt;br /&gt;
	local img = image and mw.ustring.format(&amp;#039;[[File:%s|50x50px]]&amp;#039;, image) or &amp;#039;&amp;#039;&lt;br /&gt;
	local catName = wikidata.claim({args={&amp;#039;P373&amp;#039;, id=qid}})&lt;br /&gt;
	local cat = catName and mw.ustring.format(&amp;#039;[[File:Commons-logo.svg|x16px|alt=|link=//commons.wikimedia.org/wiki/Category:%s|Commons]]&amp;#039;, mw.uri.encode(catName, &amp;#039;WIKI&amp;#039;)) or &amp;#039;&amp;#039;&lt;br /&gt;
	local img = img .. cat&lt;br /&gt;
	&lt;br /&gt;
	-- location&lt;br /&gt;
	local coordStatements = mw.wikibase.getBestStatements(qid, &amp;#039;P625&amp;#039;)&lt;br /&gt;
	local coordError = false&lt;br /&gt;
	if not coordStatements or #coordStatements == 0 then&lt;br /&gt;
		coordError = true&lt;br /&gt;
	end&lt;br /&gt;
	local hasNoValue = not coordError and (coordStatements[1].mainsnak and (coordStatements[1].mainsnak.snaktype == &amp;#039;novalue&amp;#039; or coordStatements[1].mainsnak.snaktype == &amp;#039;somevalue&amp;#039;) )&lt;br /&gt;
	if hasNoValue then&lt;br /&gt;
		coordError = true&lt;br /&gt;
	end&lt;br /&gt;
	local map&lt;br /&gt;
	local wdCoords = not coordError and coordStatements[1][&amp;#039;mainsnak&amp;#039;][&amp;#039;datavalue&amp;#039;][&amp;#039;value&amp;#039;]&lt;br /&gt;
	if wdCoords then&lt;br /&gt;
		local lat, long = tonumber(wdCoords[&amp;#039;latitude&amp;#039;]), tonumber(wdCoords[&amp;#039;longitude&amp;#039;])&lt;br /&gt;
		local description = image and mw.ustring.format(&amp;#039;[[File:%s|100x100px]]&amp;#039;, image) or &amp;#039;&amp;#039; -- TODO: implement maybe more&lt;br /&gt;
		local maplinkTemplate = [=[&amp;lt;maplink text=&amp;quot;map&amp;quot; zoom=15 &amp;gt;&lt;br /&gt;
	[&lt;br /&gt;
	{&lt;br /&gt;
	  &amp;quot;type&amp;quot;: &amp;quot;Feature&amp;quot;,&lt;br /&gt;
	  &amp;quot;geometry&amp;quot;: { &amp;quot;type&amp;quot;: &amp;quot;Point&amp;quot;, &amp;quot;coordinates&amp;quot;: [%s, %s] },&lt;br /&gt;
	  &amp;quot;properties&amp;quot;: {&lt;br /&gt;
	    &amp;quot;title&amp;quot;: &amp;quot;%s&amp;quot;,&lt;br /&gt;
		&amp;quot;description&amp;quot;: &amp;quot;%s&amp;quot;,&lt;br /&gt;
	    &amp;quot;marker-symbol&amp;quot;: &amp;quot;-number&amp;quot;&lt;br /&gt;
	  }&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		&amp;quot;type&amp;quot;: &amp;quot;ExternalData&amp;quot;,&lt;br /&gt;
		&amp;quot;service&amp;quot;: &amp;quot;geoshape&amp;quot;,&lt;br /&gt;
		&amp;quot;ids&amp;quot;: &amp;quot;%s&amp;quot;,&lt;br /&gt;
	},&lt;br /&gt;
	]&amp;lt;/maplink&amp;gt;]=]&lt;br /&gt;
		local mf = mw.ustring.format(maplinkTemplate, long, lat, linkedLabel, description, qid)&lt;br /&gt;
		map = frame:preprocess(mf)&lt;br /&gt;
	end&lt;br /&gt;
--	local coordTemplate = coordinates._coord({qid=qid, name=label})&lt;br /&gt;
--	coordTemplate = (not coordError and coordTemplate and mw.ustring.format(&amp;#039;&amp;lt;small&amp;gt;%s&amp;lt;/small&amp;gt;&amp;#039;, coordTemplate)) or nil&lt;br /&gt;
	&lt;br /&gt;
	local coordArgs = {}&lt;br /&gt;
	local math_mod = require(&amp;quot;Module:Math&amp;quot;)&lt;br /&gt;
	local entity = mw.wikibase.getEntityObject(qid)&lt;br /&gt;
	if entity&lt;br /&gt;
		and entity.claims&lt;br /&gt;
		and entity.claims.P625&lt;br /&gt;
		and entity.claims.P625[1].mainsnak.snaktype == &amp;#039;value&amp;#039;&lt;br /&gt;
	then&lt;br /&gt;
		local precision = entity.claims.P625[1].mainsnak.datavalue.value.precision&lt;br /&gt;
		coordArgs[1] = entity.claims.P625[1].mainsnak.datavalue.value.latitude&lt;br /&gt;
		coordArgs[2] = entity.claims.P625[1].mainsnak.datavalue.value.longitude&lt;br /&gt;
		if precision then&lt;br /&gt;
			precision = -math_mod._round(math.log(precision)/math.log(10),0)&lt;br /&gt;
			coordArgs[1] = math_mod._round(coordArgs[1],precision)&lt;br /&gt;
			coordArgs[2] = math_mod._round(coordArgs[2],precision)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local coordTemplate2 = not coordError and mw.ustring.format(&amp;#039;{{coord|%s|%s|type:landmark|name=%s}}&amp;#039;, coordArgs[1], coordArgs[2], label)&lt;br /&gt;
	coordTemplate2 = coordTemplate2 and frame:preprocess(coordTemplate2)&lt;br /&gt;
	coordTemplate2 = (coordTemplate2 and mw.ustring.format(&amp;#039;&amp;lt;small&amp;gt;%s&amp;lt;/small&amp;gt;&amp;#039;, coordTemplate2)) or nil&lt;br /&gt;
	&lt;br /&gt;
	local locList = {}&lt;br /&gt;
	locList[#locList+1] = map&lt;br /&gt;
--	locList[#locList+1] = coordTemplate&lt;br /&gt;
	locList[#locList+1] = coordTemplate2&lt;br /&gt;
	locList[#locList+1] = wikidata.claim({args={&amp;#039;P131&amp;#039;, id=qid, list=&amp;#039;, &amp;#039;, parameter=&amp;#039;link&amp;#039;}})&lt;br /&gt;
	locList[#locList+1] = wikidata.claim({args={&amp;#039;P969&amp;#039;, id=qid, list=&amp;#039;, &amp;#039;, parameter=&amp;#039;link&amp;#039;}})&lt;br /&gt;
	-- &amp;quot;located on street&amp;quot; (P669) with &amp;quot;street number&amp;quot; (P670) qualifier&lt;br /&gt;
	local street = wd._properties( {&amp;#039;qualifiers&amp;#039;, qid, &amp;#039;P669&amp;#039;, &amp;#039;P670&amp;#039;} )&lt;br /&gt;
	locList[#locList+1] = (street and street ~= &amp;#039;&amp;#039; and street) or nil&lt;br /&gt;
	local address = wd._properties( {&amp;#039;multilanguage&amp;#039;, qid, &amp;#039;P6375&amp;#039;} )&lt;br /&gt;
	locList[#locList+1] = (address and address ~= &amp;#039;&amp;#039; and mw.ustring.format(&amp;#039;&amp;lt;small&amp;gt;%s&amp;lt;/small&amp;gt;&amp;#039;, address)) or nil&lt;br /&gt;
	locList[#locList+1] = args.hours&lt;br /&gt;
	local fee = wd._properties( {&amp;#039;qualifiers&amp;#039;, qid, &amp;#039;P2555&amp;#039;, &amp;#039;P6001&amp;#039;} )&lt;br /&gt;
	locList[#locList+1] = (fee and fee ~= &amp;#039;&amp;#039; and &amp;#039;fee: &amp;#039; .. fee) or nil&lt;br /&gt;
	local opening = wd._properties( {[&amp;#039;format&amp;#039;]=&amp;quot;&amp;#039;&amp;#039;%q &amp;lt;small&amp;gt;(%p)&amp;lt;/small&amp;gt;[%s][%r]&amp;#039;&amp;#039;&amp;quot;,&lt;br /&gt;
		[&amp;#039;sep%q&amp;#039;]=&amp;#039;-&amp;#039;, &amp;#039;qualifiers&amp;#039;, &amp;#039;qualifiers&amp;#039;, &amp;#039;qualifiers&amp;#039;, qid, &amp;#039;P3025&amp;#039;, &amp;#039;P8626&amp;#039;, &amp;#039;P8627&amp;#039;, &amp;#039;P1264&amp;#039;} )&lt;br /&gt;
	locList[#locList+1] = ((type(opening) == &amp;#039;string&amp;#039;) and (opening ~= &amp;#039;&amp;#039;) and &amp;#039;open: &amp;#039; .. opening) or nil&lt;br /&gt;
	local location = table.concat(locList, &amp;#039;; &amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	-- literature&lt;br /&gt;
	local litList = {}&lt;br /&gt;
	litList[#litList+1] = args.lit&lt;br /&gt;
--	local describedBySourceIB = wikidataIB._getValue({&amp;#039;P1343&amp;#039;, parameterset=1, qid=qid, qual=&amp;#039;P304&amp;#039;})&lt;br /&gt;
--	litList[#litList+1] = describedBySourceIB&lt;br /&gt;
	local describedBySource2 = wd._properties( {&amp;#039;linked&amp;#039;, &amp;#039;qualifiers&amp;#039;, qid, &amp;#039;P1343&amp;#039;, &amp;#039;P304&amp;#039;} )&lt;br /&gt;
	litList[#litList+1] = describedBySource2&lt;br /&gt;
	-- TODO: use [[Module:Cite Q]] for the books&lt;br /&gt;
	local structuraeID = wikidata.claim({args={&amp;#039;P454&amp;#039;, id=qid}})&lt;br /&gt;
	litList[#litList+1] = structuraeID and mw.ustring.format(&amp;#039;[https://structurae.net/structures/%s Structurae]&amp;#039;, structuraeID)&lt;br /&gt;
	local emporisID = wikidata.claim({args={&amp;#039;P455&amp;#039;, id=qid}})&lt;br /&gt;
	litList[#litList+1] = emporisID and mw.ustring.format(&amp;#039;[https://www.emporis.com/buildings/%s Emporis]&amp;#039;, emporisID)&lt;br /&gt;
	local archinformID = wikidata.claim({args={&amp;#039;P5383&amp;#039;, id=qid}})&lt;br /&gt;
	litList[#litList+1] = archinformID and mw.ustring.format(&amp;#039;[https://www.archinform.net/projekte/%s.htm archINFORM]&amp;#039;, archinformID)&lt;br /&gt;
	local berlinDID = wikidata.claim({args={&amp;#039;P2424&amp;#039;, id=qid}})&lt;br /&gt;
	litList[#litList+1] = berlinDID and mw.ustring.format(&amp;#039;[https://www.berlin.de/landesdenkmalamt/denkmale/liste-karte-datenbank/denkmaldatenbank/daobj.php?obj_dok_nr=%s Berlin D]&amp;#039;, berlinDID)&lt;br /&gt;
	local memoriademadridID = wikidata.claim({args={&amp;#039;P7372&amp;#039;, id=qid}})&lt;br /&gt;
	litList[#litList+1] = memoriademadridID and mw.ustring.format(&amp;#039;[http://www.memoriademadrid.es/buscador.php?accion=VerFicha&amp;amp;id=%s memoriademadrid]&amp;#039;, memoriademadridID)&lt;br /&gt;
	local misasorgID = wikidata.claim({args={&amp;#039;P7054&amp;#039;, id=qid}})&lt;br /&gt;
	litList[#litList+1] = misasorgID and mw.ustring.format(&amp;#039;[https://misas.org/p/%s misas.org]&amp;#039;, misasorgID)&lt;br /&gt;
	local coamID = wikidata.claim({args={&amp;#039;P2917&amp;#039;, id=qid}})&lt;br /&gt;
	litList[#litList+1] = coamID and mw.ustring.format(&amp;#039;[https://guia-arquitectura-madrid.coam.org/#inm.%s COAM]&amp;#039;, coamID)&lt;br /&gt;
	local lit = &amp;#039;\n* &amp;#039; .. table.concat(litList, &amp;#039;\n* &amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	local demolishedStyle = demolished and (&amp;#039;style=&amp;quot;background: pink;&amp;quot;&amp;#039;) or &amp;#039;&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	local tablerow = mw.ustring.format(&amp;#039;\n|-%s\n| %s \n| %s \n|%s %s \n| %s \n| %s \n| %s&amp;#039;,&lt;br /&gt;
		demolishedStyle, name, timesAndStyles, architectSort, architect, location, lit, img)&lt;br /&gt;
	return tablerow&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Marsupium</name></author>
	</entry>
</feed>