Hilfe:Semantic MediaWiki

aus www.kruedewagen.de, Homepage von Ralf und Judith Krüdewagen (Kruedewagen)
Zur Navigation springen Zur Suche springen

Semantic Queries

The power of Semantic MediaWiki is based on queries towards properties or categories.

References:

Pages in this wiki with query examples:

A sample query

According to the sample "E-Mail" property from above, this is an example on how to query a list of pages containing such an "E-Mail" property:

{{#ask:[[E-Mail::+]]
|?E-Mail
|format=table
|mainlabel=Page
|limit=10
}}

Result:


Count

Count the number of queried items:

 {{#ask:[[Category:Dictionary]]|format=count}}

There are currently 0 items in the Category:Dictionary.

Page result column

If you want to move the result wiki page to the right you can use "?=Wiki Page" and "mainlabel=-":

Example:

{{#ask:[[-Has subobject::+]][[PropAbbrDictDefinition::+]]
|?PropAbbrDictDefinition
|?PropAbbrDictContext 
|?=Wiki Page
|format=table
|mainlabel=-
|limit=5
}}


Formatting Output using Templates

In order to format all aspects of the query output, you can assign templates to the query like

{{ #ask:  [[Category:Dictionary]] 
|?Heading 1
|?Heading 2
|?Heading 3
|format=template
|template=<name>
|introtemplate=<name>
|outrotemplate=<name>
}}

References:

Tips and Tricks

  • Use link=none if you want to format internal or external links, especially with properties from type URL. Or use "#" for each single field. See also creating-replacement-text-for-URL-in-ask-results-table.
  • Use <nowiki/> element in order to avoid line breaks if a property is not set. Useful in templates. Example:
{{#if: {{{DefinitionGlobal|}}}|[[PropGlossaryDefinitionGlobal::{{{DefinitionGlobal|}}}]]}}<nowiki/>

Examples

See following examples about using such formatting templates.

Subqueries

See Subqueries.

Query for recent changes

There is a built-in property that can be used to query for modification date. See Modification date.