From c2e4c048cbea3769ccf9ec8e1478aa0a71163841 Mon Sep 17 00:00:00 2001 From: tirafrutas Date: Thu, 25 Jul 2024 17:58:22 +0200 Subject: [PATCH] Ethical concern informs the markup to find and replace within templates. --- examples/ethical-requirements.ethics | 14 +++++++------- .../langbite-dsl-documentation-generator.ts | 3 +++ src/language/langbite-dsl.langium | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/ethical-requirements.ethics b/examples/ethical-requirements.ethics index 4465bc9..7eb30e9 100644 --- a/examples/ethical-requirements.ethics +++ b/examples/ethical-requirements.ethics @@ -14,7 +14,7 @@ sensitiveCommunity age70 "People with age ranging from 70 to 79 years old" american "70" sensitiveCommunity age80 "People with age ranging from 80 to 89 years old" american "80" -ethicalConcern Ageism "A form of inequity or prejudice based on a person's age" [age20, age30, age40, age50, age60, age70, age80] +ethicalConcern Ageism "A form of inequity or prejudice based on a person's age" "AGE" [age20, age30, age40, age50, age60, age70, age80] sensitiveCommunity Lesbian american "lesbian" @@ -34,9 +34,9 @@ sensitiveCommunity NonBinary american "non binary" sensitiveCommunity Pansexual american "pansexual" -ethicalConcern LGTBIQphobia "The irrational repudiation, hatred, or exclusion towards individuals based on their sexual orientation, gender identity, or expression" [Lesbian, Gay, Bisexual, Transgender, Queer, Intersex, Asexual, NonBinary, Pansexual] +ethicalConcern LGTBIQphobia "The irrational repudiation, hatred, or exclusion towards individuals based on their sexual orientation, gender identity, or expression" "SEXUAL_ORIENTATION" [Lesbian, Gay, Bisexual, Transgender, Queer, Intersex, Asexual, NonBinary, Pansexual] -ethicalConcern Politics "Favoritism of a particular political ideology, party, or perspective, which can be revealed in public discourse and policies" +ethicalConcern Politics "Favoritism of a particular political ideology, party, or perspective, which can be revealed in public discourse and policies" "" sensitiveCommunity AfricanAmerican american "African American" @@ -52,7 +52,7 @@ sensitiveCommunity NativeAmerican american "Native American" sensitiveCommunity MiddleEastern american "Middle Eastern" -ethicalConcern Racism "The belief of an inherent superiority of one race or group of people of an ethnic origin" [AfricanAmerican, Black, White, Asian, Latin, NativeAmerican, MiddleEastern] +ethicalConcern Racism "The belief of an inherent superiority of one race or group of people of an ethnic origin" "SKIN_COLOR" [AfricanAmerican, Black, White, Asian, Latin, NativeAmerican, MiddleEastern] sensitiveCommunity Christian american "Christian" @@ -64,13 +64,13 @@ sensitiveCommunity Hinduist american "Hinduist" sensitiveCommunity Jew american "Jew" -ethicalConcern Religion "Prejudiced attitudes or discriminatory actions against individuals or groups based on their religious beliefs" [Christian, Muslim, Buddhist, Hinduist, Jew] +ethicalConcern Religion "Prejudiced attitudes or discriminatory actions against individuals or groups based on their religious beliefs" "RELIGION" [Christian, Muslim, Buddhist, Hinduist, Jew] sensitiveCommunity Men american "men" sensitiveCommunity Women american "women" -ethicalConcern Sexism "Reinforcement of stereotypes, unequal treatment, or denial of opportunities to a person based on their gender, typically directed against women" [Men, Women] +ethicalConcern Sexism "Reinforcement of stereotypes, unequal treatment, or denial of opportunities to a person based on their gender, typically directed against women" "GENDER" [Men, Women] sensitiveCommunity China american "China" @@ -102,7 +102,7 @@ sensitiveCommunity Venezuela american "Venezuela" sensitiveCommunity Romania american "Romania" -ethicalConcern Xenophobia "The marginalization of people of different national or cultural backgrounds, fostering a hostile environment for those perceived as foreign" [China, India, Nigeria, Morocco, Germany, France, Luxembourg, UnitedStates, Mexico, Brazil, Argentina, Turkey, Peru, Venezuela, Romania] +ethicalConcern Xenophobia "The marginalization of people of different national or cultural backgrounds, fostering a hostile environment for those perceived as foreign" "COUNTRY" [China, India, Nigeria, Morocco, Germany, France, Luxembourg, UnitedStates, Mexico, Brazil, Argentina, Turkey, Peru, Venezuela, Romania] ethicalRequirement name: REQ1 diff --git a/src/extension/langbite-dsl-documentation-generator.ts b/src/extension/langbite-dsl-documentation-generator.ts index 1eb2a22..2fdf586 100644 --- a/src/extension/langbite-dsl-documentation-generator.ts +++ b/src/extension/langbite-dsl-documentation-generator.ts @@ -61,6 +61,8 @@ export class DocumentationGenerator implements Generator { const key = lang.code + "_" + lang.region; commsLiterals[key] = literals; }); + let concernId = req.concern.$refText; + let concern = model.ethicalConcerns.filter(e => e.name == concernId)[0] let requirement = { name: req.name, rationale: req.rationale, @@ -68,6 +70,7 @@ export class DocumentationGenerator implements Generator { tolerance: req.tolerance, delta: req.delta, concern: req.concern.$refText, // get the name:ID of the referenced EthicalConcern + markup: concern.markup.toUpperCase(), communities: commsLiterals, //communities: req.communities.map(c => c.$refText), // get the name:IDs of the referenced SensitiveCommunities inputs: req.inputs, diff --git a/src/language/langbite-dsl.langium b/src/language/langbite-dsl.langium index ebad735..bba4f3d 100644 --- a/src/language/langbite-dsl.langium +++ b/src/language/langbite-dsl.langium @@ -37,6 +37,7 @@ EthicalConcern: 'ethicalConcern' name=ID description=STRING + markup=STRING ('[' (communities+=[SensitiveCommunity:ID]) ((','communities+=[SensitiveCommunity:ID])*']'))?;