Difference between revisions of "Template:Topic"

From Encyclopedia of Scientonomy
Jump to navigation Jump to search
Line 106: Line 106:
 
--><!--
 
--><!--
 
--><!--
 
--><!--
 
+
--><!-- set parent topic
 
+
-->{{#if: {{{Inherited From|}}}<!--
 
+
-->|<!--
 
+
  --><!-- Get the properties required to format the title from Inherited From
 
+
  -->{{#vardefine: varTitleFormula| {{#show: {{{Inherited From|}}}|?Question Title Formula|link=none}} }}<!--
 +
  -->{{#vardefine: varPredicate| {{#show: {{{Inherited From|}}}|?Predicate|link=none}} }}<!--
 +
  -->{{#vardefine: varObject| {{#show: {{{Inherited From|}}}|?Object Class|link=none}} }}<!--
 +
  --><!--
 +
  --><!-- get the inherited topic's subject
 +
  -->{{#vardefine: varInheritedSubject| {{#show: {{{Inherited From|}}}|?Subject|link=none}} }}<!--
 +
  --><!--
 +
  --><!-- Get the list of all the classes that the Subject of the Inherited From subsumes
 +
  -->{{#arraydefine: arraySubsumesTerms|{{#ask: [[-Subsumes items::{{#var: varInheritedSubject}}]]|link=none}} | , |unique}}<!--
 +
  --><!--
 +
  --><!-- Get the list of all the parent classes of the Subject of the question
 +
  -->{{#arraydefine: arrayParentTerms|{{GetPropertyValues|object={{{Subject|}}}|property=Parent Class|link=none}} | , |unique}}<!--
 +
  --><!--
 +
  --><!-- Get the intersection of the two arrays
 +
  -->{{#arrayintersect: arrayIntersectTerms|arraySubsumesTerms|arrayParentTerms|}}<!--
 +
  --><!--
 +
  --><!-- For each item in the intersection array, format the question page title according to the formula taken from Inherited From
 +
  -->{{#arrayprint: arrayIntersectTerms||varTerm<!--
 +
  -->|<!--
 +
    -->{{#vardefine: varTitle| {{DecodeTitleFormula|formula={{#var: varTitleFormula}}|subject=varTerm|predicate={{#var: varPredicate}}|object={{#var: varObject}}|}} }}<!--
 +
    --><!--
 +
    -->{{#set: Parent Topic={{#var: varTitle}}|}}<!--
 +
    --><!--
 +
  -->}}<!-- arrayprint
 +
  --><!--
 +
  --><!-- also construct an array with links or red links to be displayed at the bottom
 +
  -->{{#arraydefine: arrayParentPageLinks<!--
 +
  -->|{{#arrayprint: arrayIntersectTerms||varTerm<!--
 +
    -->|<!--
 +
      -->{{#vardefine: varTitle| {{DecodeTitleFormula|formula={{#var: varTitleFormula}}|subject=varTerm|predicate={{#var: varPredicate}}|object={{#var: varObject}}|}} }}<!--
 +
      --><!--
 +
      --><!-- check if the page exists
 +
      -->{{#ifexist:{{#var: varTitle}}<!--
 +
      -->|<!-- exist: add the link to the page
 +
        -->[[{{#var: varTitle}}]]<!--
 +
      -->|<!-- doesn't exist: add the formlink
 +
        -->{{#formlink:form=Topic|link text={{#var: varTitle}}|target={{#var: varTitle}}|query string=Topic[Subject]=varTerm&Topic[Inherited From]={{{Inherited From|}}}|}}<!--
 +
      -->}}<!-- if exists
 +
      --><!--
 +
    -->}}<!-- arrayprint
 +
  -->| , |unique<!--
 +
  -->}}<!-- arraydefine
 +
  --><!--
 +
-->|<!-- not inherited: still construct an empty array for the use below
 +
  -->{{#arraydefine: arrayParentPageLinks}}<!--
 +
  --><!--
 +
-->}}<!-- if inherited from
 +
--><!--
 
--><!--
 
--><!--
 
--><!--
 
--><!--
Line 253: Line 300:
 
}}
 
}}
 
==Related Topics==
 
==Related Topics==
 
+
<!-- construct the manual array
 +
-->{{#if: {{{Parent Topic|}}}<!--
 +
-->|<!-- add to the array
 +
  -->{{#arraydefine: arrayManual|[[{{{Parent Topic|}}}]]|}}<!--
 +
-->|<!-- define an empty array
 +
  -->{{#arraydefine: arrayManual}}<!--
 +
-->}}<!--
 +
--><!--
 +
--><!-- create the union of the manual and calculated arrays of parent topics
 +
-->{{#arrayunion: arrayMerged|arrayManual|arrayParentPageLinks}}<!--
 +
--><!--
 +
-->{{#switch: {{#arraysize: arrayMerged}}<!-- 
 +
-->|0=<!-- nothing to do
 +
-->|<!-- print
 +
  -->This question is a subquestion of&#32;<!--
 +
  -->{{#arrayprint: arrayMerged||@@@@|@@@@|print=pretty}}<!--
 +
  -->.<!--
 +
-->}}<!--
 +
-->
 
{{PrintTopicSubtopics
 
{{PrintTopicSubtopics
 
  |topic={{FULLPAGENAME}}  
 
  |topic={{FULLPAGENAME}}  

Revision as of 17:52, 22 January 2023

This is the template for all types of Non-Definitional Topics (Descriptive, Normative). This template is to be used for all topics/questions the answers to which are descriptions or prescriptions (it is used by Form:Topic).

It should be called in the following format:

{{Topic
 |Subject= //For first order questions, the subject must be a term registered in the encyclopedia. For higher order questions, the subject can be any lower level non-definitional theory question or theory.
 |Topic Type= {Descriptive, Normative}
 |Subfield= {Ontology, Dynamics, etc.}
 |Heritable= {Yes, No}
 |Inherited From= //the question that this question is inherited from
 |Question Text Formula= //For heritable questions only.
 |Question Title Formula= //For heritable questions only.
 |Question Title= //Ignored for heritable questions.
 |Question= //For non heritable questions only. For heritable questions, this is available to the editors only to use in cases when the text produced by the formula should be overridden. 
 |Predicate= //Some text or a term registered in the encyclopedia
 |Object Type= {Boolean, Class, Enumeration, Regular Expression, Text}
 |Object Value True= //optional. Used only if Object Type=Boolean
 |Object Value False= //optional. Used only if Object Type=Boolean
 |Object Class= //optional. Used only if Object Type=Class
 |Object Enum Values= //optional. Used only if Object Type=Enumeration
 |Object Regexp= //optional. Used only if Object Type=Regexp
 |Single Answer Text Formula=
 |Multiple Answers Text Formula=
 |Answer Title Formula=
 |Description=
 |Authors List=
 |Formulated Year=
 |Academic Events=
 |Prehistory=
 |History=
 |Current View=
 |Parent Topic= //This will be deprecated. It will be calculated automatically in an agent-relative way following the current inheritance hierarchy of that agent. For now it is allowed as a backdoor so that it can be assigned manually.
 |Related Topics= //This will be deprecated. It will be calculated automatically in an agent-relative way following the current inheritance hierarchy of that agent.
 |Page Status=
 |Editor Notes=
}}

Edit the page to see the template text.