Moduuli:Fr:Infobox/Fonctions/Bâtiment on aihe, joka on herättänyt monien ihmisten kiinnostuksen ajan myötä. Sen merkitys ilmenee jokapäiväisen elämän eri osa-alueilla populaarikulttuurista politiikkaan ja talouteen. Kun tutkimme sen vaikutuksia, löydämme mahdollisuuksien universumin, joka herättää uteliaisuutemme ja kutsuu meidät pohtimaan ihmisluontoa. Tässä artikkelissa perehdymme Moduuli:Fr:Infobox/Fonctions/Bâtiment:n syvyyksiin ja tutkimme sen alkuperää, vaikutuksia ja kehitystä historian aikana. Yksityiskohtaisen analyysin avulla pyrimme ymmärtämään paremmin tätä ilmiötä ja sen vaikutusta nykymaailmaan.
Tämä moduuli on osa ranskankielisestä Wikipediasta kopioitua Wikidata ja Interface Wikidata -moduulikokonaisuutta (ks. ohjeet ja esimerkit). Listauksen kaikista tähän liittyvistä moduuleista löydät Ranskankielisen Wikipedian Wikidata-moduulit -sivulta.
|
local p = {}
local localdata = require( 'Module:Fr:Infobox/Localdata' )
local item = localdata.item
local wd = require( 'Module:Fr:Interface Wikidata' ).fromLua
local general = require 'Module:Fr:Infobox/Fonctions'
local linguistic = require "Module:Fr:Linguistique"
local address = require "Module:Fr:Adresse"
local function keydate(event)
return wd.keyDate(event, item)
end
local function inclexcl(statement) -- formatte les qualificatifs "P518" / "P1011" (à mettre plutôt dans un sous module de Module:Fr:Wikidata, comme pour les dates ?
local str = wd.formatSnak(statement.mainsnak)
if not statement.qualifiers then
return str
end
local incl = wd.getFormattedQualifiers(statement, "P518")
local excl = wd.getFormattedQualifiers(statement, "P1011")
if incl then
str = str .. linguistic.inparentheses(" ml. " .. incl) -- pas la formulation la plus élégante mais elle évite les problèmes d'accord grammaticaux
end
if excl then
str = str .. linguistic.inparentheses("pl. " .. excl) -- pas la formulation la plus élégante mais elle évite les problèmes d'accord grammaticaux
end
return str
end
function p.creatorQuery(prop)
return {
property = prop,
entity = localdata.item,
showqualifiers = {'P518'},
showdate = true,
qualiflink = '-',
statementformat = function(statement)
local str
-- On commence par les qualificatifs (attibué à, atelier etc.)
local possiblequalifiers = {
P1773 = "attribué $to $creator",
P1774 = "atelier $of $creator",
P1775 = "suiveur $of $creator",
P1776 = "cercle $of $creator",
P1777 = "d'après $creator", -- TODO : d'après LE Maître X
P1778 = "faux d'après $creator",
P1779 = "$creator (?)",
P1780 = "école $orégf",
P1877 = "d'après un œuvre $of",
}
if statement.qualifiers then
for qualif, text in pairs(possiblequalifiers) do
local creator = wd.getFormattedQualifiers(statement, {qualif})
if creator then
str = text
str = mw.ustring.gsub(str, '$to $creator', "à ".. creator)
str = mw.ustring.gsub(str, '$of $creator', linguistic.of(creator))
str = mw.ustring.gsub(str, '$creator', creator)
break
end
end
end
-- Sinon, la voie normale
if not str then
str = wd.formatStatement(statement, {speciallabels = {Q4233718 = "anonyme"}}) -- speciallabels pour éviter le lien par défaut
end
return str
end
}
end
--Titrest
function p.title()
-- local class = en-tête par défaut à définir ici ?
return general.title()
end
--Image
function p.mainimage(cat, defaultimage)
if not cat then
cat = 'Article à illustrer Bâtiment divers'
end
return general.mainimage(cat, defaultimage)
end
function p.country()
return -- déprécié
end
function p.historicalregion()
return nil -- paramètre région mis dans adminlocation() : le gens l'utilisent pour la région administrative plutôt que pour la région historique
end
function p.adminlocation() -- Fonction assez compliquée du fait des différences entre infobox. Simlifiable si on harmonise les infobox
-- infobox à prendre en compte : bâtiment, gratte-ciel, gare, château
local streetstr = localdata or localdata
local area = localdata or localdata
local city = localdata or localdata
local div1 = localdata or localdata or localdata or localdata or localdata or localdata or localdata
local div2 = localdata or localdata or localdata or localdata or localdata
local div2_a = localdata
local div3 = localdata or localdata or localdata or localdata or localdata
local div3_a = localdata
local div3_b = localdata
local div3_c = localdata
local div3_d = localdata
local div3_e = localdata
local div4 = localdata or localdata or localdata
local citystr = linguistic.conj({area, city}, "comma")
local divstr = linguistic.conj({div1, div2, div2_a, div3, div3_a, div3_b, div3_c, div3_d, div3_e}, "comma")
divstr = linguistic.conj({citystr, divstr, div4}, "new line") -- on fait plusieusr lignes différentes pour éviter que ce soit trop moches avec des drapeaux
local country = localdata
local showCountry = country or ""
local val = linguistic.ucfirst(address.fullAddress(localdata, country, nil, streetstr, divstr, showCountry ))
-- perinteisesti sijainti-parametriin on kirjoitettu koko sijainti mukaanlukien valtio.
local countrymatch=wd.formatStatements{ entity= localdata.item, property = "P17", link="-"}
if (area and countrymatch and string.find(area,countrymatch)) then
val=area
end
return
{
type = "row",
label = "Sijainti",
value = function() return val end
}
end
function p.onshoreof()
return {
type = 'row',
label = 'Vesistö',
value = {'vesistö', 'rannalla' },
wikidata = {property = 'P206', defaultlinkquery = {property = 'P361'}},
}
end
function p.geographiclocation()
-- Ei tulosteta p706:sta mikäli arvo on sama p131:ssä, koska tällöin se on todennäköisesti tulostettu jo p.adminlocation():ssa.
local p706=wd.formatStatements{ entity= localdata.item, property = "P706", link="-"}
local p131=wd.formatStatements{ entity= localdata.item, property = "P131", link="-"}
if p131 and p706 and p131==p706 then
return nil
end
return {
type = 'row',
label = 'Sijaintipaikka',
wikidata = {property = 'P706'},
blockers={'sijainti', 'Sijainti', 'vesialue', 'merialue'}
}
end
-- P5130 sijaitsee saaressa
function p.islandlocation()
return {
type = 'row',
label = 'Saari',
wikidata = {property = 'P5130'},
}
end
-- P4614 -- river catchment area
function p.watershed()
return {
type = 'row',
label = 'Bassin versant',
value = 'bassin versant',
wikidata = {property = 'P4614', defaultlinkquery = {property = {'P4614', 'P138'}}},
}
end
function p.protectedarea()
return {
type = 'row',
label = 'Suojelualue',
plurallabel = 'Suojelualueet',
value = {'suojelualue', 'Suojelualue'},
property = 'P3018',
}
end
function p.island()
return {
type = 'row',
label = 'Saari',
plurallabel = 'Saaret',
value = 'saari',
property = 'P5130',
}
end
function p.mountainrange()
return {
type = 'row',
label = 'Vuoristo',
plurallabel = 'Vuoristot',
value = {'vuoristo', 'Vuoristo'},
wikidata = {property = 'P4552', defaultlink = 'querylabel', defaultlinkquery = {property = 'P4552'}},
}
end
function p.highestpoint()
return {
type = 'row',
label = 'Korkein kohta',
plurallabel = 'Korkeimmat kohdat',
value = {'korkein kohta'},
wikidata = {property = 'P610' },
}
end
function p.lowestpoint()
return {
type = 'row',
label = 'Syvin kohta',
plurallabel = 'Syvimmät kohdat',
value = {'syvin kohta'},
wikidata = {property = 'P1589' },
}
end
function p.elevation()
return {
type = 'row',
label = 'Korkeus merenpinnasta',
value = function() return p.getLocalValueWithDefaultUnit(localdata, {'korkeus', 'Korkeus'},
{
type='desimaaliluku',
allowedunits='m',
templatename='Moduuli:Fr:Infobox/Fonctions/Bâtiment.elevation()',
defaultunit='m',
errormessage='Esimerkkiarvo: 10 m',
minvalue=0,
maxvalue=50000,
skiptests=""
} ) end,
wikidata = {property = 'P2044', targetunit = 'm', conjtype = ' tai ', rounding = '0', numval = '2', showsource=true, removedupes = true},
}
end
function p.coordinates(args)
return general.coordinates(args)
end
function p.website()
return general.website()
end
function p.construction()
return {
type = 'multi',
rows = {
-- début construction, fin construction (legacy infobox Stade, Infobox Château),
{
type = 'row',
value = {'rakentamisen alku'},
label = 'Rakentaminen alkoi',
},
{
type = 'row',
value = {'rakentaminen päättyi', 'loppu'},
label = 'Rakentaminen päättyi',
},
-- construction (nom de paramètre "date de construction" à déprécier)
{
type = 'row',
value = {'valmistumisvuosi', 'rakennettu', 'perustettu', 'Valmistumisvuosi', 'Rakennettu', 'Perustettu'},
label = 'Valmistunut',
wikidata = keydate{'Q385378', 'P571'}
},
}
}
end
function p.reconstruction()
return {
type = 'multi',
rows = {
-- début reconstruction, fin reconstruction (legacy infobox Stade, Infobox Château),
{
type = 'row',
value = {'début reconstruction', 'début'},
label = 'Uudelleenrakennettu',
},
{
type = 'row',
value = {'fin reconstruction', 'fin'},
label = 'Uudelleenrakentaminen päättyi',
},
-- reconstruction (nom de paramètre "date de reconstruction" à déprécier)
{
type = 'row',
value = {'construction', 'Reconstruction', 'date de reconstruction'},
label = 'Reconstruction',
wikidata = keydate{'Q1370468'}
},
}
}
end
function p.opening() --ouverture / consécration / date de mise en service (!= date de construction)
return {
type = 'multi',
rows = {
{
type = 'row',
value = {"date d'ouverture", "mise en service"},
label = 'Avajaiset',
blockers ='rakennettu',
wikidata = keydate{'P1619', 'Q15051339'} -- P1619 = ouverture officielle, pas ouverture de facto
},
{
type = 'row',
value = 'inauguration',
label = 'Vihkimistilaisuus ',
blockers = 'rakennettu',
wikidata = keydate{'Q1417098'}
},
{
type = 'row',
value = 'consécration',
label = 'Vihkiminen',
blockers = 'rakennettu',
wikidata = keydate{ 'Q125375'}
},
{
type = 'row',
value = {'loistoksi', 'ensivalo'},
label = 'Ensivalo',
blockers = 'rakennettu',
wikidata = keydate{'Q1306940'} -- P1619 = ouverture officielle, pas ouverture de facto
}
}
}
end
function p.renovation()
return {
type = 'multi',
rows = {
{
type = 'row',
value = 'restauration',
label = 'Restauroitu',
wikidata = keydate{'Q217102'},
blockers = 'rénovation',
},
{
type = 'row',
value = 'rénovation',
label = 'Remontoitu',
wikidata = keydate{'Q2144402'},
blockers = 'restauration',
},
{
type = 'row',
value = {'extension', 'agrandissement'},
label = 'Laajennettu',
wikidata = keydate{'Q18621193'},
blockers = 'restauration',
},
{
type = 'row',
value = 'autres travaux',
label = 'Muita rakennustöitä',
},
}
}
end
function p.demolition()
return {
type = 'multi',
rows = {
{
type = 'row',
value = {'purkuvuosi','purettu','démolition', 'date de démolition'},
label = 'Purettu',
wikidata = keydate('Q331483')
},
{
type = 'row',
value = {'tuhoutui', 'destruction'},
label = 'Tuhoutunut',
wikidata = keydate('Q17781833')
}
}
}
end
function p.closure()
return {
type = 'row',
value = {'lakkautettu', 'suljettu', 'Lakkautettu', 'Suljettu'},
label = 'Lakkautettu',
wikidata = keydate{'Q14954904', 'P3999', 'P576'} -- P576: date de dissolution, plutôt réservé aux organisations
}
end
function p.usage()
return {
type = 'row',
label = 'Käyttö',
value = 'käyttö',
wikidata = {
property = 'P366',
link = '-',
speciallabels = {Q182060 = 'bureaux'}, -- bureaux semble toujours pouvoir se mettre au pluriel quand c'est en P366 d'un bâtiment
}
}
end
function p.operator()
return {
type = 'row',
label = 'Käyttäjä',
wikidata = {property = 'P466', showdate= true, showsource=true},
value = {'administration', 'gestionnaire'}
}
end
function p.transport()
return {
type = 'multi',
rows = {
{type = 'row', label = 'Pysäköinti', value = 'stationnement'},
{type = 'row', label = 'Rautatieasema', value = 'gare'},
{type = 'row', label = 'Metro', value = 'métro'},
{type = 'row', label = 'Raitiovaunu', value = {'tram', 'tramway'}},
{type = 'row', label = 'Bussi', value = 'bus'},
},
}
end
function p.complex() -- le complexe immobilier auquel appartient un bâtiment
return {
type = 'row',
label = 'Osa kohdetta',
value = 'osa kohdetta',
wikidata = {
property = 'P361',
condition = function(claim)
local v = wd.getmainid(claim)
return wd.isInstance("Q1497364", v, 1)
end,
}
}
end
function p.archistyle()
return {
type = 'row',
label = 'Tyylisuunta',
value = {'tyylisuunta', 'style architectural', 'style'},
wikidata = function ()
local val = wd.formatAndCat{entity = localdata.item, property = 'P149'}
or wd.formatAndCat{entity = localdata.item, property = 'P135'}
if not val then
return nil
end
val = mw.ustring.gsub(val, "\|style ", "\|")
return val
end
}
end
function p.creator() -- toute sorte de créateurs, pourraient peut-être être partagé avec infobox oeuvre d'art
local wdarchitect, wdengineer = p.creatorQuery("P84"), p.creatorQuery("P631")
if wdarchitect and wdengineer then -- ne pas afficher les deux si c'est la même valeur
if (wd.formatStatements{property = "P84", displayformat = "raw", entity= localdata.item} == wd.formatStatements{property = "P631", displayformat = "raw", entity = localdata.item}) then
wdengineer = nil
end
end
return {
type = 'multi',
rows = {
-- architect
{
type = "row",
label = localdata or "Arkkitehti",
plurallabel = "Arkkitehdit",
value = "arkkitehti",
wikidata = wdarchitect,
blockers = {'suunnittelija'},
},
-- ingénieur
{
type = "row",
label = "Suunnittelija",
plurallabel = "Suunnittelijat",
value = "suunnittelija",
wikidata = wdengineer,
},
-- créateur (quand les autres noms ne conviennent pas)
{ type = "row",
label = "Tekijä",
plurallabel = "Tekijät",
value = "luoja",
-- ne pas utiliser Wikidata si le paramètre "architecte" est renseigné (risques de doublon)
wikidata = p.creatorQuery("P170"),
blockers = {'arkkitehti'},
},
}
}
end
function p.owner()
return {
type = 'multi',
rows = {
{
type = 'row',
label = 'Alkuperäinen omistaja',
plurallabel = 'Alkuperäiset omistajat',
value = 'propriétaire initial',
},
{
type = 'row',
label = 'Nykyinen omistaja',
plurallabel = 'Nykyiset omistajat',
value = 'propriétaire actuel',
},
{
type = 'row',
label = 'Omistaja',
plurallabel = 'Omistajat',
value = 'omistaja',
wikidata = require('Module:Fr:Propriétaire').formatFromItem(localdata.item)
}
}
}
end
function p.shape()
return {
type = 'row',
label = 'Muoto',
value = {'muoto', 'forme', 'aspect'},
property = 'P1419',
}
end
function p.getLocalValueWithDefaultUnit(localdata, paramname, testparams )
-- paramnname can be list of parameter names
local targetparamname = "undefined"
if type( paramname ) == 'table' then
for i, j in pairs(paramname) do
if localdata ~= nil then -- empty parameters are ignored
targetparamname=j
end
end
else
targetparamname=paramname
end
local ret=localdata
if ret == nil then
return nil
end
if ret == "-" then
return "-"
end
if localdata == "1" then
return ret;
end
local args= {
= ret .."",
tyyppi = testparams ,
= testparams,
malline = testparams,
parametri = targetparamname,
= testparams,
virheviesti = testparams,
minimiarvo = testparams ,
maksimiarvo = testparams,
ohita_tarkistus = testparams
}
local frame=mw.getCurrentFrame();
ret=frame:expandTemplate{ title = 'Tarkista luku', args = args }
return ret
end
function p.dimensions()
return {
type = 'multi',
rows = {
{
type = 'row',
label = 'Antennin huippu' ,
value = 'antenni/huippu',
wikidata = {property = 'P2048', targetunit = 'm', qualifier = 'P518', qualifiervalue = {'Q131214','Q852590'}, showsource=true}
},
{
type = 'row',
label = 'Kattokorkeus',
value = 'katto_korkeus',
wikidata = {property = 'P2048', targetunit = 'm', qualifier = 'P518', qualifiervalue = 'Q83180', showsource=true}
},
{
type = 'row',
label = 'Ylin_kerros',
value = 'Ylin kerros'
},
--- Hauteur générique : exclut lesvaleurs Wikidata affichées dans une des lignes précedentes + affiche le qualificatif P518
--- inclexcl() rikkoo showsource = true:n joten siksi showgroupedsource = true
{
type = 'row',
label = 'Korkeus',
value = function() return p.getLocalValueWithDefaultUnit(localdata, 'korkeus',
{
type='desimaaliluku',
allowedunits='m',
templatename='p.dimensions()',
defaultunit='m',
errormessage='Esimerkkiarvo: 10 m',
minvalue=0,
maxvalue=5000,
skiptests=""
} ) end,
wikidata = {property = 'P2048', targetunit = 'm', statementformat = function(statement) return inclexcl(statement) end, excludequalifier = {'P518', 'P794'}, excludequalifiervalue = {'Q24192182', 'Q131214','Q852590', 'Q83180'}, showgroupedsource=true}
},
{
type = 'row',
label = 'Paksuus',
value = 'paksuus',
wikidata = {property = 'P2610', targetunit = 'metre', conjtype = ' ou ', rounding = '1', numval = '2', showsource=true},
},
{
type = 'row',
label = 'Pituus',
value = 'pituus',
wikidata = {property = 'P2043', targetunit = 'metre', statementformat = function(statement) return inclexcl(statement) end, conjtype = ' ou ', rounding = '1', numval = '2', showgroupedsource=true},
},
{
type = 'row',
label = 'Leveys',
value = 'leveys',
wikidata = {property = 'P2049', targetunit = 'metre', statementformat = function(statement) return inclexcl(statement) end, conjtype = ' ou ', rounding = '1', numval = '2', showgroupedsource=true},
},
{
type = 'row',
label = 'Kärkiväli',
value = 'kärkiväli',
wikidata = {property = 'P2050', targetunit = 'metre', conjtype = ' ou ', rounding = '1', numval = '2', showsource=true},
},
{
type = 'row',
label = 'Halkaisija',
value = 'halkaisija',
wikidata = {property = 'P2386', targetunit = 'metre', conjtype = ' ou ', rounding = '1', numval = '2', showsource=true},
},
{
type = 'row',
label = 'Ympärysmitta',
value = {'ympärysmitta', 'périmètre', 'contour', 'circonférence'},
wikidata = {property = 'P2547', targetunit = 'metre', conjtype = ' ou ', rounding = '1', numval = '2', showsource=true},
},
-- Hauteur (avec plusieurs différentes affichées pour les gratte-ciel, voir les bases Emporis ou skyscrapercenter
{
type = 'row',
label = 'Rakennelman korkeus',
value = 'rakennelman korkeus',
wikidata = {property = 'P2048', targetunit = 'm', qualifier = {'P794'}, {'P518', 'P794'}, qualifiervalue = {'Q24192182'}, showsource=true}
},
{
type = 'row',
label = 'Pinta-ala',
value = {'pintaala', 'superficie'},
wikidata = {property = 'P2046', targetunit = 'square meter', conjtype = ' ou ', rounding = '1', numval = '2', showsource=true},
},
{
type = 'row',
label = 'Tilavuus',
value = 'tilavuus',
wikidata = {property = 'P2234', targetunit = 'cubic metre', conjtype = ' ou ', rounding = '1', numval = '2', showsource=true},
}
}
}
end
function p.floors()
return {
type = 'multi',
rows = {
{
type = 'row',
label = 'Maanpäällisiä kerroksia',
value = {'maanpäällisiä kerroksia', 'kerroksia', 'niveaux au-dessus du sol', 'étages'},
property = 'P1101',
showsource = true,
},
{
type = 'row',
label = 'Maanalaisia kerroksia',
value = 'maanalaisia kerroksia',
property = 'P1139',
showsource = true,
}
}
}
end
function p.destroyedby()
return {
type = 'row',
label = 'Tuhoutumisen syy',
value = {'détruit par', 'cause de la destruction'},
property = 'P770',
showsource = true,
}
end
function p.material()
return {
type = 'row',
label = 'Materiaali',
plurallabel = 'Materiaalit',
value = {'rakennusmateriaali', 'julkisivumateriaali'},
wikidata = require('Module:Fr:Matériau').formatFromItem(localdata.item),
}
end
function p.colour()
return {
type = 'row',
label = 'Väri',
plurallabel = 'Värit',
value = {'väri', 'couleur', 'couleurs'},
property = 'P462',
}
end
function p.inscription()
return {
type = 'row',
label = 'Merkinnät',
value = {'merkinnät', 'inscription', 'enseigne'},
wikidata = {property = 'P1684', numval = '1', showsource=true},
}
end
function p.equipment()
return {
type = 'row',
label = 'Varustettu',
plurallabel = 'Varusteet',
value = {'équipement', 'équipements'},
property = 'P912',
showsource = true,
}
end
function p.replaces()
return {
type = 'row',
label = 'Edeltäjä',
value = 'edeltäjä',
property = 'P1398',
}
end
function p.replacedby()
return {
type = 'row',
label = 'Seuraaja',
value = 'seuraaja',
property = 'P167',
}
end
function p.visitors()
return {
type = 'row',
label = 'Kävijämäärä',
value = function(localdata)
if localdata then
if localdata then
return localdata .. " (" .. localdata ..")"
else
return localdata
end
end
end,
wikidata = {property = 'P1174', showdate = 'true', numval = 1, sorttype = "inverted", showsource = true},
}
end
function p.protection()
return {
type = 'row',
label = 'Luokitus',
value = {'kulttuuriperintökohteen luokitus', 'Kulttuuriperintökohteen luokitus', 'classement', 'protection'},
wikidata = require('Module:Fr:Classement').formattedList(localdata.item)
}
end
function p.unesco() -- pour remplacer ] à ajouter : paramètres extension, patrimoine en péril, retrait, gestion des monuments faisant partie d'un ensemble
local id = localdata
if (id == '-') then
return nil
end
if id then
id = ''
else
id = wd.formatAndCat{entity = item, property = 'P757', urlpattern = 'http://whc.unesco.org/fr/list/$1'}
end
if (not id) then
return nil
end
return
{type = 'table', title = '] Patrimoine mondial', rows = {
{type = 'row', label = 'Kohde', value = 'nom unesco'},--Désignation
{type = 'row', label = "Tyyppi", value = 'type unesco', wikidata = {property = 'P1435', targetvalue = {'Q16617071', 'Q52683527', 'Q52683530'}}},--Type de bien
{type = 'row', label = "Päivämäärä", value = 'date patrimoine mondial', wikidata = {property = 'P1435', targetvalue = {'Q9259', 'Q16617071', 'Q52683527', 'Q52683530'}, showonlyqualifier = {'P580'}}},--Date d'entrée
{
type = 'row',
label = "Tunnus",
value = function() return id end,
},
{
type = 'row',
label = "Kriteerit",
singularlabel = "Kriteeri",
value = function(localdata)
if localdata then
return ' .. ']'
end
end,
wikidata = function(item)
local str, numclaims = wd.formatStatements{entity = item, property = 'P2614', link = '-', conjtype = ' ', returnnumberofvalues = true}
if str then
return wd.formatAndCat{value = '', entity = item, property = 'P2614'}, numclaims
end
end
},
{type = 'row', label = 'Surface', value = 'surface unesco'},
{type = 'row', label = 'Zone tampon', value = 'surface zone tampon unesco'},
}
}
end
function p.geoloc(params)
return general.geoloc(params)
end
return p