Moduuli:Fr:Infobox/Fonctions/Personne
Siirry navigaatioon
Siirry hakuun
[ muokkaa ] 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.
|
-- Functions utilisées par les infobox personnes
local p = {}
local localdata = require( 'Module:Fr:Infobox/Localdata' )
local item = localdata.entity_id
local wikidata = require( "Module:Fr:Wikidata" )
--local tools = require('Module:Fr:Wikidata/Outils')
local general = require "Module:Fr:Infobox/Fonctions"
local datemodule = require "Module:Fr:Date"
local complexdate = require "Module:Fr:Date complexe"
local linguistic = require "Module:Fr:Linguistique"
--local militaryranks = require "Module:Fr:Dictionnaire Wikidata/Grades militaires"
--=== Accord en genre
-- établit la variable gender pour l'élément
local function getgender(id)
local vals = {
['Q6581072'] = 'f',
['Q6581097'] = 'm',
default = '?'
}
local gender = wikidata.formatStatements{entity = id, property = 'P21', displayformat = 'raw'}
return vals[gender] or vals.default
end
local gender = getgender(item)
-- récupération des libellés genrés de Wikidata
local function genderedlabel(id, labelgender)
local label
if not labelgender then
labelgender = gender -- si le genre n'est pas indiqué, c'est celui de la personne dont c'est l'infobox
end
if labelgender == 'f' then -- femme : chercher le libellé dans P2521 (libellé féminin)
label = wikidata.formatStatements{entity = id, property = 'P2521', isinlang = 'fi', numval = 1, ucfirst = '-'}
elseif labelgender == 'm' then -- homme : chercher le libellé dans P3321 (libellé masculin)
label = wikidata.formatStatements{entity = id, property = 'P3321', isinlang = 'fi', numval = 1, ucfirst = '-'}
end
if not label then
label = wikidata.getLabel(id)
end
return label
end
-- === Gestion des dates
-- Liens thématiques vers les dates
local datelinks = { -- lien vers le domaine d'activité approprié
Q483501 = 'en arts plastiques', -- artiste
Q1028181 = 'en arts plastiques', -- peintre
Q1281618 = 'en arts plastiques', -- sculpteur
Q2309784 = 'en cyclisme', -- cycliste
Q16947657 = 'en arts plastiques', -- lithographe
Q11569986 = 'en arts plastiques', -- graveur
Q13365770 = 'en arts plastiques', -- graveur sur cuivre
Q21925567 = 'en arts plastiques', -- sérigraphe
Q10862983 = 'en arts plastiques', -- aquafortiste
}
local function getdatetopic() -- obtient le lien le plus approprié pour une date en fonction de la profession
local claims = wikidata.stringTable{entity = item, property = 'P106', excludespecial = true, displayformat = "raw"}
if not claims then
return nil
end
for i, j in pairs(claims) do
if datelinks[j] then
return datelinks[j]
end
end
end
local linktopic = getdatetopic()
local unknowndatelabel = "date inconnue"
local birthdate = localdata['syntymäpäivä'] or
localdata['syntymäaika'] or
localdata['date de naissance'] or
wikidata.formatAndCat{
entity = item,
property = 'P569',
unknownlabel = unknowndatelabel,
minprecision = 9,
conjtype = 'or',
sorttype = 'chronological',
sourceproperty = 'P123,P248,P854,P9324',
withsource = 'any'
}
local dead = wikidata.getClaims{entity = item, property = 'P570'} --utilisé comme booléen qui dit si une personne est morte pour modifier certaines élément d'affichage
local deathdate = localdata['kuolinpäivä']
or localdata['kuolinaika']
or localdata['date de décès']
local wddeathdate = wikidata.formatAndCat{
entity = item,
property = 'P570',
unknownlabel = unknowndatelabel,
minprecision = 9,
conjtype = 'or',
sorttype = 'chronological',
sourceproperty = 'P123,P248,P854,P9324',
withsource = 'any'
}
local wddeathdate_any = wikidata.formatAndCat{
entity = item,
property = 'P570',
unknownlabel = unknowndatelabel,
minprecision = 9,
conjtype = 'or',
sorttype = 'chronological',
}
local function format1(event, period, predecessor, successor, displayformat)
local mainstr = event
if predecessor then
local s = 'précédé par ' .. predecessor
if gender == 'f' then
s = 'précédée par ' .. predecessor
end
mainstr = mainstr .. '<small><br /> ' .. s .. '</small>'
end
if successor then
local s = 'suivi par ' .. successor
if gender == 'f' then
s = 'suivie par ' .. successor
end
mainstr = mainstr .. '<small><br /> ' .. s .. '</small>'
end
return {type = 'row', label = period or '', value = function() return mainstr end}
end
-----------------
local function format2(event, period, predecessor, successor, displayformat)
if (not event) then
return nil
end
local rows = {}
local eventrow = {type = 'row1col', color = 'secondcolor', value = event }
table.insert(rows, eventrow)
if period then
period = '<span style="font-weight:normal">' .. period .. '</span>'
local periodrow = {type = 'row1col', color = '#F9F9F9', value = period }
table.insert(rows, periodrow)
end
if predecessor then
local prederow = {type = 'row', label = 'Prédécesseur', value = function() return predecessor end}
table.insert(rows, prederow)
end
if successor then
local succrow = {type = 'row', label = 'Successeur', value = function() return successor end}
table.insert(rows, succrow)
end
return {type = 'multi', rows = rows}
end
local function format3(event, period, predecessor, successor, displayformat, details)
if details then
details = '<span style="font-weight:normal">' .. details .. '</span>'
event = linguistic.conj({event, details}, "new line")
end
local mainrow = {type = 'row1col', color = 'secondcolor', value = event }
if period then
period = '<span style="font-weight:normal">' .. period .. '</span>'
end
local periodrow = {type = 'row1col', color = 'F9F9F9', value = period }
local successionrow = {
style = {['background-color'] = '#F9F9F9', ['color'] = 'var( --color-base )', ['padding-bottom'] = '2%'},
type = 'navbox',
inner = true,
previousval = function() return predecessor end,
nextval = function() return successor end,
}
return {type = 'multi', rows = {mainrow, periodrow, successionrow}}
end
local function timeline(localparam, wdconf, timelineformat, title, singtitle, details) -- affiche date : événement (suppose les événements déjà triés)
local rows = {}
local function returnTable()
return {
type = "table",
title = title,
rows = rows
}
end
-- avec données locales
local val = localdata[localparam]
if val == '-' then
return nil
elseif val then
table.insert(rows, {type = 'row1col', color = 'secondcolor', value = val})
return returnTable()
end
-- avec données wikidata
if not wdconf then
return nil
end
wdconf.entity = wdconf.entity or item
wdconf.sorttype = wdconf.sorttype or "chronological"
-- wdconf.labelformat = wdconf.labelformat or function(id) return genderedlabel(id) end
wdconf.linktopic = wdconf.linktopic or "-"
wdconf.stilltrue = not dead -- si la personne est vivante, on emploie "depuis" plutôt que "à partir de" (mais lorsque c'est fini mais que la date de fin manque, ça devient faux)
local statements = wikidata.getClaims(wdconf)
if not statements then
return nil
end
if #statements == 1 then
title = singtitle
end
local displayformats = {
A = format1,
B = format2,
C = format3,
}
local applyformat = displayformats[timelineformat] or displayformats['A']
applyformat = displayformats['C']
rows = {}
for i, statement in pairs(statements) do
local event = linguistic.ucfirst(wikidata.formatStatement(statement, wdconf))
local predecessor = wikidata.getFormattedQualifiers(statement, {'P155', 'P1365'})
local successor = wikidata.getFormattedQualifiers(statement, {'P156', 'P1366'})
local period = wikidata.getFormattedDate(statement, {linktopic = wdconf.linktopic, stilltrue = not dead } ) -- dont pass all wdconf or else qualifiers will show up
local detailstr
if type(details) == "function" then
detailstr = details(statement)
end
local row = applyformat(event, period, predecessor, successor, wdconf, detailstr)
if row then
table.insert(rows, row)
end
end
-- table.insert(rows, {type = "external text", value = function() return wikidata.addTrackingCat(wdconf.property) end})
return returnTable()
end
local function dateandplace(thedate, theplace)
if thedate and theplace and mw.ustring.find(thedate, "inconnu") and mw.ustring.find(theplace, "inconnu") then
theplace = nil
thedate = mw.ustring.gsub(thedate, unknowndatelabel, "Date et lieu inconnus")
end
return linguistic.conj({thedate, theplace}, "new line")
end
--Titre
function p.title(icon, style)
return general.title(icon, style)
end
--Image
function p.mainimage(cat)
-- demande d'illustration que si la personne est née ou morte après 1900, sinon c'est souvent impossible à trouver
local defaultimage = 'Defaut 2.svg'
local age = wikidata.stringTable{property = 'P569,P570', entity = item, displayformat = 'raw', excludespecial = true}
if age then
local pattern = "(%W)(%d+)%-(%d+)%-(%d+)"
local era, year = age[1]:match(pattern)
if (era == '-') or (tonumber(year)) < 1900 then
defaultimage = nil
end
end
return general.mainimage(cat or 'Article à illustrer Biographie', defaultimage)
end
-- Noms
function p.othernames()
local names = {
{'P1477', 'Syntymänimi', 'Syntymänimet', 'syntymänimi'},
{'P1449', 'Lempinimi', 'Lempinimet', 'lempinimi'},
{'P2001', 'Korean uudistettu latinisaatio', 'Korean uudistettu latinisaatio', 'siirtokirjoitettuna '},
{'P1942', 'McCune-Reischauer', 'McCune-Reischauer', 'siirtokirjoitettuna '},
{'P742', 'Salanimi', 'Salanimet', 'salanimi'},
{'P1782', 'Prénom social', 'Prénoms sociaux', 'prénom social'}, -- Ei selvää käännöstä
{'P1786', 'Kunnianimi', 'Kunnianimet', 'nom posthume'}, -- Ei selvää käännöstä
{'P1785', 'Seremonianimi', 'Seremonianimet', 'nom de temple'}, -- Ei selvää käännöstä
{'P1787', 'Taiteilijanimi', 'Taiteilijanimet', 'nom de pinceau'}, -- Ei selvää käännöstä
{'P428', 'Kasvitieteen auktorin lyhenne', 'Kasvitieteen auktorin lyhenteet', 'kasvitieteen auktorin lyhenne'},
{'P835', 'Lyhenne', 'Lyhenteet', 'lyhenne'},
{nil, 'Muut nimet', 'Muut nimet', 'muut nimet'},
}
local birthnamerow = { -- un peu particulier, donc à part
type = "row",
wikidata = function()
local s = wikidata.formatAndCat{entity = item, property = "P1559"}
if (not s) then
return nil
end
-- regarde si le nom de la valeur ressemble au libellé (en tenant compte de la pollution des marqueures de langue
local label = mw.ustring.lower(wikidata.getLabel(item) or "")
local useless
if mw.ustring.find(mw.ustring.lower(s), mw.ustring.lower(label), 0, true) then
useless = true
end
if useless then
return nil
end
return s
end,
label = 'Nimi äidinkielellä',
plurallabel = 'Nimet äidinkielellä',
value = { 'Nimi äidinkielellä', 'alkuperäinen nimi' }
}
local rows = {type = "multi", rows = {birthnamerow}}
for i, j in pairs(names) do
local query
if j[1] and not localdata['muut nimet'] then -- lorsqu'il y a un paramètre "autres noms", Wikidata est désactivée pour éviter risques de doublon
query = {property = j[1], showqualifiers = {'P1721'}, conjtype = 'new line'}
end
table.insert(rows.rows, {type = 'row', value = j[4], wikidata = query, label = j[2], plurallabel = j[3]})
end
return rows
end
-- NAISSANCE ET MORT
function p.birth() -- date de naissance en première ligne, lieu de naissance en deuxième
return {
type = 'row',
label = 'Syntynyt',
value =
function()
local source =""
if localdata['syntymäpäivä'] or localdata['syntymäaika'] then
else
source = wikidata.formatStatements{entity = item, property = 'P569,P19', minprecision = 9, displayformat = "none", conjtype = ' ', sorttype = 'chronological', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324', withsource = 'any', showgroupedsource=true} or ""
end
local thedate = datemodule.dateInfobox{args = {[1] = 'naissance', [2] = birthdate or '', [3] = deathdate or wddeathdate or wddeathdate_any or '', qualificatif = linktopic}}
local theplace = localdata['syntymäpaikka'] or wikidata.formatAndCat({entity =item, property= 'P19', rank = 'best', conjtype= ' ou ', unknownlabel = "lieu inconnu", defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any'})
local val = dateandplace(thedate, theplace)
if val then
val = val .. source
end
return val
end
}
end
function p.death() -- même fonctionnement que la fonction p.birth
--- récup de Wikidata seulement en l'absence de données locales
local ddate = deathdate --déclarée pour l'ensemble du module
if (not ddate) and (not localdata['kadonnut']) then
deathdate = wddeathdate
end
local source =""
if localdata['kuolinpäivä'] or localdata['kuolinaika'] then
else
source = wikidata.formatStatements{entity = item,property = 'P570,P20',displayformat="none",minprecision = 9,conjtype = ' ',sorttype = 'chronological', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true} or ""
end
local thedate = datemodule.dateInfobox{args = {[1] = 'mort', [2] = birthdate or '', [3] = deathdate or '', qualificatif = linktopic, unknownlabel = "kuolinhetki tuntematon"}}
local theplace = localdata["kuolinpaikka"] or wikidata.formatAndCat{entity = item, property= 'P20', rank = 'best', conjtype= ' ou ', unknownlabel = "kuolnpaikka tuntematon", defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any'}
local disparitiondate
local val = dateandplace(thedate, theplace)
if val then
val = val .. source
end
return
{type = 'multi', rows = {
{ -- disparition
type = 'row',
label = 'Kadonnut',
value = function() return disparitiondate end
},
{ -- décès
type = 'row',
label = 'Kuollut',
value = function() return val end,
}
}}
end
function p.floruit()
return {
type = 'row',
label = "Aktiivisena",
value = "aktiivisena",
wikidata = function()
local startDate = wikidata.formatAndCat{entity = item, property = "P2031", conjtype = "or", sorttype = "chronological", withsource='any', showgroupedsource=true}
local endDate = wikidata.formatAndCat{entity = item, property = "P2032", conjtype = "or", sorttype = "chronological", withsource='any', showgroupedsource=true}
if not (startDate or endDate) then
return wikidata.formatAndCat{entity = item, property = 'P1317'}
end
return complexdate.daterange(startDate, endDate, {precision = 11})
end
}
end
function p.placeofburial()
return
{type = 'row', label = "Hautapaikka", value = "hautapaikka", wikidata = { property = 'P119', sourceproperty = 'P123,P248,P854,P9324', defaultlink = '-', withsource = 'any', showgroupedsource=true}}
end
function p.nationality()
-- à améliorer étant donnée les moeurs Wikidata comme nationalité : Empire allemand (1901-1918) République de Weimar (1918-1933)
local function wdDate()
local nation = require "Module:Fr:Country data".nationality
-- désactivation si date de naissance avant l'Ère contemporaine : trop d'imprécisions et d'anachronismes
local mindate = '1789'
local birthdate = wikidata.formatStatements{entity = item, property = 'P569', displayformat = 'raw', numval = 1}
if (not birthdate) or complexdate.before(mindate, birthdate) then
return nil
end
return {
property = 'P27',
-- vals = statements, -- statments est une variable non déclarée dans ce module
showdate = true,
entity = item,
conjtype = 'comma',
removedupes = true,
linktopic = '-',
displayformat =
function(snak)
local g = gender -- genre de la personne, pour affichage du gentilé
if g == '?' then -- si inconnu, au masculin
g = 'm'
end
local val, success = nation(wikidata.getId(snak), g)
if not success then
val = wikidata.formatSnak(snak)
end
return val
end
}
end
return {
type = 'row',
label = 'Nationalité',
plurallabel = 'Nationalités',
value = 'kansalaisuus',
wikidata = wdDate() -- wdDate() retourne une table
}
end
function p.nativelanguage()
return
{type = 'row', label = 'Langue maternelle', value = 'langue maternelle', property = 'P103'}
end
-- Domiciles
function p.places()
return {type = 'multi', rows = {
{
type = 'row',
label = 'Demos',
plurallabel = 'Demos',
value = 'demos',
wikidata = {property = 'P2462', showdate = true, sorttype= 'chronological', precision = 'year',sourceproperty = 'P123,P248,P854,P9324', defaultlink = '-', withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Asuinpaikka',
plurallabel = 'Asuinpaikat',
value = 'asuinpaikka',
wikidata = {property = 'P551', showdate = true, sorttype= 'chronological', precision = 'year', defaultlink = '-', withsource = 'any', defaultlink = '-', showgroupedsource=true},
},
{
type = 'row',
label = 'Työpaikka',
plurallabel = 'Työpaikat',
value = 'työpaikka',
wikidata = {property = 'P937', sorttype= 'chronological', showdate = true, precision = 'year',sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', defaultlink = '-', showgroupedsource=true},
},
}}
end
-- parcours professionel
function p.education() -- à améliorer
local query = {link = '-', sorttype= 'chronological', property = 'P69', showdate = true, precision = 'year', showqualifiers = 'P512', conjtype = 'new line', defaultlink = '-', linktopic = '-',sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true}
return {
type = 'row',
value = {'alma mater', 'formation'},
wikidata = query,
label = 'Koulutus',
}
end
function p.occupation()
local speciallabels = {
f = {
['Q33999'] = '[[actrice]]',
['Q10798782'] = '[[actrice]]',
['Q10800557'] = '[[actrice]]',
['Q2405480'] = '[[actrice]]',
['Q2259451'] = '[[actrice]]',
['Q948329'] = '[[actrice]]'
},
m = {
['Q33999'] = '[[acteur]]',
['Q10798782'] = '[[acteur]]',
['Q10800557'] = '[[acteur]]',
['Q10798782'] = '[[acteur]]',
['Q2405480'] = '[[acteur]]',
['Q2259451'] = '[[acteur]]',
['Q948329'] = '[[acteur]]'
}
}
return {
type = 'row',
value = {'ammatti ', 'activités'},
wikidata = {
property = 'P106',
ucfirst = '-',
defaultlink = '-',
defaultlinkquery = {property = 'P425'},
-- labelformat = function(id) return genderedlabel(id) end,
-- speciallabels = speciallabels[gender] or speciallabels['m'],
removedupes = true,
excludevalues = { -- les occupations qui ne méritent pas d'être affichées
'Q482980', -- auteur
--'Q15980158', "auteur de non-fiction" a depuis été traduit par "essayiste"
'Q18814623', -- autobiographe
'Q1209498', -- juriste-poète
},
sourceproperty = 'P123,P248,P854,P9324',
withsource = 'any',
showgroupedsource=true
},
label = 'Ammatti',
plurallabel = 'Ammatit'
}
end
function p.employer()
return {
type = 'row',
value = {'työnantaja', 'instituutti'},
wikidata = {property = 'P108', showdate = true, sorttype= 'chronological',sourceproperty = 'P123,P248,P854,P9324', precision = 'year', defaultlink='-', withsource = 'any', showgroupedsource=true},
label = "Työnantaja",
plurallabel = 'Työnantajat'
}
end
function p.victories()
local title, singtitle = "Victoires", "Victoire"
local localparam = "victoire"
local wdconf = {property = 'P2522'}
local displayformat = "B"
return timeline(localparam, wdconf, displayformat, title, singtitle)
end
function p.officialposition()
local title, singtitle = "Tehtävät", "Tehtävä"
local localparam = "titteli"
local wdconf = {
property = 'P39',
rank = 'valid',
sorttype = 'inverted',
defaultlinkquery = {property = {'P2354', 'P2389', 'P453', 'P361', 'P108'}}, -- liens par défaut : liste, puise organisme dirigé, "membre de", "partie de", employeur
}
-- sur une ligne séparée : juridiction, "de", circonsription, diocèse, affiliation, assemblée, parti, emmloyeur
local details = function(statement) return wikidata.getFormattedQualifiers(statement, {'P1001', 'P642', 'P768', 'P708', 'P1416', 'P194', 'P108', 'P937'}) end
local displayformat = "C"
return timeline(localparam, wdconf, displayformat, title, singtitle, details)
end
function p.nobilitytitle()
local title, singtitle = "Arvonimet", "Arvonimi"
local localparam = "arvonimet"
local wdconf = {
property = 'P97',
entity = item, rank = 'valid',
showqualifiers = {'P642'},
defaultlinkquery = {property = {'P2354', 'P361'}}, -- liens par défaut : liste, puise organisme dirigé, "membre de" et "partie de"
}
local displayformat = "B"
return timeline(localparam, wdconf, displayformat, title, singtitle)
end
function p.honorifictitle()
local title, singtitle = "Arvonimet", "Arvonimi"
local localparam = "arvonimi"
local wdconf = {property = 'P511', entity = item, rank = 'valid'}
local displayformat = "C"
return timeline(localparam, wdconf, displayformat, title, singtitle)
end
function p.tombe()
return {
type = 'images',
imageparameters = {'haudan kuva'},
defaultimages = nil,
defaultupright = 1,
uprightparameter = 'upright hauta',
sizeparameter = 'haudan koko', -- obsolète
captionparameter = 'haudan kuvateksti',
defaultcaption = 'hauta.',
property = 'P1442',
numval = 1,
}
end
function p.plaque()
return {
type = 'images',
imageparameters = {'muistolaatan kuva'},
defaultimages = nil,
defaultupright = 1,
uprightparameter = 'upright muistolaatta',
sizeparameter = 'muistolaatan koko', -- obsolète
captionparameter = 'muistolaatan kuvateksti',
defaultcaption = 'muistolaatta',
property = 'P1801',
numval = 1,
}
end
function p.blason()
return {
type = 'images',
imageparameters = {'vaakunan kuva'},
defaultimages = nil,
defaultupright = 0.7,
uprightparameter = 'upright blason',
sizeparameter = 'vaakunan koko', -- obsolète
captionparameter = 'vaakunan kuvateksti',
defaultcaption = 'vaakuna',
property = 'P94',
numval = 1,
}
end
function p.sceau()
return {
type = 'images',
imageparameters = {'sinetin kuva'},
defaultimages = nil,
defaultupright = 0.7,
uprightparameter = 'upright sinetti',
sizeparameter = 'sinetin koko', -- obsolète
captionparameter = 'sinetin kuvateksti',
defaultcaption = 'sinetti',
property = 'P158',
numval = 1,
}
end
function p.monogram()
return {
type = 'images',
imageparameters = {'monogrammin kuva'},
defaultimages = nil,
defaultsize = '100px',
sizeparameter = 'monogrammin koko',
captionparameter = 'monogrammin kuvateksti',
defaultcaption = 'monogrammi',
property = 'P1543',
numval = 1,
}
end
function p.flag()
return {
type = 'images',
imageparameters = {'lipun kuva'},
defaultimages = nil,
defaultsize = '150px',
sizeparameter = 'lipun koko',
captionparameter = 'lipun kuvateksti',
defaultcaption = 'lippu',
property = 'P41',
numval = 1,
}
end
function p.logo()
return {
type = 'images',
imageparameters = {'logon kuva'},
defaultimages = nil,
defaultsize = '150px',
sizeparameter = 'logon koko',
captionparameter = 'logon kuvateksti',
defaultcaption = 'logo',
property = 'P154',
numval = 1,
}
end
function p.politicalparty()
return {
type = 'row',
value = 'puolue',
label = 'Puolue',
plurallabel = 'Puolueet',
wikidata = { property = 'P102', sorttype= 'chronological', showdate = true, conjtype = 'new line', excludespecial = true, defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
}
end
function p.memberof()
return {type = 'multi', rows = {
{
type = 'row',
value = 'titarikunta',
label = 'Ritarikunta',
plurallabel = 'Ritarikunnat',
wikidata = {property = 'P550', sorttype= 'chronological', showdate = true, defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Jäsen',
value = 'jäsen',
wikidata = {property = 'P463', sorttype= 'chronological', showdate = true, precision = 'year', textformat = 'minimum', conjtype = 'new line', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
}}
end
function p.awards()
local function awardsList()
-- local majorawards = require "Module:Fr:Dictionnaire Wikidata/Distinctions"
local majorawards = {}
local query = {
entity = item,
property= 'P166',
sorttype= 'chronological',
grouped = true,
showqualifiers = 'P642',
showdate= true,
precision = 'year',
conjtype = 'new line',
textformat = 'minimum',
linktopic = '-',
defaultlink = '-',
defaultlinkquery = {property = {'P2354', 'P361' , 'P1027'}},
excludevalues = 'Q15631401', -- membre de la Royal Society, redondance avec le champ « membre de » (P463)
speciallabels = majorawards,
-- labelformat = function(id) return genderedlabel(id) end,
}
local claims = wikidata.getClaims(query)
if (not claims) then
return nil
end
local str = wikidata.formatAndCat(query)
if #claims < 4 then
return str, #claims
end
--si trop de valeurs, n'afficher que les importantes de [[Module:Dictionnaire Wikidata/Distinctions]], et mettre les autrs dans un menu pliant
--- récupération des importantes
local majorStr
local targetvalues = {}
for i, j in pairs(majorawards) do
table.insert(targetvalues, i)
end
query.targetvalue = targetvalues
query.value, query.claims, query.valuetable = nil, nil, nil -- apparemment sinon ce n'est pas le cas, pourquoi ? BUG IMPORTANT
majorStr = wikidata.formatAndCat(query)
--- repliage des autres
-- local message = "'''Luettelo'''"
local message = ""
local allAwardsTable = mw.html.create('div')
:addClass("toccolours mw-collapsible mw-collapsed")
:wikitext(message)
:css{border = "none"}
:tag('div')
:addClass("mw-collapsible-content")
:css{['line-height'] = '150%'} -- sinon c'est vraiment serré
:wikitext( str)
:done()
:allDone()
return linguistic.conj({majorStr, tostring(allAwardsTable)}, "<br />"), #claims
end
return {
type = 'row',
value = {'palkinnot','prix', 'récompenses', 'distinction', 'distinctions'},
label = 'Palkinnot',
wikidata = function() return awardsList() end
}
end
-- Influences
function p.influencedby()
return {
type = 'row',
label = 'Vaikutteet',
-- function(localdata, item)
-- if gender == 'f' then
-- return 'Influencée par'
-- elseif gender == 'f' then
-- return 'Influencé par'
-- else
-- return 'Influencé par'
-- end
-- end,
value = 'vaikutteet',
wikidata = {property = 'P737',sourceproperty = 'P123,P248,P854,P9324', defaultlink = '-', withsource = 'any', showgroupedsource=true},
}
end
function p.influenced()
return {
type = 'row',
label = 'A influencé',
value = {'a influencé', 'influence de'},
}
end
-- Appartenances
function p.movement()
return
{
type = 'row',
label = 'Suuntaus',
plurallabel = 'Suuntaukset',
value = {'suuntaus', 'koulukunta'},
wikidata = {property = 'P135', sorttype= 'chronological', showdate = true, precision = 'year', defaultlink='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
}
end
-- Religion
function p.religion()
return {type = 'multi', rows = {
{
type = 'row',
label = 'Uskonto',
plurallabel = 'Uskonnot',
value = 'uskonto',
wikidata = {property = 'P140', sorttype= 'chronological', showdate = true, precision = 'year', excludevalues = 'Q7066', defaultlink='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},--[[
{
type = 'row',
label = 'Kastepäivä',
value = 'kastepäivä',
property = 'P1636',
},
{
type = 'row',
label = 'Kummi',
plurallabel = 'Kummit',
value = 'kummi',
property = 'P1290',
},
{
type = 'row',
label = 'Nom en religion',
plurallabel = 'Noms en religion',
value = 'nom en religion',
property = 'P1635',
},
{
type = 'row',
label = 'Ordre religieux',
plurallabel = 'Ordres religieux',
value = 'ordre religieux',
property = 'P611',
},
{
type = 'row',
label = 'Consécrateur',
plurallabel = 'Consécrateurs',
value = 'consécrateur',
property = 'P1598',
},
{
type = 'row',
label =
function(localdata, item)
if gender == 'f' then
return 'Vénérée par'
elseif gender == 'm' then
return 'Vénéré par'
else
return 'Vénéré par'
end
end,
value = 'vénéré par',
property = 'P1049',
},
{
type = 'row',
label = 'Étape de canonisation',
value = 'étape de canonisation',
wikidata = {
property = 'P411',
labelformat = function(id) return genderedlabel(id) end,
},
},--]]
}}
end
-- Carrière militaire
function p.military()
return {type = 'multi', rows = {
{
type = 'row',
label = 'Puolustushaara',
plurallabel = 'Puolustushaarat',
value = 'puolustushaara',
wikidata = {property = 'P241', showdate = true, sorttype= 'chronological', precision = 'year', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Sotilasarvo',
plurallabel = 'Sotilasarvot',
value = 'sotilasarvo',
wikidata = {property = 'P410', showdate = true, sorttype= 'chronological', precision = 'year', conjtype ='new line',sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},--[[
{
type = 'row',
label = 'Konflikti',
plurallabel = 'Konfliktit',
value = 'konflikti',
wikidata = {property = 'P607', showdate = true, sorttype= 'chronological', precision = 'year'},
},]]--
}}
end
-- Carrière de torero
function p.torero()
return {type = 'multi', rows = {
{
type = "row",
label = "Alternative",
value = "alternative",
wikidata = function() return wikidata.keyDate("Q2840411", item) end
},
{
type = "row",
label = "Confirmation d'alternative",
value = "confirmation alt",
wikidata = function() return wikidata.keyDate("Q23308805", item) end
},
}}
end
-- Sport
function p.sport()
return {type = 'multi', rows = {
{
type = 'row',
label = 'Pelipaikka',
plurallabel = 'Pelipaikat',
value = 'pelipaikka',
wikidata = {property = 'P413', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true
-- labelformat = function(id) return genderedlabel(id) end,
},
},
{
type = 'row',
label = 'Urheilulaji',
plurallabel = 'Urheilulajit',
value = 'urheilulaji',
wikidata = {property = 'P2416', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Pelaamiskäsi',
value = 'pelaamiskäsi',
wikidata = {property = 'P741', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Laukaisukäsi',
value = 'laukaisukäsi',
wikidata = {property = 'P423', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Varaaja',
plurallabel = 'Varaajat',
value = 'varaaja',
wikidata = {
property = 'P647',
statementformat = function(statement)
local team = wikidata.formatStatement(statement)
local moment = wikidata.getFormattedQualifiers(statement, {'P793'}) or wikidata.getFormattedQualifiers(statement, {'P585'})
local rank = wikidata.getFormattedQualifiers(statement, {'P1836'})
-- if rank then
-- rank = require "Module:Fr:Nombre2texte".ordinal(rank) .. ' choix'
-- end
local qualifs = linguistic.conj({moment, rank}, ' – ')
if not qualifs then
return team
end
return team .. ' <small>(' .. qualifs .. ')</small>'
end
},
},
{
type = 'row',
label = 'Joukkue',
plurallabel = 'Joukkueet',
value = 'jäsen urheilujoukkueessa',
wikidata = {
property = 'P54',
sorttype= 'chronological',
conjtype = "new line",
statementformat = function(statement)
local str = wikidata.formatStatement(statement, {showdate = true})
local compets = wikidata.getFormattedQualifiers(statement, {"P1350"})
if tonumber(compets) and (tonumber(compets) > 1) then
compets = compets .. " peliä"
elseif compets then
compets = compets .. " peli"
end
local points = wikidata.getFormattedQualifiers(statement, {"P1351"})
if tonumber(points) and (tonumber(points) > 1) then
points = points .. " pistettä"
elseif points then
points = points .. "piste"
end
local qualifiers = linguistic.conj{compets, points}
if qualifiers then
str= str .. " <small> – " .. qualifiers .. " </small>"
end
return str
end
}
},
{
type = 'row',
label = 'Pelejä',
value = 'pelejä',
wikidata = {property = 'P1129', numval = 1, defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Shakin arvonimi',
plurallabel = 'Shakin arvonimet',
value = 'shakin arvonimi',
wikidata = {property = 'P2962', sorttype= 'chronological', showdate = true, precision = 'year', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Elo-luku',
value = 'elo-luku',
wikidata = {property = 'P1087', numval = '3', sorttype = 'inverted', conjtype = 'new line', showdate = true, precision = 'month', removedupes = true, defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Ennätys',
plurallabel = 'Ennätykset',
value = 'ennätys',
wikidata = {property = 'P1000', sorttype= 'chronological', showdate = true, defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Valmentaja',
plurallabel = 'Valmentajat',
value = 'valmentaja',
wikidata = {property = 'P286', sorttype= 'chronological', showdate = true, precision = 'year', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Apukuljettaja',
plurallabel = 'Apukuljettajat',
value = 'apukuljettaja',
wikidata = {property = 'P2095', sorttype= 'chronological', showdate = true, precision = 'year', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Sponsori',
plurallabel = 'Sponsorit',
value = 'sponsori',
wikidata = {property = 'P859', sorttype= 'chronological', showdate = true, precision = 'year', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
}}
end
-- Contacts
function p.contacts()
return {type = 'multi', rows = {
{
type = 'row',
label = localdata['intitulé maître'] or 'Opettaja',
plurallabel = 'Opettajat',
value = {'opettaja', 'maîtres'},
wikidata = {property = 'P1066', sorttype= 'chronological', showdate = true, precision = 'year', defaultlink ='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Väitöstyön ohjaaja',
plurallabel = 'Väitöstyön ohjaajat',
value = {'väitöstyön ohjaaja', 'ohjaaja'},
wikidata = {property = 'P184', sorttype= 'chronological', showdate = true, precision = 'year', defaultlink ='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Edustaja',
plurallabel = 'Edustajat',
--
-- label =
-- function(localdata, item)
-- if gender == 'f' then
-- return 'Représentée par'
-- elseif gender == 'm' then
-- return 'Représenté par'
-- else
-- return 'Représenté par'
-- end
-- end,
value = 'edustaja',
wikidata = {property = 'P1875', defaultlink ='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Partneri',
plurallabel = 'Partnerit',
value = 'partneri',
wikidata = {property = 'P1327', defaultlink ='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = localdata['intitulé élève'] or 'Oppilas',
plurallabel = 'Oppilaat',
value = {'oppilas', 'élèves', 'oppilaat'},
wikidata = {property = 'P802', sorttype= 'chronological', showdate = true, precision = 'year', numval = 5, defaultlink ='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Tohtoriopiskelija',
plurallabel = 'Tohtoriopiskelijat',
value = 'tohtoriopiskelija',
wikidata = {property = 'P185', sorttype= 'chronological', showdate = true, precision = 'year', numval = 5, defaultlink ='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Liittyvä henkilö',
plurallabel = 'Liittyvä henkilöt',
value = 'liittyvä henkilö',
wikidata = {property = 'P3342', numval = 5, showqualifiers = 'P794', defaultlink ='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
}}
end
-- Mécénat
function p.patron()
return {
type = 'row',
label = '[[Mécénat|Mécènes]]',
singularlabel = '[[Mécénat|Mécène]]',
plurallabel = '[[Mécénat|Mécènes]]',
value = 'mécènes',
wikidata = {property = 'P1962', showdate = true, sorttype = 'chronological', conjtype = 'comma', defaultlink ='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
}
end
-- Musique
function p.music()
return {type = 'multi', rows = {
{
type = 'row',
label = 'Ääniala',
value = 'ääniala',
property = 'P412',
},
{
type = 'row',
label = 'Fach',
value = 'fach',
property = 'P1731',
},
{
type = 'row',
label = 'Soitin',
plurallabel = 'Soittimet',
value = 'soitin',
wikidata = {property = 'P1303', sorttype= 'chronological', defaultlink ='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Levymerkki',
plurallabel = 'Levymerkit',
value = 'levymerkki',
wikidata = {property = 'P264', sorttype= 'chronological', showdate = true, precision = 'year'},
},
}}
end
-- Victimes
function p.victims()
return {type = 'multi', rows = {
{
type = 'row',
label = 'Uhrien lukumäärä',
value = 'uhrien lukumäärä',
wikidata = {property = 'P1345',sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true, defaultlink = '-'},
},
}}
end
-- Condamnations
function p.penalties()
return {type = 'multi', rows = {
{
type = 'row',
label = 'Tuomittu rikoksesta',
-- function(localdata, item)
-- if gender == 'f' then
-- return 'Condamnée pour'
-- elseif gender == 'm' then
-- return 'Condamné pour'
-- else
-- return 'Condamné pour'
-- end
-- end,
value = 'tuomittu rikoksesta',
wikidata = {property = 'P1399', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Rangaistus',
plurallabel = 'Rangaistukset',
value = 'rangaistus',
wikidata = {property = 'P1596', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Rangaistuspaikka',
plurallabel = 'Rangaistuspaikat',
value = 'rangaistuspaikka',
wikidata = {property = 'P2632', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma', defaultlink='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
}}
end
-- Physique
function p.appearance()
return {type = 'multi', rows = {
{
type = 'row',
label = 'Pituus',
value = 'pituus',
wikidata = {property = 'P2048', targetunit = 'metre', rounding = '2', showdate = true, precision = 'year', defaultlink = '-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Paino',
value = 'paino',
wikidata = {property = 'P2067', targetunit = 'kilogram', rounding = '1', showdate = true, precision = 'year',sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Hiusten väri',
value = 'hiusten väri',
wikidata = {property = 'P1884',sourceproperty = 'P123,P248,P854,P9324', defaultlink = '-', withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Silmien väri',
value = 'silmien väri',
wikidata = {property = 'P1340',sourceproperty = 'P123,P248,P854,P9324', defaultlink = '-', withsource = 'any', showgroupedsource=true},
},
}}
end
-- Famille
function p.family()
return {type = 'multi', rows = {
{
type = 'row',
label = 'Suku',
plurallabels = 'Suvut',
value = 'suku',
wikidata = {
property = 'P53',
withsource = 'any',
showgroupedsource=true,
defaultlink = '-'
}
},
{
type = 'row',
label = 'Isä',
value = 'isä',
wikidata = {property = 'P22', conjtype = ' ja ', sourceproperty = 'P123,P248,P854,P9324', defaultlink = '-', withsource = 'any', showgroupedsource=true},
blockers= {'vanhemmat', 'Vanhemmat'}
},
{
type = 'row',
label = 'Äiti',
value = 'äiti',
wikidata = {property = 'P25', conjtype = ' ja ', sourceproperty = 'P123,P248,P854,P9324', defaultlink = '-', withsource = 'any', showgroupedsource=true},
blockers= {'vanhemmat', 'Vanhemmat'}
},
{
type = 'row',
label = 'Kasvattaja',
plurallabel = 'Kasvattajat',
value = {'kasvattaja', 'isäpuoli', 'äitipuoli'},
wikidata = {property = 'P3448', sourceproperty = 'P123,P248,P854,P9324', defaultlink = '-', withsource = 'any', showgroupedsource=true}
},
{
type = 'row',
label = 'Sisarukset',
value = 'sisarukset',
wikidata = {
property = 'P3373',
sorttype = 'chronological',
conjtype = 'new line',
textformat = 'long',
precision = 'year',
stilltrue = not dead,
sourceproperty = 'P123,P248,P854,P9324',
withsource = 'any',
defaultlink = '-',
showgroupedsource=true
}
},
{
type = 'row',
label = 'Puoliso', -- todo : adapter le libellé en genre ?
plurallabel = 'Puolisot',
value = 'puoliso',
wikidata = {
property = 'P26',
showdate = true,
sorttype = 'chronological',
conjtype = 'new line',
textformat = '',
precision = 'year',
stilltrue = not dead,
precision = 'year',
sourceproperty = 'P123,P248,P854,P9324',
withsource = 'any',
defaultlink = '-',
showgroupedsource=true
}
},
{
type = 'row',
label = localdata['intitulé enfant'] or 'Lapsi',-- todo : adapter le libellé en genre ?
plurallabel = 'Lapset',
value = 'lapsi',
wikidata = {
property = 'P40',
conjtype = 'new line',
textformat = 'long',
precision = 'year',
stilltrue = (not dead),
precision = 'year',
sourceproperty = 'P123,P248,P854,P9324',
withsource = 'any',
defaultlink = '-',
showgroupedsource=true
}
},--[[
{
type = 'row',
label = 'Sukulaiset',
value = 'sukulaiset',
wikidata = {
property = 'P1038',
excludespecial = true,
conjtype = 'new line',
defaultlink = '-',
link = '-',
statementformat = function(statement)
local personid = tools.getMainId(statement)
local personlabel = wikidata.formatEntity(personid)
local persongender = getgender(personid)
local kintype = wikidata.getFormattedQualifiers(
statement,
"P1039",
{
-- labelformat = function(id) return genderedlabel(id, persongender) end,
link = "-",
sourceproperty = 'P123,P248,P854,P9324',
withsource = 'any',
defaultlink = '-',
showgroupedsource=true
}
)
if kintype then
return personlabel .. " " .. linguistic.inparentheses(kintype)
end
return personlabel
end,
}
},--]]
}}
end
-- Esclavage
function p.slavery()
return {type = 'multi', rows = {
{
type = 'row',
label = 'Yhteiskuntaluokka',
value = 'yhteiskuntaluokka',
wikidata = {property = 'P3716', defaultlinkquery = 'P425',defaultlink='-', sourceproperty = 'P123,P248,P854,P9324',withsource = 'any', showgroupedsource=true},
},
{
type = 'row',
label = 'Omistaja',
plurallabels = 'Omistajat',
value = 'omistaja',
property = 'P127',
defaultlink = '-',
sourceproperty = 'P123,P248,P854,P9324',
withsource = 'any',
showgroupedsource=true
},
}}
end
-- Œuvres
function p.works(params)
params = params or {}
local title = params.title or 'Merkittäviä teoksia'
local wikidata = {
excludespecial = true,
numval = 5,
property = 'P800',
defaultlink = 'image',
showdate= true,
labelformat = function(id) local label = wikidata.getLabel(id) if label then return '<i>' .. label .. '</i>' end end,
}
for i, j in pairs(params) do
wikidata[i] = j
end
return
{type = 'table', title = title, singulartitle = singulartitle, rows =
{
{
type = 'row',
value = {'merkittävät teokset', 'merkittäviä teoksia'},
wikidata = wikidata
}
}
}
end
function p.filmography()
local title = 'Tunnettuja elokuvia'
return
{type = 'row', label = 'Filmografia', value = 'filmografia', property = 'P1283'}
end
function p.discography()
local title = 'Discographie'
return
{type = 'row', label = 'Discographie', value = 'Discographie', property = 'P358'}
end
-- Signature
function p.signature(default)
local nom = localdata.nom or mw.title.getCurrentTitle().text
local alt = 'allekirjoitus ' .. nom
if mw.ustring.match( nom, '^[AEÈÉIOUY]' ) then
alt = "allekirjoitus " .. nom
end
return {
type = 'images',
imageparameters = {'allekirjoitus', 'allekirjoituksen kuva'},
defaultimage = default,
captionparameter = 'allekirjoituksen kuvateksti',
defaultcaption = 'allekirjoitus',
uprightparameter = 'upright allekirjoitus',
defaultupright = 0.5,
defaultalt = alt,
property = 'P109',
numval = 1
}
end
-- Enregistrement vocal
function p.voice()
local function selectsound()
-- priorité au français
if wikidata.getClaims{entity = item, property = 'P990', qualifier = {'P407'}, qualifiervalue = {'Q150'} } then
return {property = 'P990', qualifier = {'P407'}, qualifiervalue = {'Q150'} }
end
return {property = 'P990'}
end
return {
type = 'images',
style = {['padding-top'] = '25px'},--{['border-width'] = '10px', ['border-style'] = 'solid'},
label = 'Ääninäyte',
captionparameter = 'ääninäyte',
value = 'ääninäyte',
wikidata = selectsound (),
numval = 1,
}
end
--== Site web
function p.website()
return general.website()
end
return p