Changes

Jump to navigation Jump to search
no edit summary
This template is called from topic templates to save records of which communities have currently accepted answers to the question and the respective accepted answers. This includes:
* Complete Direct answers: all the direct answers to the question(complete or partial);* InheritedSuperanswers: all the answers to the superquestions (complete or inheritedpartial);* PartialSubanswers: all the answers to the qubquestions subquestions (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>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>Answer TypeDirectness</nowiki></code> - Complete Possible values are {Direct, Superanswer, Subanswer, None}. ''None'' is used for direct empty answers. * <code><nowiki>Completeness</nowiki></code> - Possible values are {Complete, Partial for answers to subquestions, and Inherited None}. ''None'' is used for empty answers to superquestions.* <code><nowiki>Original Topic</nowiki></code> - the original topic to which the theories were the is a ''direct'' answer to. For inherited ''superanswers'' answers, this will hold the fullpagename of the parent topic (superquestion). Note that this won't be the grandparent topic even if the answer was a direct answer to a grandfather question. For partial answers gauged from the subquestions''subanswers'', 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>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 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 anotherin one record; 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 createdwith:* <code><nowiki>Answer TypeCompleteness</nowiki></code> = None.* <code><nowiki>Directness</nowiki></code> = None.
The following algorithm is used to decide which superanswers and subanswers to count and create subobjects for:
 
[[File:Counting Superanswers Subanswers Activity Diagram 2024.png|850px]]
 
There are three main scenarios, visualized in the following diagram:
 
[[File:Counting Superanswers Subanswers Chart 2024.png|1000px]]
'''NOTE:''' As any "set" template, it doesn't print anything on the page, but merely sets the appropriate values.
-->{{#if: {{{topic|}}}<!--
-->|<!--
--><!-- get the topic info -->{{#vardefine: varTopicType|{{#show: {{{topic|}}}|?Topic Type|link=none}}|}}<!-- -->{{#vardefine: varSortingOrder|{{#show: {{{topic|}}}|?Sorting Order|link=none}}|}}<!--
-->{{#arraydefine: arrayParentTopics|{{#show: {{{topic|}}}|?Parent Topic|link=none}}|,|}}<!--
-->{{#arrayunique: arrayParentTopics}}<!-- remove duplicates and empty values
-->{{#arraydefine: varCommunities|{{PrintTopicCurrentlyAcceptedInCommunitiesList|topic={{{topic|}}}|link=none}}|,|}}<!--
-->{{#arrayunique: varCommunities}}<!-- remove duplicates and empty values
 
--><!--
--><!-- Repeat the following cycle for each community where the topic is accepted
--><!--
-->{{#arrayprint: varCommunities||varCommunity|<!--
--><!--
--><!-- STEP 0: Reset the Has Answer flag and Completeness on each cycle
--><!--
-->{{#vardefine: varHasAnswer|no}}<!--
-->{{#vardefine: varCompleteness|None}}<!--
--><!--
--><!--
--><!-- The complete answers to parent questions must be added as STEP 1: Search for direct answers to the question regardless of whether accepted by the question has community and see if any direct of them are complete answers
--><!--
-->{{#arrayprintarraydefine: arrayParentTopicsvarTheories||varParentTopic|<!-- --><!-- --><!-- 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::CompletePrintTopicAnswerAcceptedInCommunity||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<!-- -->|userparamtopic={{{topic|}}}<!-- -->}}<!-- --><!-- -->{{#arraydefine: varParentTheories<!-- -->|{{#ask:<!-- -->[[SubObjectCategory::Current Answer]]<!-- -->[[Community::community=varCommunity]]<!-- -->[[Topic::varParentTopic]]<!-- -->[[Answer Type::Complete||Inherited]]<!-- -->|?Theory<!-- -->|headers=hide<!-- -->|mainlabel=-<!-- -->|link=none<!-- -->|limit=10000<!-- -->}}<!-- -->| , |unique}}<!-- -->{{#arrayunique: varTheories}}<!-- array defineremove duplicates and empty values --><!-- -->{{#arrayunique: varParentTheories}}<!-- remove duplicates --><!--STEP 2: Store all the direct answers, if any --><!-- check if there are any results -->{{#ifeq: {{#arraysize: varParentTheoriesvarTheories}}|0||<!--check if there are currently accepted direct answers  -->|<!-- --><!-- no 2.1. the topic has direct answers found: nothing todoset the flag -->|<!-- --><!-- the topic has answers -->{{#vardefine: varHasAnswer|yes}}<!-- --><!-- --><!-- set all 2.2. get the Formulation Text: this function combines the formulation texts of individual theories as accepted by the community if necessary -->{{#arrayprint: varParentTheories||varTheory<!-- -->|<!-- -->{{#setvardefine: Has Accepted Answer In varFormulationText|{{PAGENAME:varCommunityGetTopicCurrentAnswerFormulationText|topic={{{topic|}}}|community=varTheoryvarCommunity}}<!-- --><!-- -->|}}<!-- arrayprint varParentTheories --><!-- -->}}<!-- ifeq
--><!-- --><!-- 2.3 get the Completeness; if at least one of the accepted answers is a complete answer, then this should say Complete; --><!-- otherwise it should say Partial --><!-- -->{{#vardefine: varCompleteness|Partial}}<!-- --><!-- -->{{#arrayprint: varTheories||varTheory|<!-- --><!-- -->{{#ifeq: {{#show: varTheory|?Completeness|link=none}}|Complete|<!-- --><!-- -->{{#vardefine: varCompleteness|Complete}}<!-- --><!-- -->}}<!-- ifeq -->}}<!-- arrayprint arrayParentTopicsvarTheories --><!--
--><!-- --><!-- Now search 2.4. store one combined Current Answer subobject for all direct answers to ; this simplifies the questionretrieval of the current answer info --><!-- -->{{#arraydefinesubobject: varTheories<!-- -->|SubObjectCategory=Current Answer<!-- -->|Topic={{PrintTopicAnswerAcceptedInCommunity{topic|}}}<!-- -->|topicOriginal Topic={{{topic|}}}<!-- -->|Parent Topic={{#arrayprint: arrayParentTopics|,}}|+sep=,<!-- -->|communitySubfield=varCommunity{{{subfield|Dynamics}}}<!-- -->|linkTopic Type=none{{#var: varTopicType}}<!-- -->|,Community=varCommunity<!-- -->|Formulation Text={{#var: varFormulationText}}<!-- -->|Theory={{#arrayuniquearrayprint: varTheories|,}}|+sep=,<!-- -->|Directness=Direct<!-- remove duplicates and empty values -->|Completeness={{#switchvar: varCompleteness}}<!-- -->|Sorting Order={{#arraysizevar: varTheoriesvarSortingOrder}}<!-- -->}}<!-- check if the array existssubobject --><!--
-->|0=<!--
--><!--
--><!-- No direct answers are found 2.5. set all the theories as accepted by the community --><!-- These silly looking records come in handy when quickly retrieving whether the theory is accepted in a given community
--><!--
-->{{#arrayprint: varTheories||varTheory<!-- -->|<!-- --><!-- -->{{#set: Has Accepted Answer In {{PAGENAME:varCommunity}}=varTheory}}<!-- --><!-- -->}}<!-- arrayprint varTheories  -->}}<!-- ifeq - if there are currently accepted direct answers   --><!-- --><!-- STEP 3: If there are no direct answers then add all the subanswers --><!-- -->{{#ifeq: {{#arraysize: varTheories}}|0|<!-- --><!-- --><!-- 3.1. Check if any of the subtopics have complete direct answers or partial accepted answers subanswers of their own and copy them as partial answers to the topic --><!-- The template SetTopicCurrentAnswer-subanswer does the actual creation of the subobjects
--><!--
-->{{#ask:<!--
-->[[Community::varCommunity]]<!--
-->[[Parent Topic::{{{topic|}}}]]<!--
-->[[Answer TypeDirectness::CompleteDirect||PartialSubanswer]]<!--
-->|?Topic<!--
-->|?Original Topic<!--
-->|named args=yes<!--
-->|format=template<!--
-->|template=SetTopicCurrentAnswer-partialsubanswer<!--
-->|userparam={{{topic|}}}<!--
-->}}<!--
--><!--
 
--><!--
--><!-- 3.2. Now get the array of these answers; this is required so that we know if there are any.
--><!-- The previous operation doesn't tell us if there are any.
--><!--
-->{{#arraydefine: varSubtopicsTheories<!--
-->[[Community::varCommunity]]<!--
-->[[Parent Topic::{{{topic|}}}]]<!--
-->[[Answer TypeDirectness::CompleteDirect||PartialSubanswer]]<!--
-->|?Theory<!--
-->|headers=hide<!--
--><!--
--><!-- Check if there are any theories in the array
--><!--
-->{{#switch: {{#arraysize: varSubtopicsTheories}}<!--3.3. Check if there are any theories in the array   -->|0=<!-- --><!-- Subtopics too don't have an accepted answer -->{{#ifeq: {{#arraysize: varSubtopicsTheories}}|0||<!--
--><!-- store an empty record
--><!--
-->{{#subobject:<!--
-->|SubObjectCategory=Current Answer<!--
-->|Topic={{{topic|}}}<!--
-->|Original Topic=<!--
-->|Parent Topic={{#arrayprint: arrayParentTopics|,}}|+sep=,<!--
-->|Subfield={{{subfield|Dynamics}}}<!--
-->|Topic Type={{#var: varTopicType}}<!--
-->|Community=varCommunity<!--
-->|Theory=<!--
-->|Formulation Text=<!--
-->|Answer Type=None<!--
-->|Sorting Order=0<!--
-->}}<!-- subobject
--><!--
  -->|<!-- --><!-- Subtopics have accepted answers : set the Has Answer flag
-->{{#vardefine: varHasAnswer|yes}}<!--
--><!--
--><!--
-->}}<!-- switch ifeq arraysize varSubtopicsTheories
--><!--
-->}}<!-- ifeq - if there are no direct answers
 
 
--><!--
--><!-- STEP 4: If there are no direct answers, or if none of the direct answers is a complete answer, then store the superanswers
--><!--
-->{{#ifeq: {{#var: varCompleteness}}|None|<!--
 
--><!--
-->{{#arrayprint: arrayParentTopics||varParentTopic|<!--
 
--><!--
--><!-- 4.1. Check if the parent topic has accepted theories: these can be direct answers or superanswers.
--><!-- Copy these as superanswers to the question: template SetTopicCurrentAnswer-superanswer does the honors
--><!--
-->{{#ask:<!--
-->[[SubObjectCategory::Current Answer]]<!--
-->[[Community::varCommunity]]<!--
-->[[Topic::varParentTopic]]<!--
-->[[Directness::Direct||Superanswer]]<!--
-->|?Topic<!--
-->|?Original Topic<!--
-->|?Community<!--
-->|?Subfield<!--
-->|?Topic Type<!--
-->|?Theory<!--
-->|?Formulation Text<!--
-->|?Completeness<!--
-->|?Sorting Order<!--
-->|headers=hide<!--
-->|mainlabel=-<!--
-->|link=none<!--
-->|limit=10000<!--
-->|named args=yes<!--
-->|format=template<!--
-->|template=SetTopicCurrentAnswer-superanswer<!--
-->|userparam={{{topic|}}}<!--
-->}}<!--
--><!--
--><!-- 4.2. Now get the array of superanswers. These are needed to know if there were any superanswers.
--><!-- The previous operation doesn't get this info.
--><!--
-->{{#arraydefine: varParentTheories<!--
-->|{{#ask:<!--
-->[[SubObjectCategory::Current Answer]]<!--
-->[[Community::varCommunity]]<!--
-->[[Topic::varParentTopic]]<!--
-->[[Directness::Direct||Superanswer]]<!--
-->|?Theory<!--
-->|headers=hide<!--
-->|mainlabel=-<!--
-->|link=none<!--
-->|limit=10000<!--
-->}}<!--
-->| , |unique<!--
-->}}<!-- array define
--><!--
-->{{#arrayunique: varParentTheories}}<!-- remove duplicates
--><!--
--><!-- check if there are any superanswers
--><!--
-->{{#ifeq: {{#arraysize: varParentTheories}}|0||<!--
--><!--
--><!-- There are superanswers: set the Has Answer flag
--><!--
-->{{#vardefine: varHasAnswer|yes}}<!--
--><!--
--><!-- set all the theories as accepted by the community for ease of access
--><!--
-->{{#arrayprint: varParentTheories||varTheory<!--
-->|<!--
-->{{#set: Has Accepted Answer In {{PAGENAME:varCommunity}}=varTheory}}<!--
--><!--
-->}}<!-- arrayprint varParentTheories
--><!--
 
-->}}<!-- ifeq - if there are superanswers
 
-->}}<!-- arrayprint arrayParentTopics
 
-->}}<!-- ifeq - if there are no complete answers
  --><!-- -->|<!--STEP 5: If no answers were found, add an empty record. --><!-- Such records are handy when building tables with all the current topics and their answers; --><!-- these show that a topic has direct answersdoesn't have an answer with an empty cell. --><!-- -->{{#ifeq: {{#var: varHasAnswer}}|no<!--  -->|<!--  
--><!--
--><!-- Store the Has No Accepted Answer record for the ease of use
--><!--
-->{{#vardefineset: varHasAnswer|noHas No Accepted Answer=varCommunity}}<!--
--><!--
--><!-- 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 an empty record
--><!--
--><!-- store a subobject for the answers
-->{{#subobject:<!--
-->|SubObjectCategory=Current Answer<!--
-->|Topic={{{topic|}}}<!--
-->|Original Topic={{{topic|}}}<!--
-->|Parent Topic={{#arrayprint: arrayParentTopics|,}}|+sep=,<!--
-->|Subfield={{{subfield|Dynamics}}}<!--
-->|Topic Type={{#var: varTopicType}}<!--
-->|Community=varCommunity<!--
-->|Theory=<!-- -->|Formulation Text={{#var: varFormulationText}}<!-- -->|Theory={{#arrayprint: varTheories|,}}|+sepCompleteness=,None<!-- -->|Answer TypeDirectness=CompleteNone<!--
-->|Sorting Order={{#var: varSortingOrder}}<!--
-->}}<!-- subobject
--><!--
--><!-- set all the theories as accepted by the community
-->{{#arrayprint: varTheories||varTheory<!--
-->|<!--
--><!--
-->{{#set: Has Accepted Answer In {{PAGENAME:varCommunity}}=varTheory}}<!--
--><!--
-->}}<!-- arryprint varTheories
-->}}<!-- switch arraysize varTheories
--><!--
--><!-- set Has Accepted Answer or Has No Accepted Answer
--><!--
-->{{#ifeq: {{#var: varHasAnswer}}|yes<!--
-->|<!--
 
--><!--
--><!-- Store the Has Accepted Answer record for the ease of use
--><!--
-->{{#set: Has Accepted Answer=varCommunity}}<!--
--><!--
-->|<!-- -->{{#set: Has No Accepted Answer=varCommunity}}<!-- --><!-- -->}}<!-- ifeq - if there are no answers
-->}}<!-- array print varCommunities
--><!--
-->}}<!-- if topic
--></includeonly>

Navigation menu