Difference between revisions of "Template:SetTopicCurrentAnswer"
(Created page with "<noinclude> This template is used to save records on which communities have currently accepted answers to the question and the respective accepted answers. For each communit...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
− | This template is used to save records on which communities have currently accepted answers to the question and the respective accepted answers. | + | This template is used to save records on which communities have currently accepted answers to the question and the respective accepted answers. This includes: |
− | + | * Complete answers: all the direct answers to the question; | |
+ | * Inherited: all the answers to the superquestions (complete or inherited); | ||
+ | * Partial: all the answers to the qubquestions (complete or partial); this option is used only if there are no complete answers to the question. | ||
− | + | For each community where the topic is currently accepted, the template searches for accepted theories, and if a theory is found, for each theory it creates a combined subobject with the following properties: | |
− | * <code><nowiki>SubObjectCategory</nowiki></code> = " | + | |
+ | * <code><nowiki>SubObjectCategory</nowiki></code> = "Current Answer". | ||
* <code><nowiki>Topic</nowiki></code> - the question the theory is trying to answer. | * <code><nowiki>Topic</nowiki></code> - the question the theory is trying to answer. | ||
* <code><nowiki>Topic Type</nowiki></code> - the type of the topic for ease of access (Normative, Descriptive, Definitional) | * <code><nowiki>Topic Type</nowiki></code> - the type of the topic for ease of access (Normative, Descriptive, Definitional) | ||
Line 11: | Line 14: | ||
* <code><nowiki>Community</nowiki></code> - the community that accepts the theory. | * <code><nowiki>Community</nowiki></code> - the community that accepts the theory. | ||
* <code><nowiki>Theory</nowiki></code> - the full page name of the theories that answer the topic. | * <code><nowiki>Theory</nowiki></code> - the full page name of the theories that answer the topic. | ||
− | * <code><nowiki>Answer Type</nowiki></code> | + | * <code><nowiki>Answer Type</nowiki></code> - Complete for direct answers, Partial for answers to subquestions, and Inherited for answers to superquestions. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
* <code><nowiki>Original Topic</nowiki></code> - the original topic to which the theories were the answer to. For inherited answers, this will hold the fullpagename of the parent topic (superquestion). For partial answers gauged from the subquestions, this will hold the fullpagename of the child topic (subquestion). For direct answers, this will be equal to Topic. | * <code><nowiki>Original Topic</nowiki></code> - the original topic to which the theories were the answer to. For inherited answers, this will hold the fullpagename of the parent topic (superquestion). For partial answers gauged from the subquestions, this will hold the fullpagename of the child topic (subquestion). For direct answers, this will be equal to Topic. | ||
* <code><nowiki>Sorting Order</nowiki></code> - the Sorting Order of the topic; this is used to sort the accepted answers when displaying them. | * <code><nowiki>Sorting Order</nowiki></code> - the Sorting Order of the topic; this is used to sort the accepted answers when displaying them. | ||
* <code><nowiki>Formulation Text</nowiki></code> - this is the combined formulation text of the answers to the original topic. If the original topic has a multiple answer formula, then the multiple answers will be combined here. Suppose the question ''Epistemic Stances Towards Theories'' has several accepted answers, such as: | * <code><nowiki>Formulation Text</nowiki></code> - this is the combined formulation text of the answers to the original topic. If the original topic has a multiple answer formula, then the multiple answers will be combined here. Suppose the question ''Epistemic Stances Towards Theories'' has several accepted answers, such as: | ||
− | * | + | * The stance of theory acceptance can be taken towards theories. |
− | * | + | * The stance of theory pursuit can be taken towards theories. |
− | * | + | * The stance of theory use can be taken towards theories. |
The value of <code><nowiki>Formulation Text</nowiki></code> will be: | The value of <code><nowiki>Formulation Text</nowiki></code> will be: | ||
− | * | + | * The stances of theory acceptance, theory pursuit, and theory use can be taken towards theories. |
+ | |||
+ | If the original topic has no multiple answer formula, all the answers will be added one after another; since each formulation text is a full sentence, a space will be added as a separator. | ||
+ | |||
+ | If no theory is found that answers the question, its superquestions or its subquestions, an empty subobject is created: | ||
+ | * <code><nowiki>Answer Type</nowiki></code> = None. | ||
'''NOTE:''' As any "set" template, it doesn't print anything on the page, but merely sets the appropriate values. | '''NOTE:''' As any "set" template, it doesn't print anything on the page, but merely sets the appropriate values. | ||
+ | |||
'''Parameters:''' | '''Parameters:''' | ||
* <code><nowiki>|topic=</nowiki></code> - the full page name of the topic. | * <code><nowiki>|topic=</nowiki></code> - the full page name of the topic. | ||
* <code><nowiki>|subfield=</nowiki></code> - e.g. Ontology, Dynamics. | * <code><nowiki>|subfield=</nowiki></code> - e.g. Ontology, Dynamics. | ||
+ | |||
</noinclude><includeonly><!-- | </noinclude><includeonly><!-- | ||
Line 53: | Line 50: | ||
-->{{#arrayunique: varCommunities}}<!-- remove duplicates and empty values | -->{{#arrayunique: varCommunities}}<!-- remove duplicates and empty values | ||
-->{{#arrayprint: varCommunities||varCommunity|<!-- | -->{{#arrayprint: varCommunities||varCommunity|<!-- | ||
+ | |||
+ | --><!-- | ||
+ | -->{{#vardefine: varHasAnswer|no}}<!-- | ||
+ | --><!-- | ||
--><!-- | --><!-- | ||
Line 59: | Line 60: | ||
-->{{#arrayprint: arrayParentTopics||varParentTopic|<!-- | -->{{#arrayprint: arrayParentTopics||varParentTopic|<!-- | ||
--><!-- | --><!-- | ||
− | --><!-- Check if the parent topic has accepted theories: these can be complete or inherited | + | --><!-- Check if the parent topic has accepted theories: these can be complete or inherited: copy as inherited answers to the topic |
+ | --><!-- | ||
+ | -->{{#ask:<!-- | ||
+ | -->[[SubObjectCategory::Current Answer]]<!-- | ||
+ | -->[[Community::varCommunity]]<!-- | ||
+ | -->[[Topic::varParentTopic]]<!-- | ||
+ | -->[[Answer Type::Complete||Inherited]]<!-- | ||
+ | -->|?Topic<!-- | ||
+ | -->|?Original Topic<!-- | ||
+ | -->|?Community<!-- | ||
+ | -->|?Subfield<!-- | ||
+ | -->|?Topic Type<!-- | ||
+ | -->|?Theory<!-- | ||
+ | -->|?Formulation Text<!-- | ||
+ | -->|?Sorting Order<!-- | ||
+ | -->|headers=hide<!-- | ||
+ | -->|mainlabel=-<!-- | ||
+ | -->|link=none<!-- | ||
+ | -->|limit=10000<!-- | ||
+ | -->|named args=yes<!-- | ||
+ | -->|format=template<!-- | ||
+ | -->|template=SetTopicCurrentAnswer-inherited<!-- | ||
+ | -->|userparam={{{topic|}}}<!-- | ||
+ | -->}}<!-- | ||
+ | |||
--><!-- | --><!-- | ||
-->{{#arraydefine: varParentTheories<!-- | -->{{#arraydefine: varParentTheories<!-- | ||
-->|{{#ask:<!-- | -->|{{#ask:<!-- | ||
− | -->[[SubObjectCategory:: | + | -->[[SubObjectCategory::Current Answer]]<!-- |
-->[[Community::varCommunity]]<!-- | -->[[Community::varCommunity]]<!-- | ||
-->[[Topic::varParentTopic]]<!-- | -->[[Topic::varParentTopic]]<!-- | ||
Line 71: | Line 96: | ||
-->|mainlabel=-<!-- | -->|mainlabel=-<!-- | ||
-->|link=none<!-- | -->|link=none<!-- | ||
+ | -->|limit=10000<!-- | ||
-->}}<!-- | -->}}<!-- | ||
-->| , |unique<!-- | -->| , |unique<!-- | ||
Line 83: | Line 109: | ||
-->|<!-- | -->|<!-- | ||
--><!-- the topic has answers | --><!-- the topic has answers | ||
− | + | -->{{#vardefine: varHasAnswer|yes}}<!-- | |
− | |||
− | |||
− | -->{{#vardefine: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
--><!-- | --><!-- | ||
--><!-- set all the theories as accepted by the community | --><!-- set all the theories as accepted by the community | ||
Line 104: | Line 115: | ||
-->|<!-- | -->|<!-- | ||
-->{{#set: Has Accepted Answer In {{PAGENAME:varCommunity}}=varTheory}}<!-- | -->{{#set: Has Accepted Answer In {{PAGENAME:varCommunity}}=varTheory}}<!-- | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
--><!-- | --><!-- | ||
-->}}<!-- arrayprint varParentTheories | -->}}<!-- arrayprint varParentTheories | ||
Line 132: | Line 130: | ||
-->{{#arraydefine: varTheories|{{PrintTopicAnswerAcceptedInCommunity|topic={{{topic|}}}|community=varCommunity|link=none}}|,|}}<!-- | -->{{#arraydefine: varTheories|{{PrintTopicAnswerAcceptedInCommunity|topic={{{topic|}}}|community=varCommunity|link=none}}|,|}}<!-- | ||
-->{{#arrayunique: varTheories}}<!-- remove duplicates and empty values | -->{{#arrayunique: varTheories}}<!-- remove duplicates and empty values | ||
− | -->{{#switch: {{#arraysize:varTheories}}<!-- check if the array exists | + | -->{{#switch: {{#arraysize: varTheories}}<!-- check if the array exists |
-->|0=<!-- | -->|0=<!-- | ||
--><!-- | --><!-- | ||
− | --><!-- No direct answers are found | + | --><!-- No direct answers are found |
+ | --><!-- | ||
+ | --><!-- Check if any of the subtopics have complete or partial accepted answers and copy them as partial answers to the topic | ||
+ | --><!-- | ||
+ | -->{{#ask:<!-- | ||
+ | -->[[SubObjectCategory::Current Answer]]<!-- | ||
+ | -->[[Community::varCommunity]]<!-- | ||
+ | -->[[Parent Topic::{{{topic|}}}]]<!-- | ||
+ | -->[[Answer Type::Complete||Partial]]<!-- | ||
+ | -->|?Topic<!-- | ||
+ | -->|?Original Topic<!-- | ||
+ | -->|?Community<!-- | ||
+ | -->|?Subfield<!-- | ||
+ | -->|?Topic Type<!-- | ||
+ | -->|?Theory<!-- | ||
+ | -->|?Formulation Text<!-- | ||
+ | -->|?Sorting Order<!-- | ||
+ | -->|headers=hide<!-- | ||
+ | -->|mainlabel=-<!-- | ||
+ | -->|link=none<!-- | ||
+ | -->|limit=10000<!-- | ||
+ | -->|named args=yes<!-- | ||
+ | -->|format=template<!-- | ||
+ | -->|template=SetTopicCurrentAnswer-partial<!-- | ||
+ | -->|userparam={{{topic|}}}<!-- | ||
+ | -->}}<!-- | ||
+ | --><!-- | ||
--><!-- | --><!-- | ||
− | -->{{#arraydefine: | + | -->{{#arraydefine: varSubtopicTheories<!-- |
-->|{{#ask:<!-- | -->|{{#ask:<!-- | ||
− | -->[[SubObjectCategory:: | + | -->[[SubObjectCategory::Current Answer]]<!-- |
-->[[Community::varCommunity]]<!-- | -->[[Community::varCommunity]]<!-- | ||
-->[[Parent Topic::{{{topic|}}}]]<!-- | -->[[Parent Topic::{{{topic|}}}]]<!-- | ||
-->[[Answer Type::Complete||Partial]]<!-- | -->[[Answer Type::Complete||Partial]]<!-- | ||
− | -->|?Theory<!-- | + | -->|?Theory<!-- |
-->|headers=hide<!-- | -->|headers=hide<!-- | ||
-->|mainlabel=-<!-- | -->|mainlabel=-<!-- | ||
-->|link=none<!-- | -->|link=none<!-- | ||
+ | -->|limit=10000<!-- | ||
-->}}<!-- | -->}}<!-- | ||
-->| , |unique<!-- | -->| , |unique<!-- | ||
Line 154: | Line 179: | ||
-->{{#arrayunique: varSubtopicsTheories}}<!-- remove duplicates | -->{{#arrayunique: varSubtopicsTheories}}<!-- remove duplicates | ||
--><!-- | --><!-- | ||
+ | |||
--><!-- Check if there are any theories in the array | --><!-- Check if there are any theories in the array | ||
--><!-- | --><!-- | ||
-->{{#switch: {{#arraysize: varSubtopicsTheories}}<!-- | -->{{#switch: {{#arraysize: varSubtopicsTheories}}<!-- | ||
− | -->|0= | + | |
+ | -->|0=<!-- | ||
+ | --><!-- Subtopics too don't have an accepted answer | ||
--><!-- | --><!-- | ||
− | --><!-- | + | --><!-- store an empty record |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
--><!-- | --><!-- | ||
-->{{#subobject:<!-- | -->{{#subobject:<!-- | ||
− | -->|SubObjectCategory= | + | -->|SubObjectCategory=Current Answer<!-- |
-->|Topic={{{topic|}}}<!-- | -->|Topic={{{topic|}}}<!-- | ||
+ | -->|Original Topic=<!-- | ||
-->|Parent Topic={{#arrayprint: arrayParentTopics|,}}|+sep=,<!-- | -->|Parent Topic={{#arrayprint: arrayParentTopics|,}}|+sep=,<!-- | ||
-->|Subfield={{{subfield|Dynamics}}}<!-- | -->|Subfield={{{subfield|Dynamics}}}<!-- | ||
Line 181: | Line 199: | ||
-->|Community=varCommunity<!-- | -->|Community=varCommunity<!-- | ||
-->|Theory=<!-- | -->|Theory=<!-- | ||
+ | -->|Formulation Text=<!-- | ||
-->|Answer Type=None<!-- | -->|Answer Type=None<!-- | ||
-->|Sorting Order=0<!-- | -->|Sorting Order=0<!-- | ||
-->}}<!-- subobject | -->}}<!-- subobject | ||
--><!-- | --><!-- | ||
+ | |||
-->|<!-- | -->|<!-- | ||
− | |||
--><!-- Subtopics have accepted answers | --><!-- Subtopics have accepted answers | ||
+ | -->{{#vardefine: varHasAnswer|yes}}<!-- | ||
--><!-- | --><!-- | ||
− | + | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
--><!-- | --><!-- | ||
--><!-- Set all the theories as partial answers accepted by the community | --><!-- Set all the theories as partial answers accepted by the community | ||
Line 209: | Line 217: | ||
--><!-- | --><!-- | ||
-->{{#set: Has Accepted Answer In {{PAGENAME:varCommunity}}=varSubtopicTheory}}<!-- | -->{{#set: Has Accepted Answer In {{PAGENAME:varCommunity}}=varSubtopicTheory}}<!-- | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
--><!-- | --><!-- | ||
-->}}<!-- arayprint varSubtopicsTheories | -->}}<!-- arayprint varSubtopicsTheories | ||
--><!-- | --><!-- | ||
− | -->}}<!-- switch | + | |
− | + | -->}}<!-- switch arraysize varSubtopicsTheories | |
--><!-- | --><!-- | ||
+ | |||
-->|<!-- | -->|<!-- | ||
+ | --><!-- the topic has direct answers | ||
--><!-- | --><!-- | ||
− | --><!-- | + | |
+ | --><!-- | ||
+ | -->{{#vardefine: varHasAnswer|no}}<!-- | ||
+ | |||
--><!-- | --><!-- | ||
− | -->{{# | + | --><!-- get the sorting order |
+ | -->{{#vardefine: varSortingOrder|{{#show: {{{topic|}}}|?Sorting Order|link=none}}|}}<!-- | ||
--><!-- | --><!-- | ||
− | --><!-- | + | --><!-- get the formulation text: this function combines the formulation texts of individual theories if necessary |
+ | -->{{#vardefine: varFormulationText|{{GetTopicCurrentAnswerFormulationText|topic={{{topic|}}}|community=varCommunity}}|}}<!-- | ||
--><!-- | --><!-- | ||
+ | --><!-- store a subobject for the answers | ||
-->{{#subobject:<!-- | -->{{#subobject:<!-- | ||
− | -->|SubObjectCategory= | + | -->|SubObjectCategory=Current Answer<!-- |
-->|Topic={{{topic|}}}<!-- | -->|Topic={{{topic|}}}<!-- | ||
+ | -->|Original Topic={{{topic|}}}<!-- | ||
-->|Parent Topic={{#arrayprint: arrayParentTopics|,}}|+sep=,<!-- | -->|Parent Topic={{#arrayprint: arrayParentTopics|,}}|+sep=,<!-- | ||
-->|Subfield={{{subfield|Dynamics}}}<!-- | -->|Subfield={{{subfield|Dynamics}}}<!-- | ||
-->|Topic Type={{#var: varTopicType}}<!-- | -->|Topic Type={{#var: varTopicType}}<!-- | ||
-->|Community=varCommunity<!-- | -->|Community=varCommunity<!-- | ||
+ | -->|Formulation Text={{#var: varFormulationText}}<!-- | ||
-->|Theory={{#arrayprint: varTheories|,}}|+sep=,<!-- | -->|Theory={{#arrayprint: varTheories|,}}|+sep=,<!-- | ||
-->|Answer Type=Complete<!-- | -->|Answer Type=Complete<!-- | ||
+ | -->|Sorting Order={{#var: varSortingOrder}}<!-- | ||
-->}}<!-- subobject | -->}}<!-- subobject | ||
--><!-- | --><!-- | ||
− | + | ||
− | + | --><!-- set all the theories as accepted by the community | |
− | |||
− | |||
-->{{#arrayprint: varTheories||varTheory<!-- | -->{{#arrayprint: varTheories||varTheory<!-- | ||
-->|<!-- | -->|<!-- | ||
--><!-- | --><!-- | ||
-->{{#set: Has Accepted Answer In {{PAGENAME:varCommunity}}=varTheory}}<!-- | -->{{#set: Has Accepted Answer In {{PAGENAME:varCommunity}}=varTheory}}<!-- | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
--><!-- | --><!-- | ||
-->}}<!-- arryprint varTheories | -->}}<!-- arryprint varTheories | ||
− | -->}}<!-- switch | + | -->}}<!-- switch arraysize varTheories |
− | -->}}<!-- array print | + | |
+ | --><!-- | ||
+ | --><!-- set Has Accepted Answer or Has No Accepted Answer | ||
+ | --><!-- | ||
+ | -->{{#ifeq: {{#var: varHasAnswer}}|yes<!-- | ||
+ | -->|<!-- | ||
+ | -->{{#set: Has Accepted Answer=varCommunity}}<!-- | ||
+ | --><!-- | ||
+ | -->|<!-- | ||
+ | -->{{#set: Has No Accepted Answer=varCommunity}}<!-- | ||
+ | --><!-- | ||
+ | -->}}<!-- ifeq | ||
+ | |||
+ | |||
+ | -->}}<!-- array print varCommunities | ||
--><!-- | --><!-- | ||
+ | |||
-->}}<!-- if topic | -->}}<!-- if topic | ||
--></includeonly> | --></includeonly> |
Latest revision as of 20:34, 24 February 2023
This template is used to save records on which communities have currently accepted answers to the question and the respective accepted answers. This includes:
- Complete answers: all the direct answers to the question;
- Inherited: all the answers to the superquestions (complete or inherited);
- Partial: all the answers to the qubquestions (complete or partial); this option is used only if there are no complete answers to the question.
For each community where the topic is currently accepted, the template searches for accepted theories, and if a theory is found, for each theory it creates a combined subobject with the following properties:
SubObjectCategory
= "Current Answer".Topic
- the question the theory is trying to answer.Topic Type
- the type of the topic for ease of access (Normative, Descriptive, Definitional)Parent Topic
- the topic's parent topic for ease of access. //What happens when there are multiple parent topics?Community
- the community that accepts the theory.Theory
- the full page name of the theories that answer the topic.Answer Type
- Complete for direct answers, Partial for answers to subquestions, and Inherited for answers to superquestions.Original Topic
- the original topic to which the theories were the answer to. For inherited answers, this will hold the fullpagename of the parent topic (superquestion). For partial answers gauged from the subquestions, this will hold the fullpagename of the child topic (subquestion). For direct answers, this will be equal to Topic.Sorting Order
- the Sorting Order of the topic; this is used to sort the accepted answers when displaying them.Formulation Text
- this is the combined formulation text of the answers to the original topic. If the original topic has a multiple answer formula, then the multiple answers will be combined here. Suppose the question Epistemic Stances Towards Theories has several accepted answers, such as:- The stance of theory acceptance can be taken towards theories.
- The stance of theory pursuit can be taken towards theories.
- The stance of theory use can be taken towards theories.
The value of Formulation Text
will be:
- The stances of theory acceptance, theory pursuit, and theory use can be taken towards theories.
If the original topic has no multiple answer formula, all the answers will be added one after another; since each formulation text is a full sentence, a space will be added as a separator.
If no theory is found that answers the question, its superquestions or its subquestions, an empty subobject is created:
Answer Type
= None.
NOTE: As any "set" template, it doesn't print anything on the page, but merely sets the appropriate values.
Parameters:
|topic=
- the full page name of the topic.|subfield=
- e.g. Ontology, Dynamics.