Modul:Auszeichnung: Unterschied zwischen den Versionen
Aus FürthWiki
(limit=200) |
(Auszeichnungsspalten vorläufig deaktiviert) |
||
| (25 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 6: | Zeile 6: | ||
function p.AbfrageAuszeichnungen(frame) | function p.AbfrageAuszeichnungen(frame) | ||
-- mw.log("AbfrageAuszeichnungen(frame)") | |||
-- mw.logObject(frame, "frame") | |||
-- Konsolenzeile zum Debuggen: | -- Konsolenzeile zum Debuggen: | ||
-- p.AbfrageAuszeichnungen{pargs={["Aufschlüsselung"]="Auszeichnungen"}} | -- p.AbfrageAuszeichnungen{pargs={["Aufschlüsselung"]="Auszeichnungen"}} | ||
| Zeile 15: | Zeile 15: | ||
-- Attribut-Werte übernehmen | -- Attribut-Werte übernehmen | ||
local frame, pargs = dev.GetFrameAndParentArgs(frame) | local frame, pargs = dev.GetFrameAndParentArgs(frame) | ||
local | local attr_list = { | ||
"Auszeichnung", "Aufschlüsselung", | "Auszeichnung", "Aufschlüsselung", | ||
"VerleihungVon", "VerleihungBis", | "VerleihungVon", "VerleihungBis", | ||
"GeburtsdatumVon", "GeburtsdatumBis", | "GeburtsdatumVon", "GeburtsdatumBis", | ||
"Geburtsort", "Geschlecht"}) | "Geburtsort", "Geschlecht", | ||
"Beruf" | |||
} | |||
local attr, empty = wik.getArgs(frame.args, attr_list) -- Filter-Werte können direkt oder | |||
if empty then -- indirekt (ParentArgs) übergeben werden | |||
attr = wik.getArgs(pargs, attr_list) | |||
end | |||
-- Seiten-Selektoren für die Abfragen | -- Seiten-Selektoren für die Abfragen | ||
local | local top_prefix, top_postfix, sub_prefix, sub_postfix | ||
if attr["Aufschlüsselung"] == "Auszeichnungen" then | if attr["Aufschlüsselung"] == "Auszeichnungen" then | ||
top_prefix, top_postfix = "[[-has subobject::<q>", "</q>]]" -- Abfrage aus Sicht der Auszeichnung-subobject-Ebene | top_prefix, top_postfix = "[[-has subobject::<q>", "</q>]]" -- Abfrage aus Sicht der Auszeichnung-subobject-Ebene | ||
| Zeile 36: | Zeile 37: | ||
end | end | ||
-- Basis-Selektor | -- Basis-Selektor | ||
page_selector_basis = top_prefix .. "[[:+]][[Kategorie:Personen]]" .. top_postfix | local page_selector_basis = top_prefix .. "[[:+]][[Kategorie:Personen]]" .. top_postfix | ||
page_selector_basis = page_selector_basis .. sub_prefix .. "[[SubObjektTyp::Auszeichnung]]" .. sub_postfix | page_selector_basis = page_selector_basis .. sub_prefix .. "[[SubObjektTyp::Auszeichnung]]" .. sub_postfix | ||
if attr["Auszeichnung"] ~= nil then | if attr["Auszeichnung"] ~= nil then | ||
| Zeile 55: | Zeile 56: | ||
page_selector_basis = page_selector_basis .. top_prefix .. "[[Geburtsdatum::<" .. attr["GeburtsdatumBis"] .. "]]" .. top_postfix | page_selector_basis = page_selector_basis .. top_prefix .. "[[Geburtsdatum::<" .. attr["GeburtsdatumBis"] .. "]]" .. top_postfix | ||
end | end | ||
if attr["Beruf"] ~= nil then | |||
local beruf = str.split2(attr["Beruf"], ",") | |||
beruf = table.concat(beruf, "||") | |||
page_selector_basis = page_selector_basis .. top_prefix .. "[[Beruf::" .. beruf .. "]]" .. top_postfix | |||
end | |||
-- Geburtsort-Selektoren | -- Geburtsort-Selektoren | ||
local page_selector_fuerth = top_prefix .. "[[GeburtsortHeuteFürth::wahr]]" .. top_postfix | |||
local page_selector_ausserhalb = top_prefix .. "[[GeburtsortHeuteFürth::falsch]]" .. top_postfix | |||
local page_selector_ort = "" | |||
if attr["Geburtsort"] == "Fürth" then | if attr["Geburtsort"] == "Fürth" then | ||
page_selector_ort = | page_selector_ort = page_selector_fuerth | ||
end | end | ||
if attr["Geburtsort"] == "außerhalb" then | if attr["Geburtsort"] == "außerhalb" then | ||
page_selector_ort = | page_selector_ort = page_selector_ausserhalb | ||
end | end | ||
-- Geschlecht-Selektoren | -- Geschlecht-Selektoren | ||
page_selector_maennlich = top_prefix .. "[[Geschlecht::männlich]]" .. top_postfix | local page_selector_maennlich = top_prefix .. "[[Geschlecht::männlich]]" .. top_postfix | ||
page_selector_weiblich = top_prefix .. "[[Geschlecht::weiblich]]" .. top_postfix | local page_selector_weiblich = top_prefix .. "[[Geschlecht::weiblich]]" .. top_postfix | ||
page_selector_divers = top_prefix .. "[[Geschlecht::divers]]" .. top_postfix | local page_selector_divers = top_prefix .. "[[Geschlecht::divers]]" .. top_postfix | ||
local page_selector_geschlecht = "" | |||
if attr["Geschlecht"] ~= nil then | if attr["Geschlecht"] ~= nil then | ||
page_selector_geschlecht = top_prefix .. "[[Geschlecht::" .. attr["Geschlecht"] .. "]]" .. top_postfix | page_selector_geschlecht = top_prefix .. "[[Geschlecht::" .. attr["Geschlecht"] .. "]]" .. top_postfix | ||
end | end | ||
-- Statistik | -- Statistik | ||
local n_basis_ort_geschlecht = mw.smw.ask(page_selector_basis .. page_selector_ort .. page_selector_geschlecht .. "| format=count | limit=10000") | |||
t = t .. "<br>'''".. n_basis_ort_geschlecht .. " " | |||
if attr["Aufschlüsselung"] == "Personen" then | if attr["Aufschlüsselung"] == "Personen" then | ||
t = t .. " | t = t .. "Person(en) mit " | ||
end | end | ||
t = t .. " | t = t .. "Auszeichnung(en) gefunden" | ||
if attr["Geschlecht"] == nil then | if attr["Geschlecht"] == nil then | ||
local n_basis_ort_weiblich = mw.smw.ask(page_selector_basis .. page_selector_ort .. page_selector_weiblich .. "| format=count | limit=10000") | |||
local n_basis_ort_maennlich = mw.smw.ask(page_selector_basis .. page_selector_ort .. page_selector_maennlich .. "| format=count | limit=10000") | |||
local n_basis_ort_divers = mw.smw.ask(page_selector_basis .. page_selector_ort .. page_selector_divers .. "| format=count | limit=10000") | |||
local n_basis_ort_unbekannt = n_basis_ort_geschlecht - n_basis_ort_weiblich - n_basis_ort_maennlich - n_basis_ort_divers | |||
local p_basis_ort_weiblich = math.floor(n_basis_ort_weiblich / n_basis_ort_geschlecht * 100 + 0.5) | |||
local p_basis_ort_maennlich = math.floor(n_basis_ort_maennlich / n_basis_ort_geschlecht * 100 + 0.5) | |||
local p_basis_ort_divers = math.floor(n_basis_ort_divers / n_basis_ort_geschlecht * 100 + 0.5) | |||
local p_basis_ort_unbekannt = math.floor(n_basis_ort_unbekannt / n_basis_ort_geschlecht * 100 + 0.5) | |||
t = t .. "<br>→ davon " .. n_basis_ort_weiblich .. " (≈ " .. p_basis_ort_weiblich.. " %) Frauen" | |||
t = t .. ", " .. n_basis_ort_maennlich .. " (≈ " .. p_basis_ort_maennlich.. " %) Männer" | |||
t = t .. " und " .. n_basis_ort_divers .. " (≈ " .. p_basis_ort_divers.. " %) Diverse" | |||
if n_basis_ort_unbekannt > 0 then | |||
t = t .. ", '''bei " .. n_basis_ort_unbekannt .. " (≈ " .. p_basis_ort_unbekannt.. " %) Person(en) nicht bekannt'''" | |||
end | |||
end | end | ||
if attr["Geburtsort"] == nil then | if attr["Geburtsort"] == nil then | ||
local n_basis_fuerth_geschlecht = mw.smw.ask(page_selector_basis .. page_selector_fuerth .. page_selector_geschlecht .. "| format=count | limit=10000") | |||
local n_basis_ausserhalb_geschlecht = mw.smw.ask(page_selector_basis .. page_selector_ausserhalb .. page_selector_geschlecht .. "| format=count | limit=10000") | |||
local n_basis_unbekannt_geschlecht = n_basis_ort_geschlecht - n_basis_fuerth_geschlecht - n_basis_ausserhalb_geschlecht | |||
local p_basis_fuerth_geschlecht = math.floor(n_basis_fuerth_geschlecht / n_basis_ort_geschlecht * 100 + 0.5) | |||
local p_basis_ausserhalb_geschlecht = math.floor(n_basis_ausserhalb_geschlecht / n_basis_ort_geschlecht * 100 + 0.5) | |||
local p_basis_unbekannt_geschlecht = math.floor(n_basis_unbekannt_geschlecht / n_basis_ort_geschlecht * 100 + 0.5) | |||
t = t .. "<br>→ davon " .. n_basis_fuerth_geschlecht .. " (≈ " .. p_basis_fuerth_geschlecht.. " %) gebürtige Fürther" | |||
t = t .. " und " .. n_basis_ausserhalb_geschlecht .. " (≈ " .. p_basis_ausserhalb_geschlecht.. " %) außerhalb Fürths geboren" | |||
if n_basis_unbekannt_geschlecht > 0 then | |||
t = t .. ", '''bei " .. n_basis_unbekannt_geschlecht .. " (≈ " .. p_basis_unbekannt_geschlecht.. " %) Person(en) nicht bekannt'''" | |||
end | |||
end | end | ||
t = t .. "<br>'''" | t = t .. "<br>'''" | ||
| Zeile 99: | Zeile 123: | ||
t = t .. "|mainlabel=-" | t = t .. "|mainlabel=-" | ||
t = t .. "|?-has subobject.Seite=Person" | t = t .. "|?-has subobject.Seite=Person" | ||
-- t = t .. "|?-has subobject.Geburtsdatum" | |||
-- t = t .. "|?-has subobject.Geburtsort" | |||
-- t = t .. "|?-has subobject.Geschlecht" | |||
-- t = t .. "|?-has subobject.Beruf" | |||
t = t .. "|?Auszeichnung" | t = t .. "|?Auszeichnung" | ||
t = t .. "|?VerleihungAm=Verleihung" | t = t .. "|?VerleihungAm=Verleihung" | ||
| Zeile 110: | Zeile 135: | ||
t = t .. "|?Geburtsort" | t = t .. "|?Geburtsort" | ||
t = t .. "|?Geschlecht" | t = t .. "|?Geschlecht" | ||
t = t .. "|?Beruf" | |||
t = t .. "|?has subobject.Auszeichnung" | t = t .. "|?has subobject.Auszeichnung" | ||
end | end | ||
Aktuelle Version vom 5. Dezember 2025, 09:35 Uhr
Seiten-Übersicht
| Hauptseite | Unterseiten | ||
|---|---|---|---|
| Allgemein | |||
| Faktenbox | Vorlagen | ||
| Formulare |
|
||
| Module | |||
| Abfrage | Vorlagen |
| |
| Formulare |
| ||
| Sonstige | |||
Unterseiten
Siehe auch
- Auszeichnungen
- Kategorie:Personen
- Kategorie:Auszeichnungen
- Formular:Abfrage Auszeichnungen
- Vorlage:Abfrage Auszeichnungen
p = {}
local dev = require("Modul:Development")
local str = require("Modul:String")
local wik = require("Modul:Wiki")
function p.AbfrageAuszeichnungen(frame)
-- mw.log("AbfrageAuszeichnungen(frame)")
-- mw.logObject(frame, "frame")
-- Konsolenzeile zum Debuggen:
-- p.AbfrageAuszeichnungen{pargs={["Aufschlüsselung"]="Auszeichnungen"}}
-- p.AbfrageAuszeichnungen{pargs={["Aufschlüsselung"]="Personen"}}
local t = ""
-- Attribut-Werte übernehmen
local frame, pargs = dev.GetFrameAndParentArgs(frame)
local attr_list = {
"Auszeichnung", "Aufschlüsselung",
"VerleihungVon", "VerleihungBis",
"GeburtsdatumVon", "GeburtsdatumBis",
"Geburtsort", "Geschlecht",
"Beruf"
}
local attr, empty = wik.getArgs(frame.args, attr_list) -- Filter-Werte können direkt oder
if empty then -- indirekt (ParentArgs) übergeben werden
attr = wik.getArgs(pargs, attr_list)
end
-- Seiten-Selektoren für die Abfragen
local top_prefix, top_postfix, sub_prefix, sub_postfix
if attr["Aufschlüsselung"] == "Auszeichnungen" then
top_prefix, top_postfix = "[[-has subobject::<q>", "</q>]]" -- Abfrage aus Sicht der Auszeichnung-subobject-Ebene
sub_prefix, sub_postfix = "", "" -- top-Attribute brauchen "-has subobject" drumherum
elseif attr["Aufschlüsselung"] == "Personen" then
top_prefix, top_postfix = "", "" -- Abfrage aus Sicht der Personen-top-Ebene (nicht-subobject-Ebene)
sub_prefix, sub_postfix = "[[has subobject::<q>", "</q>]]" -- subobject-Attribute brauchen "has subobject" drumherum
end
-- Basis-Selektor
local page_selector_basis = top_prefix .. "[[:+]][[Kategorie:Personen]]" .. top_postfix
page_selector_basis = page_selector_basis .. sub_prefix .. "[[SubObjektTyp::Auszeichnung]]" .. sub_postfix
if attr["Auszeichnung"] ~= nil then
local auszeichnungen = str.split2(attr["Auszeichnung"], ",")
auszeichnungen = table.concat(auszeichnungen, "||")
page_selector_basis = page_selector_basis .. sub_prefix .. "[[Auszeichnung::" .. auszeichnungen .. "]]" .. sub_postfix
end
if attr["VerleihungVon"] ~= nil then
page_selector_basis = page_selector_basis .. sub_prefix .. "[[VerleihungAm::>" .. attr["VerleihungVon"] .. "]]" .. sub_postfix
end
if attr["VerleihungBis"] ~= nil then
page_selector_basis = page_selector_basis .. sub_prefix .. "[[VerleihungAm::<" .. attr["VerleihungBis"] .. "]]" .. sub_postfix
end
if attr["GeburtsdatumVon"] ~= nil then
page_selector_basis = page_selector_basis .. top_prefix .. "[[Geburtsdatum::>" .. attr["GeburtsdatumVon"] .. "]]" .. top_postfix
end
if attr["GeburtsdatumBis"] ~= nil then
page_selector_basis = page_selector_basis .. top_prefix .. "[[Geburtsdatum::<" .. attr["GeburtsdatumBis"] .. "]]" .. top_postfix
end
if attr["Beruf"] ~= nil then
local beruf = str.split2(attr["Beruf"], ",")
beruf = table.concat(beruf, "||")
page_selector_basis = page_selector_basis .. top_prefix .. "[[Beruf::" .. beruf .. "]]" .. top_postfix
end
-- Geburtsort-Selektoren
local page_selector_fuerth = top_prefix .. "[[GeburtsortHeuteFürth::wahr]]" .. top_postfix
local page_selector_ausserhalb = top_prefix .. "[[GeburtsortHeuteFürth::falsch]]" .. top_postfix
local page_selector_ort = ""
if attr["Geburtsort"] == "Fürth" then
page_selector_ort = page_selector_fuerth
end
if attr["Geburtsort"] == "außerhalb" then
page_selector_ort = page_selector_ausserhalb
end
-- Geschlecht-Selektoren
local page_selector_maennlich = top_prefix .. "[[Geschlecht::männlich]]" .. top_postfix
local page_selector_weiblich = top_prefix .. "[[Geschlecht::weiblich]]" .. top_postfix
local page_selector_divers = top_prefix .. "[[Geschlecht::divers]]" .. top_postfix
local page_selector_geschlecht = ""
if attr["Geschlecht"] ~= nil then
page_selector_geschlecht = top_prefix .. "[[Geschlecht::" .. attr["Geschlecht"] .. "]]" .. top_postfix
end
-- Statistik
local n_basis_ort_geschlecht = mw.smw.ask(page_selector_basis .. page_selector_ort .. page_selector_geschlecht .. "| format=count | limit=10000")
t = t .. "<br>'''".. n_basis_ort_geschlecht .. " "
if attr["Aufschlüsselung"] == "Personen" then
t = t .. "Person(en) mit "
end
t = t .. "Auszeichnung(en) gefunden"
if attr["Geschlecht"] == nil then
local n_basis_ort_weiblich = mw.smw.ask(page_selector_basis .. page_selector_ort .. page_selector_weiblich .. "| format=count | limit=10000")
local n_basis_ort_maennlich = mw.smw.ask(page_selector_basis .. page_selector_ort .. page_selector_maennlich .. "| format=count | limit=10000")
local n_basis_ort_divers = mw.smw.ask(page_selector_basis .. page_selector_ort .. page_selector_divers .. "| format=count | limit=10000")
local n_basis_ort_unbekannt = n_basis_ort_geschlecht - n_basis_ort_weiblich - n_basis_ort_maennlich - n_basis_ort_divers
local p_basis_ort_weiblich = math.floor(n_basis_ort_weiblich / n_basis_ort_geschlecht * 100 + 0.5)
local p_basis_ort_maennlich = math.floor(n_basis_ort_maennlich / n_basis_ort_geschlecht * 100 + 0.5)
local p_basis_ort_divers = math.floor(n_basis_ort_divers / n_basis_ort_geschlecht * 100 + 0.5)
local p_basis_ort_unbekannt = math.floor(n_basis_ort_unbekannt / n_basis_ort_geschlecht * 100 + 0.5)
t = t .. "<br>→ davon " .. n_basis_ort_weiblich .. " (≈ " .. p_basis_ort_weiblich.. " %) Frauen"
t = t .. ", " .. n_basis_ort_maennlich .. " (≈ " .. p_basis_ort_maennlich.. " %) Männer"
t = t .. " und " .. n_basis_ort_divers .. " (≈ " .. p_basis_ort_divers.. " %) Diverse"
if n_basis_ort_unbekannt > 0 then
t = t .. ", '''bei " .. n_basis_ort_unbekannt .. " (≈ " .. p_basis_ort_unbekannt.. " %) Person(en) nicht bekannt'''"
end
end
if attr["Geburtsort"] == nil then
local n_basis_fuerth_geschlecht = mw.smw.ask(page_selector_basis .. page_selector_fuerth .. page_selector_geschlecht .. "| format=count | limit=10000")
local n_basis_ausserhalb_geschlecht = mw.smw.ask(page_selector_basis .. page_selector_ausserhalb .. page_selector_geschlecht .. "| format=count | limit=10000")
local n_basis_unbekannt_geschlecht = n_basis_ort_geschlecht - n_basis_fuerth_geschlecht - n_basis_ausserhalb_geschlecht
local p_basis_fuerth_geschlecht = math.floor(n_basis_fuerth_geschlecht / n_basis_ort_geschlecht * 100 + 0.5)
local p_basis_ausserhalb_geschlecht = math.floor(n_basis_ausserhalb_geschlecht / n_basis_ort_geschlecht * 100 + 0.5)
local p_basis_unbekannt_geschlecht = math.floor(n_basis_unbekannt_geschlecht / n_basis_ort_geschlecht * 100 + 0.5)
t = t .. "<br>→ davon " .. n_basis_fuerth_geschlecht .. " (≈ " .. p_basis_fuerth_geschlecht.. " %) gebürtige Fürther"
t = t .. " und " .. n_basis_ausserhalb_geschlecht .. " (≈ " .. p_basis_ausserhalb_geschlecht.. " %) außerhalb Fürths geboren"
if n_basis_unbekannt_geschlecht > 0 then
t = t .. ", '''bei " .. n_basis_unbekannt_geschlecht .. " (≈ " .. p_basis_unbekannt_geschlecht.. " %) Person(en) nicht bekannt'''"
end
end
t = t .. "<br>'''"
-- die eigentliche Tabelle
t = t .. "{{#ask:" .. page_selector_basis .. page_selector_ort .. page_selector_geschlecht
if attr["Aufschlüsselung"] == "Auszeichnungen" then
t = t .. "|mainlabel=-"
t = t .. "|?-has subobject.Seite=Person"
-- t = t .. "|?-has subobject.Geburtsdatum"
-- t = t .. "|?-has subobject.Geburtsort"
-- t = t .. "|?-has subobject.Geschlecht"
-- t = t .. "|?-has subobject.Beruf"
t = t .. "|?Auszeichnung"
t = t .. "|?VerleihungAm=Verleihung"
t = t .. "|?AuszeichnungBemerkung=Bemerkung"
elseif attr["Aufschlüsselung"] == "Personen" then
t = t .. "|mainlabel=Person"
t = t .. "|?Geburtsdatum"
t = t .. "|?Geburtsort"
t = t .. "|?Geschlecht"
t = t .. "|?Beruf"
t = t .. "|?has subobject.Auszeichnung"
end
t = t .. "|format=table"
t = t .. "|limit=200"
t = t .. "|default=<br/>'''Es konnten keine " .. attr["Aufschlüsselung"] .. " mit diesen Eingaben gefunden werden.'''<br/>"
t = t .. "}}"
mw.logObject(t, "t")
t = frame:preprocess(t)
return t
end
return p