Modul:Studienprofil
Aus MAV
Aufruf der Funktion
Bitte exakt nach folgendem Schema in der "Vorlage:MAV" aufrufen
{{#invoke:Studienprofil|combinedStudienprofiles|{{SUBPAGENAME}}}}
local p = {}
local function asText(v)
if type(v) == 'table' then
return v.fulltext or v.value or v[1] or ''
end
return v or ''
end
function p.getEvents(Beginn, Ende, Kategorie, Beschreibung)
local searchresult = ''
if Beschreibung == '' then
searchresult = mw.smw.ask( '[[Kategorie:' .. Kategorie .. ']][[Beginn::<' .. Ende .. ']][[Ende::>' .. Beginn .. ']][[Geographikum::Universität Wittenberg]]|?Beginn=Beginn|?Ende=Ende|limit=500' )
else
searchresult = mw.smw.ask( '[[Kategorie:' .. Kategorie .. ']][[Beginn::<' .. Ende .. ']][[Ende::>' .. Beginn .. ']][[Geographikum::Universität Wittenberg]]|?' .. Beschreibung .. '|?Beginn=Beginn|?Ende=Ende|limit=500' )
end
if not searchresult then
return 'Keine Einträge gefunden\n'
end
local out = '{| class="wikitable sortable"\n'
out = out .. '! Name !! Beginn !! Ende\n'
for _, row in ipairs(searchresult) do
out = out .. '|-\n'
out = out .. '| ' .. row[1] .. '\n'
if Beschreibung ~= '' then
out = out .. '| ' .. asText(row[Beschreibung]) .. '\n'
end
out = out .. '| ' .. (row.Beginn or '') .. '\n'
out = out .. '| ' .. (row.Ende or '') .. '\n'
end
out = out .. '|}\n'
return out
end
function p.getPrintedDissertations(Beginn, Ende)
local searchresult = ''
searchresult = mw.smw.ask( '[[Kategorie:Disputation]][[DisputationDatumBeginn::<' .. Ende .. ']][[DisputationDatumEnde::>' .. Beginn .. ']][[DisputationOrt::Universität Wittenberg]]|?Druck=GedrucktIn|?DisputationTyp=Typ|?DisputationDatumBeginn=Datum|?VDTitel=Titel|?Schlagworte|?Präses=Praeses|?Respondent=Respondent|limit=500' )
if not searchresult then
return 'Keine Einträge gefunden\n'
end
local out = '{| class="wikitable sortable"\n'
out = out .. '! Gedruckt in !! Disputationstyp !! Datum !! Titel !! Schlagworte !! Praeses !! Respondent \n'
for _, row in ipairs(searchresult) do
out = out .. '|-\n'
out = out .. '| ' .. row.GedrucktIn .. '\n'
out = out .. '| ' .. (asText(row.Typ) or '') .. '\n'
out = out .. '| ' .. (asText(row.Datum) or '') .. '\n'
out = out .. '| ' .. (asText(row.Titel) or '') .. '\n'
out = out .. '| ' .. (asText(row.Schlagworte) or '') .. '\n'
out = out .. '| ' .. (asText(row.Praeses) or '') .. '\n'
out = out .. '| ' .. (asText(row.Respondent) or '') .. '\n'
end
out = out .. '|}\n'
return out
end
function p.createSingleStudienprofil(Beginn, Ende)
local returnstring = ''
local categories = {
{'Mitstundenten', 'Ausbildung', '' },
{'Akademische Abschlüsse', 'Abschluss', 'Grad'},
{'Dozenten', 'Tätigkeit', 'Tätigkeitsart'},
{'Vorlesungen', 'Vorlesung', 'Thema'}
}
for _, entry in ipairs(categories) do
returnstring = returnstring .. "'''" .. entry[1] .. ": '''\n" .. p.getEvents(Beginn, Ende, entry[2], entry[3])
end
returnstring = returnstring .. "'''Gedruckte Dissertationen an der Universität Wittenberg: '''\n" .. p.getPrintedDissertations(Beginn, Ende)
return returnstring
end
function p.combinedStudienprofiles(frame)
local queryResult = ''
local pagename = frame.args[1]
local returnvalue = '\n'
queryResult = mw.smw.ask( '[[Kategorie:Ausbildung]][[Person::' .. pagename .. ']][[Geographikum::Universität Wittenberg]]|mainlabel=-|?Beginn|?Ende|sort=DatumSortiert' )
if queryResult == nil then
return 'Keine Angaben zu einem Studium in Wittenberg gefunden.'
end
if type( queryResult ) == "table" then
local Beginn = ''
local Ende = ''
for num, row in ipairs( queryResult ) do
for property, data in pairs( row ) do
if property == 'Beginn' then
Beginn = data
elseif property == 'Ende' then
Ende = data
end
end
returnvalue = returnvalue .. '=== Studium (von ' .. Beginn .. ' bis ' .. Ende .. ') ===\n' .. p.createSingleStudienprofil(Beginn, Ende)
end
end
return returnvalue
end
return p