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

From TDWG Terms Wiki
Jump to: navigation, search
(Created page with "<noinclude>This template is a generic modification of Template:Concept Table grouped by Collection (AC1) == Technical Documentation == === Dependencies === * [[template:s...")
 
m (+documentation)
 
(20 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>This template is a generic modification of [[Template:Concept Table grouped by Collection (AC1)]]
+
<noinclude>This template displays definitions of terms in a table layout grouped by concept collections. It can be and is usually invoked by a previous #ask query.
  
 
== Technical Documentation ==
 
== Technical Documentation ==
=== Dependencies ===
 
* [[template:smwAsk InternalAnchorRef]] (used by #ask)
 
* {{lcfirst: {{FULLPAGENAME}}}} uses #ask and gives results to:
 
** [[template:Concept_Table_grouped_by_Collection_2]] (used by #ask of this template)<br/>As a userparam, a comma-sep. list of second level collections is passed. Since these are normal collections, these are also the result of the ask query calling this template (i.e. passed as parameter {{{1}}} to the current template). However, if they are in {{{1}}}, they themselves are excluded from being shown (no output). Otherwise, if {{{1}}} is a different collection, they are passed to the next level template, with the purpose of adding a second level grouping. ''Example:'' userparam = Audubon Core Layer 1, Audubon Core Layer 2<br/> '''Passed parameters to this template''' are (plain text and unlinked):
 
**# pagename of concept
 
**# [[property: terms-internal:enLabel |terms-internal:enLabel]]
 
**# [[property: terms-internal:enDefinition |terms-internal:enDefinition]]
 
**# [[property: terms-internal:enExample |terms-internal:enExample]]
 
**# [[property: terms-internal:enNote |terms-internal:enNote]]
 
**# [[property: rdfs:isDefinedBy |rdfs:isDefinedBy]]<br/> not passed but #ask-ed for in this subsequent template is subobject [[property: constraint of concept |constraint of concept]] which holds: [[property: property domain |property domain]], [[property: property range |property range]], [[property: cardinality |cardinality]])
 
  
[[Category: SMW ask template]]
+
=== Parameters ===
  
 +
'''Bold parameters''' are mandatory, all other are optional:
 +
{| class="wikitable sortable"
 +
|-
 +
! Parameter !! Comment, Example !! Property
 +
|-
 +
|
 +
'''<nowiki>|1=</nowiki>'''
 +
|
 +
* a concept collection, e.g. <code>Audubon Core Attribution Vocabulary</code>
 +
|
 +
* see [[property: vann:termGroup]]
 +
|-
 +
|
 +
<nowiki>|limit concepts=</nowiki>
 +
|
 +
* the limit of concepts to display for each collection
 +
* default: <code>500</code>
 +
|
 +
|}
  
'''Example defaults still from Aud.Core code, might need review/correction!'''
+
Note: that parameter 1 can also be provided by an #ask query wrapping this template ([[#use case 2|see use case 2]]).
  
<big>'''Example below: [[Audubon Core Attribution Vocabulary]]'''</big>
 
  
</noinclude>{{#if:{{#pos:{{{userparam}}},|{{{1}}},}}
+
=== Example/Usage ===
|<!--THEN nothing, suppress output where the current collection is in the list of second level groupings (#pos returns empty if not found)-->
+
 
|<!--ELSE output--><h2>{{{1|Audubon Core Attribution Vocabulary}}}</h2>
+
Use cases can be:
 +
# to [[#use case 1|query just one collection]]
 +
# to [[#use case 2|query multiple concept collections]]
 +
 
 +
====  Use case 1 (to query just one collection){{Anchor|use case 1}} ====
 +
{{FULLPAGENAME}}
 +
  └─ #ask (for concepts within the given collection)
 +
    └─ display table layout via [[property: terms-internal:summary (as table rows) of concept term]]
 +
        (generated table layout of [[template: Concept Table grouped by Collection 2]])
 +
 
 +
If you want to display concepts of ''just one'' collection (use case 1) use it as follows (here limited to just 2 concepts for this example):
 +
<nowiki>{{</nowiki>{{PAGENAME}}|Audubon Core Attribution Vocabulary|limit concepts=2}}
 +
… wich results in
 +
{{Concept Table grouped by Collection 1|Audubon Core Attribution Vocabulary|limit concepts=2}}  
 +
 
 +
 
 +
 
 +
----
 +
 
 +
==== Use case 2 (to query multiple concept collections){{Anchor|use case 2}} ====
 +
 
 +
#ask (for multiple concept collections)
 +
  └─ {{FULLPAGENAME}}
 +
    └─ #ask (for concepts within previous results of concept collections)
 +
        └─ display table layout via [[property: terms-internal:summary (as table rows) of concept term]]
 +
          (generated table layout of [[template: Concept Table grouped by Collection 2]])
 +
 
 +
If you want to query for multiple concept collections (usecase 2: here all collections in scheme [[GGBN Data Standard]]) you can use it with an <code>#ask</code>-query as follows:
 +
<nowiki>{{</nowiki>#ask: <nowiki>[[</nowiki>Category:Concept collection]] <nowiki>[[</nowiki>skos:inScheme::GGBN Data Standard]]
 +
| ? #-
 +
| link=none
 +
| mainlabel=-
 +
| format=template
 +
| template=Concept Table grouped by Collection 1
 +
| searchlabel=&lt;i>&amp;#32;…&amp;nbsp;see also further results and collections&lt;/i>
 +
| limit=20
 +
}}
 +
 
 +
Note that the <code>#ask</code>-parameter <code><nowiki>|limit=20</nowiki></code> may be crucial here: 
 +
* depending on the size of the concept scheme this means it queries for 20 collections and within each, all (up to <code><nowiki>|limit concepts=500</nowiki></code>) concepts
 +
* if there are more results, then at the bottom a link will appear to see further results
 +
* if the concept collection is too large (over 1000 concepts) this template may not be able to show all concepts and you can get a warning like:
 +
<blockquote style="color:red">{{int:Post-expand-template-inclusion-warning}}</blockquote>
 +
 
 +
Pages that have too much template calls can be found in this maintenance [[:category: Pages where template include size is exceeded]].
 +
 
 +
Technically this template relies on values generated by [[template: Concept Table grouped by Collection 2]] via [[template: Concept]]. This approach ensures to get a quick display response time in Semantic MediaWiki to just display cached content and not to render the content during the #ask-inline query. [[Template: Concept Table grouped by Collection 2]] also produces the actual table layout. On a concept page it sets some thing like:
 +
 
 +
<pre>
 +
{{#set: terms-internal:summary (as table rows) of concept term={{#ask: [[{{PAGENAME}}]]
 +
|format=template
 +
|template=Concept Table grouped by Collection 2
 +
|mainlabel=-
 +
|? #-                              <!-- page name -->
 +
|?terms-internal:enLabel #-        <!-- english label -->
 +
|?terms-internal:enDefinition #-  <!-- english definition -->
 +
|?terms-internal:enExample #-      <!-- english example -->
 +
|?terms-internal:enNote #-        <!-- english notes -->
 +
|?rdfs:isDefinedBy #-              <!-- the is definded by -->
 +
|?dcterms:identifier #-            <!-- the URI -->
 +
}}
 +
}}
 +
</pre>
 +
 +
 
 +
=== Dependencies ===
 +
 
 +
* [[template: Concept]]
 +
* <s>[[template:smwAsk InternalAnchorRef]] (used by #ask)</s>
 +
* [[template:Concept Table grouped by Collection 2]] (used by #ask in [[template: Concept]])
 +
** [[property: terms-internal:summary (as table rows) of concept term]]
 +
** [[property: terms-internal:enLabel]]
 +
** [[property: terms-internal:enDefinition]]
 +
** [[property: terms-internal:enExample]]
 +
** [[property: terms-internal:enNote]]
 +
** [[property: rdfs:isDefinedBy]]<br/> not passed but #ask-ed for in this subsequent template is subobject [[property: constraint of concept]] which holds: [[property: property domain]], [[property: property range]], [[property: cardinality]])
 +
** [[property: dcterms:identifier]] (for the URI)
 +
 
 +
 
 +
[[Category: SMW ask template]]
 +
</noinclude>{{#if:{{{1|}}}<!--
 +
THEN-->|<h3>{{{1|Audubon Core Attribution Vocabulary}}}</h3>
  
 
{{#ifexpr: {{#ask: [[Category:Concept]] [[vann:termGroup::{{{1|Audubon Core Attribution Vocabulary}}}]] | format=count}}<!-- 0 → false, greater 0 → true
 
{{#ifexpr: {{#ask: [[Category:Concept]] [[vann:termGroup::{{{1|Audubon Core Attribution Vocabulary}}}]] | format=count}}<!-- 0 → false, greater 0 → true
 
then-->|<div style="margin:1em 0 1em 0;"><div style="font-weight:bold; font-size:100%">Index to [[{{{1|Audubon Core Attribution Vocabulary}}}]]</div>
 
then-->|<div style="margin:1em 0 1em 0;"><div style="font-weight:bold; font-size:100%">Index to [[{{{1|Audubon Core Attribution Vocabulary}}}]]</div>
 
{{Concept scheme/Concepts index list by label and name
 
{{Concept scheme/Concepts index list by label and name
|collection_name={{{1|Audubon Core Attribution Vocabulary}}}
+
|collection name={{{1|Audubon Core Attribution Vocabulary}}}
|link_style=smwAsk InternalAnchorRef
+
|link style=local page link
 
}}<!--  
 
}}<!--  
// Using arraymap, loop through present userparam (containing the second level collections like Layer 1, Layer 2), passing the current collection as userparam to next template
+
// Using arraymap, loop through the current collection(s)
-->{{#arraymap: {{{userparam|Audubon Core Layer 1,Audubon Core Layer 2}}}<!--
+
-->{{#arraymap: {{{1|Audubon Core Attribution Vocabulary}}}<!--
 
   -->|,<!-- sep
 
   -->|,<!-- sep
 
   -->|§<!-- assign temporary var
 
   -->|§<!-- assign temporary var
   -->|<!--start arraymap output section:
+
   -->|<!-- start arraymap output section:
    -->{{#ask: [[Category:Concept]] [[vann:termGroup::§]] [[vann:termGroup::{{{1|Audubon Core Attribution Vocabulary}}}]]
+
 
 +
  OLD code: avoid rendering during the #ask: inline queries but use pre-rendered display property below. (AP 2020-01-27 16:31:47)
 +
 
 +
  {{#ask: [[Category:Concept]] [[vann:termGroup::§]] [[vann:termGroup::{{{1|Audubon Core Attribution Vocabulary}}}]]
 
| ? #-
 
| ? #-
 
| ?terms-internal:enLabel #-
 
| ?terms-internal:enLabel #-
Line 42: Line 134:
 
| ?terms-internal:enNote #-
 
| ?terms-internal:enNote #-
 
| ?rdfs:isDefinedBy #-
 
| ?rdfs:isDefinedBy #-
 +
| ?dcterms:identifier #-
 
| link=none
 
| link=none
 
| mainlabel=-
 
| mainlabel=-
 
| format=template
 
| format=template
| template=Concept_Table_grouped_by_Collection_(AC2)
+
| template=Concept_Table_grouped_by_Collection_2
| limit=500
+
| 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 =
 +
}}
 +
 
 +
  It is better to render the content on concept level and save it to a property and then just display that property.
 +
 
 +
    -->{{#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
 
| sort=terms-internal:lowercasePagename
 
| intro =<div style="font-weight:bold; font-size:105%; margin:1.5em 0 1em 0;">Concept definitions in [[§]]</div>
 
| intro =<div style="font-weight:bold; font-size:105%; margin:1.5em 0 1em 0;">Concept definitions in [[§]]</div>

Latest revision as of 14:47, 28 January 2020

This template displays definitions of terms in a table layout grouped by concept collections. It can be and is usually invoked by a previous #ask query.

Technical Documentation

Parameters

Bold parameters are mandatory, all other are optional:

Parameter Comment, Example Property
|1=
  • a concept collection, e.g. Audubon Core Attribution Vocabulary
|limit concepts=
  • the limit of concepts to display for each collection
  • default: 500

Note: that parameter 1 can also be provided by an #ask query wrapping this template (see use case 2).


Example/Usage

Use cases can be:

  1. to query just one collection
  2. to query multiple concept collections

 Use case 1 (to query just one collection)

Template:Concept Table grouped by Collection 1
 └─ #ask (for concepts within the given collection)
    └─ display table layout via property: terms-internal:summary (as table rows) of concept term
       (generated table layout of template: Concept Table grouped by Collection 2)

If you want to display concepts of just one collection (use case 1) use it as follows (here limited to just 2 concepts for this example):

{{Concept Table grouped by Collection 1|Audubon Core Attribution Vocabulary|limit concepts=2}}

… wich results in

Audubon Core Attribution Vocabulary

Index to Audubon Core Attribution Vocabulary
By label: Attribution Link URL  •  Attribution URL  •  Copyright Owner  •  Credit Line  •  License Logo URL  •  License URL  •  Rights  •  Source  •  UsageTerms
By concept name: ac:attributionLinkURL  •  ac:attributionLogoURL  •  ac:licenseLogoURL  •  dcterms:rights  •  dcterms:source  •  photoshop:Credit  •  xmpRights:Owner  •  xmpRights:UsageTerms  •  xmpRights:WebStatement
Concept definitions in Audubon Core Attribution Vocabulary
… further results and concept collection Audubon Core Attribution Vocabulary
ac:attributionLinkURL
Normative URI http://rs.tdwg.org/ac/terms/attributionLinkURL
Label Attribution Link URL
Definition The URL where information about ownership, attribution, etc. of the resource may be found.
Defined By http://terms.tdwg.org/wiki/Audubon_Core_Term_List#ac:attributionLinkURL
  Required: No — Repeatable: No
Notes: Audubon Core: This URL may be used in creating a clickable logo. Providers should consider making this link as specific and useful to consumers as possible, e. g., linking to a metadata page of the specific image resource rather than to a generic page describing the owner or provider of a resource.
Concept Name: ac:attributionLogoURL
Normative URI http://rs.tdwg.org/ac/terms/attributionLogoURL
Label Attribution URL
Definition The URL of the icon or logo image to appear in source attribution.
Defined By http://terms.tdwg.org/wiki/Audubon_Core_Term_List#ac:attributionLogoURL
  Required: No — Repeatable: No
Notes: Audubon Core: Entering this URL into a browser should only result in the icon (not in a webpage including the icon).



Use case 2 (to query multiple concept collections)

#ask (for multiple concept collections)
 └─ Template:Concept Table grouped by Collection 1
    └─ #ask (for concepts within previous results of concept collections)
       └─ display table layout via property: terms-internal:summary (as table rows) of concept term
          (generated table layout of template: Concept Table grouped by Collection 2)

If you want to query for multiple concept collections (usecase 2: here all collections in scheme GGBN Data Standard) you can use it with an #ask-query as follows:

{{#ask: [[Category:Concept collection]] [[skos:inScheme::GGBN Data Standard]]
| ? #-
| link=none
| mainlabel=-
| format=template
| template=Concept Table grouped by Collection 1
| searchlabel=<i>&#32;…&nbsp;see also further results and collections</i>
| limit=20
}}

Note that the #ask-parameter |limit=20 may be crucial here: 

  • depending on the size of the concept scheme this means it queries for 20 collections and within each, all (up to |limit concepts=500) concepts
  • if there are more results, then at the bottom a link will appear to see further results
  • if the concept collection is too large (over 1000 concepts) this template may not be able to show all concepts and you can get a warning like:
Warning: Template include size is too large. Some templates will not be included.

Pages that have too much template calls can be found in this maintenance category: Pages where template include size is exceeded.

Technically this template relies on values generated by template: Concept Table grouped by Collection 2 via template: Concept. This approach ensures to get a quick display response time in Semantic MediaWiki to just display cached content and not to render the content during the #ask-inline query. Template: Concept Table grouped by Collection 2 also produces the actual table layout. On a concept page it sets some thing like:

{{#set: terms-internal:summary (as table rows) of concept term={{#ask: [[{{PAGENAME}}]]
|format=template
|template=Concept Table grouped by Collection 2
|mainlabel=-
|? #-                              <!-- page name -->
|?terms-internal:enLabel #-        <!-- english label -->
|?terms-internal:enDefinition #-   <!-- english definition -->
|?terms-internal:enExample #-      <!-- english example -->
|?terms-internal:enNote #-         <!-- english notes -->
|?rdfs:isDefinedBy #-              <!-- the is definded by -->
|?dcterms:identifier #-            <!-- the URI -->
}} 
}}


Dependencies