Help:Concepts

From semantic-mediawiki.org
Jump to: navigation, search
SMW user manual
Introduction
Editing
Properties and types
Special properties
Inverse properties
Custom units

Semantic templates

Service links

Browsing interfaces
Special:Ask
Special:Browse
Semantic search
Selecting pages
Strict comparators
Displaying information
Result formats
Inline queries
Querying for queries
Concepts
Inferencing
Semantic Web
RDF export

External tools

Importing vocabulary

SMW admin manual

It is possible to store queries in Semantic MediaWiki on dedicated pages, called concepts. These pages can be viewed as "dynamic categories", i.e. as collections of pages that are not created manually, but that are computed by SMW from the description given by a query. An example could be the concept of European cities. In traditional MediaWiki installations, one may have a category called European cities that holds all such cities. In SMW, one would instead define the concept "European cities" by saying that it contains all cities that are located in Europe. No city page needs to be changed, and yet one can create many concepts about cities (such as "capital", "Italian city", or "large coastal city located at a river").

Creating a concept

A concept is a page in the Concept: namespace that is always described by a semantic query, as explained in Help:Semantic search. For example, the Concept:Semantic Web events 2008 describes certain events in 2008. Its concept page contains the following text to do that:

{{#concept:
 [[Category:Event]]
 [[Start date::> Jan 1 2008]]
 [[Start date::< Dec 31 2008]] 
 | Events in the year 2008 that have been announced on semanticweb.org. 
   To add more events, go to the page "Events" on semanticweb.org.
}}

The parser function #concept is used to define concepts. Its first parameter is a concept definition. Its second parameter is a short text that describes the concept. This description is optional and can also be left away. It is exploited in some uses of concepts in SMW to have a concise short description of the concept (e.g. as a default description in RSS feeds). The complete concept page will then show this data, and give a preview of the results.

It is possible to have other content on the concept page as well. Any normal wiki text can go before and after the use of #concept but it will not have any effect on the definition of the concept. The #concept parser function can only be used on pages in the Concept: namespace, and it can only be used once on each such page.

Using a concept

Concept pages as such can be browsed to view the contents of some concept, similar to category pages. But they can also be used in other semantic queries just like categories. For example, the following query would show all pages in the above concept of events which are also located in Germany:

[[Concept:Semantic Web events 2008]] [[located in::Germany]]

Note that this would look almost the same if we would have a category called "Semantic Web events 2008". Therefore, concepts are also like stored queries that can be reused as a kind of variable in other queries if desired.

SMW's inline queries may also use concepts, and in some cases even the concept definition is used to beautify an output. Concept definitions are also included in SMW's RDF export in form of OWL class descriptions, so that other Semantic Web tools can download and reuse the concept descriptions.

Using concepts with Semantic Forms

Concepts are also a useful feature in conjunction with the Semantic Forms extension:

  1. they can be used to define the set of values suggested through autocompletion. See this help page
  2. they can also be used as a "human-readable" argument in a query form. See this help page

Concepts within concepts

Since Semantic MediaWiki 2.1 it is possible to use concepts within concepts, i.e. if one creates concept "Events in 2014" with

{{#concept:
 [[Event::+]]
 [[Year::2014]]
 | Events that happened in 2014
}}

and concept "Events in Germany" with

{{#concept:
 [[Event::+]]
 [[Country::Germany]]
 | Events that happened in Germany
}}

these can be combined in concept "Events in Germany in 2014"

{{#concept:
 [[Concept::Events in 2014]]
 [[Concept::Events in Germany]]
 | Events that happened in 2014 in Germany
}}

Caching a concept

To improve performance it is advised to implement concept caching on the wiki. See this help page on how to administer this as a site administrator.


This documentation page applies to all SMW versions from 2.1 to the most current version.
     

Help:Concepts en 2.1