Difference between revisions of "Template:Concept Table grouped by Collection 2"

From TDWG Terms Wiki
Jump to: navigation, search
(Created page with "<noinclude> This template outputs a single term as a set of rows in a table (which must be opened and closed by an external template). The template parameters (as created by ...")
 
m (+technical documentation)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
This template outputs a single term as a set of rows in a table (which must be opened and closed by an external template).
+
{{Warning of heavily used semantic template}}
  
The template parameters (as created by ask in [[Template:Concept_Table_grouped_by_Collection_1]]) are:
+
This template outputs a single table row (&lt;tr>) that contains generic information about ''one term'' (any wrapping &lt;table> must be provided by an external template):
{{{1|}}} = ? #-
+
&lt;tr> ───────────┼────────
{{{2|}}} = ?terms-internal:enLabel #-
+
│ Concept name  │ ''term''
{{{3|}}} = ?terms-internal:enDefinition #-
+
┼───────────────┼────────
{{{4|}}} = ?terms-internal:enExample #-
+
│ Normative URI │ …
{{{5|}}} = ?terms-internal:enNote #-
+
┼───────────────┼───
{{{6|}}} = ?rdfs:isDefinedBy #-
+
│ Label        │ …
It uses variables
+
┼───────────────┼───
* constraintOfConcept (repeatable, required is saved in [[property: cardinality]] but is contained in subobject [[property: constraint of concept |constraint of concept]], which will ask for <nowiki>{{#ask [[constraint of concept::concept-page-name i.e. {{{1}}}]]}}</nowiki>)
+
│ Definition    │ …
 +
┼───────────────┼───
 +
│ Defined By    │ …
 +
┼───────────────┼───
 +
│              │ Required: No/Yes — Repeatable: Yes/No
 +
┼───────────────┼───
 +
│ Notes:        │ …
 +
┼───────────────┼───
 +
&lt;/tr>
 +
 
 +
== Technical Documentation ==
 +
 
 +
This template was used to render the summary of a concept term within #ask at query time, but later this functionality got shifted to save this generated table layout directly to a property via [[template: Concept]] to get quick #ask-inline query response times and limit the calls of templates during the Wiki rendering. To get a quick display [[property: terms-internal:summary (as table rows) of concept term]] is used like so:
 +
 
 +
<pre>{{#ask: [[Category:Concept]] [[vann:termGroup::§]] [[vann:termGroup::{{{1|Audubon Core Attribution Vocabulary}}}]]
 +
| ?terms-internal:summary (as table rows) of concept term =<!-- the property’s content is generated by template:Concept_Table_grouped_by_Collection_2 in template:Concept -->
 +
| link=none
 +
| mainlabel=-
 +
| sep=
 +
| limit={{{limit concepts|500}}}
 +
| searchlabel=<i>&#32;…&nbsp;further results and concept collection §</i>
 +
| sort=terms-internal:lowercasePagename
 +
| intro =<div style="font-weight:bold; font-size:105%; margin:1.5em 0 1em 0;">Concept definitions in [[§]]</div>
 +
<table cellspacing="0" cellpadding="2" border="0" style="border-top: 1px solid #CCC; border-left: 1px solid #CCC; margin-bottom:10px; width:100%;">
 +
| outro =</table>
 +
| default =
 +
}}</pre>
 +
 
 +
And [[property: terms-internal:summary (as table rows) of concept term]] is saved now by [[template: Concept]], i.e. for all concepts in this Wiki.
 +
 
 +
The older code took in more render time and has problems when there are a lot of concepts to query for:
 +
<pre>{{#ask: [[Category:Concept]] [[vann:termGroup::§]] [[vann:termGroup::{{{1|Audubon Core Attribution Vocabulary}}}]]
 +
| ? #-
 +
| ?terms-internal:enLabel #-
 +
| ?terms-internal:enDefinition #-
 +
| ?terms-internal:enExample #-
 +
| ?terms-internal:enNote #-
 +
| ?rdfs:isDefinedBy #-
 +
| ?dcterms:identifier #-
 +
| link=none
 +
| mainlabel=-
 +
| format=template
 +
| template=Concept_Table_grouped_by_Collection_2
 +
| limit={{{limit concepts|500}}}
 +
| searchlabel=<i>&#32;…&nbsp;see also further results in collection {{{1|Audubon Core Attribution Vocabulary}}}</i>
 +
| sort=terms-internal:lowercasePagename
 +
| intro =<div style="font-weight:bold; font-size:105%; margin:1.5em 0 1em 0;">Concept definitions in [[§]]</div>
 +
<table cellspacing="0" cellpadding="2" border="0" style="border-top: 1px solid #CCC; border-left: 1px solid #CCC; margin-bottom:10px; width:100%;">
 +
| outro =</table>
 +
| default =
 +
}}</pre>
 +
 
 +
 
 +
=== Dependencies ===
 +
 
 +
* [[mediawikiwiki: Extension:SemanticMediaWiki|Extension:SemanticMediaWiki]]
 +
** <code><nowiki>#ask</nowiki></code>
 +
* [[template: Concept]]
 +
** [[property: terms-internal:summary (as table rows) of concept term]] (contains content created by template {{PAGENAME}})
 +
* [[template: Concept Table grouped by Collection (AC1)]]
 +
* [[mediawikiwiki: Extension:Variables|Extension:Variables]]
 +
** it uses variable <code>constraintOfConcept</code> (repeatable, required is saved in [[property: cardinality]] but is contained in subobject [[property: constraint of concept |constraint of concept]], which will ask for <code><nowiki>{{#ask [[constraint of concept::concept-page-name i.e. {{{1}}}]]}}</nowiki></code>)
 +
* <s>[[template: Concept to imported URI]]</s>
 +
 
 +
=== TODO ===
 +
 
 +
* ✓ reduce template calls, e.g. <code><nowiki>{{Concept to imported URI}}</nowiki></code> --[[User:Andreas Plank|Andreas Plank]] ([[User talk:Andreas Plank|talk]]) 17:07, 23 January 2020 (CET)
 +
** ✓ check further optimisation, e.g. saving rendered table row on the concept level to an internal property ([[property: terms-internal:summary (as table rows) of concept term]]) --[[User:Andreas Plank|Andreas Plank]] ([[User talk:Andreas Plank|talk]]) 14:14, 27 January 2020 (CET)
 +
** ✓ refactoring also done for [[template: Concept Table grouped by Collection (AC1)]] --[[User:Andreas Plank|Andreas Plank]] ([[User talk:Andreas Plank|talk]]) 15:41, 28 January 2020 (CET)
  
 
[[Category: SMW ask template]]
 
[[Category: SMW ask template]]
Line 19: Line 87:
 
</tr><tr>
 
</tr><tr>
 
<td style="text-align:right;vertical-align:top;background:#EEE;border-right:1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">Normative URI</td>
 
<td style="text-align:right;vertical-align:top;background:#EEE;border-right:1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">Normative URI</td>
<td style="border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">{{Concept to imported URI|{{{1|{{{URI|}}}}}}}}</td>
+
<td style="border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">{{{7|{{{URI|}}}}}}</td>
 
</tr><tr>
 
</tr><tr>
 
<td style="text-align:right;vertical-align:top;background:#EEE;border-right:1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">Label</td>
 
<td style="text-align:right;vertical-align:top;background:#EEE;border-right:1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">Label</td>
Line 50: Line 118:
 
|<!--examples--><tr>
 
|<!--examples--><tr>
 
<td style="text-align:right;vertical-align:top;background:#EEE;border-right:1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">Examples</td>
 
<td style="text-align:right;vertical-align:top;background:#EEE;border-right:1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">Examples</td>
<td style="border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">{{{4|}}}</td></tr>  
+
<td style="border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">{{{4|enExample}}}</td></tr>  
 
}}{{
 
}}{{
 
#if: {{{5|}}}
 
#if: {{{5|}}}
 
|<!--notes--><tr>
 
|<!--notes--><tr>
 
<td style="text-align:right;vertical-align:top;background:#EEE;border-right:1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">Notes:</td>
 
<td style="text-align:right;vertical-align:top;background:#EEE;border-right:1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">Notes:</td>
<td style="border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">{{{5|}}}</td></tr>  
+
<td style="border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; padding:0.5em;">{{{5|enNote}}}</td></tr>  
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 16:41, 28 January 2020

This template outputs a single table row (<tr>) that contains generic information about one term (any wrapping <table> must be provided by an external template):

<tr> ───────────┼────────
│ Concept name  │ term
┼───────────────┼────────
│ Normative URI │ …
┼───────────────┼───
│ Label         │ …
┼───────────────┼───
│ Definition    │ …
┼───────────────┼───
│ Defined By    │ …
┼───────────────┼───
│               │ Required: No/Yes — Repeatable: Yes/No
┼───────────────┼───
│ Notes:        │ …
┼───────────────┼───
</tr>

Technical Documentation

This template was used to render the summary of a concept term within #ask at query time, but later this functionality got shifted to save this generated table layout directly to a property via template: Concept to get quick #ask-inline query response times and limit the calls of templates during the Wiki rendering. To get a quick display property: terms-internal:summary (as table rows) of concept term is used like so:

{{#ask: [[Category:Concept]] [[vann:termGroup::§]] [[vann:termGroup::{{{1|Audubon Core Attribution Vocabulary}}}]]
| ?terms-internal:summary (as table rows) of concept term =<!-- the property’s content is generated by template:Concept_Table_grouped_by_Collection_2 in template:Concept -->
| link=none
| mainlabel=-
| sep=
| limit={{{limit concepts|500}}}
| searchlabel=<i> … further results and concept collection §</i>
| sort=terms-internal:lowercasePagename
| intro =<div style="font-weight:bold; font-size:105%; margin:1.5em 0 1em 0;">Concept definitions in [[§]]</div>
<table cellspacing="0" cellpadding="2" border="0" style="border-top: 1px solid #CCC; border-left: 1px solid #CCC; margin-bottom:10px; width:100%;">
| outro =</table>
| default =
}}

And property: terms-internal:summary (as table rows) of concept term is saved now by template: Concept, i.e. for all concepts in this Wiki.

The older code took in more render time and has problems when there are a lot of concepts to query for:

{{#ask: [[Category:Concept]] [[vann:termGroup::§]] [[vann:termGroup::{{{1|Audubon Core Attribution Vocabulary}}}]]
| ? #-
| ?terms-internal:enLabel #-
| ?terms-internal:enDefinition #-
| ?terms-internal:enExample #-
| ?terms-internal:enNote #-
| ?rdfs:isDefinedBy #-
| ?dcterms:identifier #-
| link=none
| mainlabel=-
| format=template
| template=Concept_Table_grouped_by_Collection_2
| limit={{{limit concepts|500}}}
| searchlabel=<i> … see also further results in collection {{{1|Audubon Core Attribution Vocabulary}}}</i>
| sort=terms-internal:lowercasePagename
| intro =<div style="font-weight:bold; font-size:105%; margin:1.5em 0 1em 0;">Concept definitions in [[§]]</div>
<table cellspacing="0" cellpadding="2" border="0" style="border-top: 1px solid #CCC; border-left: 1px solid #CCC; margin-bottom:10px; width:100%;">
| outro =</table>
| default =
}}


Dependencies

TODO