Template:Ask

From semanticweb.org
Jump to: navigation, search

This template was once used to query for everything related to certain pages, the rationale being that queries that do not apply would not return results and not affect the page. However, even non-applicable queries need to be computed, and the resulting unnecessary performance impact is the reason why this template now is strongly deprecated.

Please remove this template whenever it occurs on some page.

Query templates still are a good idea, but they should be topic-specific. Examples are the templates Template:Institution data and Template:Event series. Often, such topic specific templates may also be combined with suitable annotations (e.g. categories for that topic).

<small><small>Standard queries and links:</small></small><!--
-----------------------------
 Namespace dependent queries
-----------------------------
-->
{{ #switch: {{NAMESPACE}}
 | Relation = {{#ifeq:{{{list}}}|no||<ask link=all limit=1000>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]][[{{PAGENAME}}::+]] [[{{PAGENAME}}::*]]</ask>}} [http://ontoworld.org/index.php?title=Special:Ask&limit=500&query={{urlencode:{{PAGENAME}}}}%3A%3A%2B%5B%5B{{urlencode:{{PAGENAME}}}}%3A%3A%2A%5D%5D show nr. of subjects of this relation]
 | Attribute = {{#ifeq:{{{list}}}|no||<ask link=all limit=1000>[[{{PAGENAME}}:=+]] [[{{PAGENAME}}:=*]]</ask>}} [http://ontoworld.org/index.php?title=Special:Ask&limit=500&query={{urlencode:{{PAGENAME}}}}%3A%3D%2B%5B%5B{{urlencode:{{PAGENAME}}}}%3A%3D%2A%5D%5D show nr. of pages with this attribute]
 | Category = <ask link=all limit=1000 mainlabel="related to member">[[related::<q>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]Category:{{PAGENAME}}]]</q>[[Category:*]][[has subclass::*]][[has instance::*]]</ask>}}<!--
---------------
 Other queries
---------------
--><ask link=all mainlabel=object>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]part of::{{FULLPAGENAME}}[[part of::*]]</ask><!--
--><ask link=all mainlabel=whole>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]has part::{{FULLPAGENAME}}[[has part::*]]</ask><!--
--><ask link=all mainlabel=subevent>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]subevent of::{{FULLPAGENAME}}[[subevent of::*|event]]</ask><!--
--><ask link=all mainlabel=subtopic>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]subtopic of::{{FULLPAGENAME}}[[subtopic of::*|topic]]</ask><!--
--><ask link=all mainlabel="extended object">[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]extends::{{FULLPAGENAME}}[[extends::*]][[operational on::*]]</ask><!--
--><ask link=all mainlabel="software/extension">[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]operational on::{{FULLPAGENAME}}[[operational on::*]]</ask><!--
--><ask link=all mainlabel=event>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]][[event in series::{{FULLPAGENAME}}]] [[Start date:=*|From]] [[End date:=*|To]] [[has location city::*|City]] [[has location country::*|Country]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]][[has location city::{{FULLPAGENAME}}]][[has location city::*]][[has location country::*]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]][[has location state::{{FULLPAGENAME}}]][[has location city::*]][[has location state::*]][[has location country::*]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]][[has location country::{{FULLPAGENAME}}]][[has location city::*]][[has location country::*]]</ask><!--
--><ask link=all mainlabel=object>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]in street::{{FULLPAGENAME}}[[in street::*]][[street number:=*]][[instance of::*]][[Category:*]]</ask><!--
--><ask link=all mainlabel=city>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]capital of::{{FULLPAGENAME}}[[capital of::*]]</ask><!--
--><ask link=all mainlabel=area>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]has capital::{{FULLPAGENAME}}[[has capital::*]]</ask><!--
--><ask link=all mainlabel=area>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]borders::{{FULLPAGENAME}}[[borders::*]]</ask><!--
--><ask link=all mainlabel=object>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]member of::{{FULLPAGENAME}}[[member of::*]]</ask><!--
--><ask link=all mainlabel=object>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]has member::{{FULLPAGENAME}}[[has member::*]]</ask><!--
--><ask link=all mainlabel=object>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]instance of::{{FULLPAGENAME}}[[instance of::*]]</ask><!--
--><ask link=all mainlabel=subject>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]has category::{{FULLPAGENAME}}[[has category::*]]</ask><!--
--><ask link=all mainlabel=category>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]category about::{{FULLPAGENAME}}[[category about::*|about]]</ask><!--
--><ask link=all mainlabel=country>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]uses currency::{{FULLPAGENAME}}[[uses currency::*]]</ask><!--
--><ask link=all mainlabel=country>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]uses currency::<q>instance of::{{FULLPAGENAME}}</q>[[uses currency::*]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]presented at::{{FULLPAGENAME}}[[presented at::*]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]accepted by::{{FULLPAGENAME}}[[accepted by::*]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]coded in::{{FULLPAGENAME}}[[coded in::*]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]made of::{{FULLPAGENAME}}[[made of::*]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]inverse::{{FULLPAGENAME}}[[inverse::*]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]related::{{FULLPAGENAME}}[[related::*]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]about::{{FULLPAGENAME}}[[about::*]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]has attribute::{{FULLPAGENAME}}[[has attribute::*]]</ask><!--
--><ask link=all>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]similar::{{FULLPAGENAME}}[[similar::*]]</ask><!--
--><ask link=all mainlabel=relation>[[:+||:Category:+||Relation:+||Attribute:+||Template:+]]relation equal to attribute::{{FULLPAGENAME}}[[relation equal to attribute::*|equal attribute]]</ask><!--
  NOTE the following line in this overblown badly-documented confusing mess of syntax
       BROKE on ontoworld.org around February 2007 after ontoworld.org was 
       upgraded to a newer MediaWiki and interim SMW.
       It invoked Template:Classinfo on every page that has this Ask template.
       BAD: {{locinfo}}{{classinfo|list={{{list|}}}}}{{stop info}}{{line info}}{{stop near location}}{{search|ask}}
--><!--
---------------------------------------
 Header for factbox of a category page
---------------------------------------
Create header for factbox of a category page, to be used with __TOC__ on the page, for easy navigation to the factbox, which is not at the end of the page.
-->{{ #switch: {{NAMESPACE}}
 | Category =  

==Factbox==
}}
</noinclude>
<noinclude><!--
=============
 Explanation 
=============
-->
----
This template is called from many pages of all kinds and executes many queries  to find various info related to the page, including info related to an attribute value equal to the pagename. For server efficiency it is being replaced by templates specific to a page category; they also add the category tag, see [[Relation:Category added by template]]; from each of these templates queries which cannot be applicable to pages in that category have been removed.

See its discussion page for criticism of this approach.

This template requires the [[MetaWikiPedia:ParserFunctions]] extension.

To substitute the template, use <tt>{{subst:ask|subst=subst:}}</tt>.

If the page concerned is a relation, attribute or category page it generates a table of all instances of this property, unless the template is called with parameter "list=no". The latter is useful if an adapted version of the table is made separately, to avoid duplication. 

In general it shows various directly and indirectly related pages and values. For this purpose the template contains many queries regarding specific relations and attributes.

In the case of an attribute of other than string type, a pagename which is not a valid value would produce all instances of the attribute concerned. Therefore such attributes have not been used in selection parts of the queries.

Use is made of the fact that if the set of pages selected in a query is empty, no header row or blank line, not even any blank space, is produced, so that queries which are not applicable do not clutter the output.

Some query results have CSS class "indirectlyrelevant". They are hidden by default but can be seen with the CSS code:

 .indirectlyrelevant {display: block !important }

The template provides links for searching the Web, and searching all Wikipedias. Parameter st is the search phrase, with as default the pagename (with spaces, not underscores). This part has CSS class "searchlinks". It is also hidden by default, but enabled with the CSS code:

 .searchlinks {display: block !important } 
<pre>
</noinclude>
Personal tools
Namespaces

Variants
Actions
Navigation
services
Toolbox