Difference between revisions of "Template:SetTermInheritanceHierarchy"

From Encyclopedia of Scientonomy
Jump to navigation Jump to search
(Created page with "<noinclude> This template is used to save the currently accepted associations claims (aggregation, composition, etc.) of the given class. The template creates a hierarchy of...")
 
Line 6: Line 6:
 
* <code><nowiki>Descendant items</nowiki></code> - A list that includes the page's subclasses, the subclasses of subclasses etc., but not itself. This data can be used to check if a given class is a subtype (sub, subtype, etc.) of another class but not itself.
 
* <code><nowiki>Descendant items</nowiki></code> - A list that includes the page's subclasses, the subclasses of subclasses etc., but not itself. This data can be used to check if a given class is a subtype (sub, subtype, etc.) of another class but not itself.
 
* <code><nowiki>Ancestor items</nowiki></code> - A list that includes the page's superclasses, the superclasses of superclasses etc., but not itself.  
 
* <code><nowiki>Ancestor items</nowiki></code> - A list that includes the page's superclasses, the superclasses of superclasses etc., but not itself.  
 +
 +
In addition, it creates the following multivalued properties (lists):
 +
* <code><nowiki>Parent Topic</nowiki></code> - The list of immediate parent terms (no grandparents).
 +
* <code><nowiki>Child Topic</nowiki></code> - The list of immediate child terms (no grandchildren).
 +
  
 
'''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.
Line 31: Line 36:
 
   -->{{#arrayprint:varParentsArray||@@@@|{{#set:Parent Topic=@@@@}}|}}<!--  
 
   -->{{#arrayprint:varParentsArray||@@@@|{{#set:Parent Topic=@@@@}}|}}<!--  
 
   --><!--
 
   --><!--
 +
  --><!-- set the inheritance hierarchy
 +
  -->{{#set:Subsumes items={{{term|}}}}}<!--
 +
  -->{{#arraydefine:varSubsumeArray|{{#ask: [[-Subsumes items::<q>[[Parent Topic::{{{term|}}}]]</q>]]|headers=hide|link=none}}|,|}}<!--
 +
  -->{{#arrayunique:varSubsumeArray}}<!--
 +
  -->{{#arrayprint:varSubsumeArray||@@@@|{{#set:Subsumes items=@@@@|Descendant items=@@@@}}|}}<!--
 +
  --><!--
 +
  --><!-- have to do it again to include the subsumed elements of the subsumed elements
 +
  -->{{#arraydefine:varSubsumeArray|{{#ask: [[-Subsumes items::<q>[[Parent Topic::{{{term|}}}]]</q>]]|headers=hide|link=none}}|,|}}<!--
 +
  -->{{#arrayunique:varSubsumeArray}}<!--
 +
  -->{{#arrayprint:varSubsumeArray||@@@@|{{#set:Subsumes items=@@@@|Descendant items=@@@@}}|}}<!--
 +
  --><!--
 
   --><!-- set the children
 
   --><!-- set the children
 
   -->{{#arraydefine:varChildrenArray<!--
 
   -->{{#arraydefine:varChildrenArray<!--
Line 48: Line 64:
 
   --><!--  
 
   --><!--  
 
   --><!-- set the inheritance hierarchy
 
   --><!-- set the inheritance hierarchy
  -->{{#set:Subsumes items={{{term|}}}}}<!--
+
   -->{{#arraydefine:varSubsumeArray|{{#ask: [[-Ancestor items::<q>[[Child Topic::{{{term|}}}]]</q>]]|headers=hide|link=none}}|,|}}<!--
   -->{{#arraydefine:varSubsumeArray|{{#ask: [[-Subsumes items::<q>[[Parent Topic::{{{term|}}}]]</q>]]|headers=hide|link=none}}|,|}}<!--
 
 
   -->{{#arrayunique:varSubsumeArray}}<!--
 
   -->{{#arrayunique:varSubsumeArray}}<!--
   -->{{#arrayprint:varSubsumeArray||@@@@|{{#set:Subsumes items=@@@@|Descendant items=@@@@}}|}}<!--  
+
   -->{{#arrayprint:varSubsumeArray||@@@@|{{#set:Ancestor items=@@@@}}|}}<!--  
 
   --><!--
 
   --><!--
 
   --><!-- have to do it again to include the subsumed elements of the subsumed elements
 
   --><!-- have to do it again to include the subsumed elements of the subsumed elements
   -->{{#arraydefine:varSubsumeArray|{{#ask: [[-Subsumes items::<q>[[Parent Topic::{{{term|}}}]]</q>]]|headers=hide|link=none}}|,|}}<!--
+
   -->{{#arraydefine:varSubsumeArray|{{#ask: [[-Ancestor items::<q>[[ChildTopic::{{{term|}}}]]</q>]]|headers=hide|link=none}}|,|}}<!--
 
   -->{{#arrayunique:varSubsumeArray}}<!--
 
   -->{{#arrayunique:varSubsumeArray}}<!--
   -->{{#arrayprint:varSubsumeArray||@@@@|{{#set:Subsumes items=@@@@|Descendant items=@@@@}}|}}<!--  
+
   -->{{#arrayprint:varSubsumeArray||@@@@|{{#set:Ancestor items=@@@@}}|}}<!--
 +
  --><!--  
 
   --><!--  
 
   --><!--  
 
-->}}<!-- if term
 
-->}}<!-- if term
 
--></includeonly>
 
--></includeonly>

Revision as of 18:44, 12 January 2023

This template is used to save the currently accepted associations claims (aggregation, composition, etc.) of the given class.

The template creates a hierarchy of classes for the given term by adding the following lists for ease of access:

  • Subsumed items - A list that includes the page itself as well as all of its subclasses, the subclasses of subclasses etc. This is similar to MediWiki's notion of Category where a category includes all of its subcategories as well as itself.
  • Descendant items - A list that includes the page's subclasses, the subclasses of subclasses etc., but not itself. This data can be used to check if a given class is a subtype (sub, subtype, etc.) of another class but not itself.
  • Ancestor items - A list that includes the page's superclasses, the superclasses of superclasses etc., but not itself.

In addition, it creates the following multivalued properties (lists):

  • Parent Topic - The list of immediate parent terms (no grandparents).
  • Child Topic - The list of immediate child terms (no grandchildren).


NOTE: As any "set" template, it doesn't print anything on the page, but merely sets the appropriate values.

Parameters:

  • |term= - the term page.