Help:Type Text

From semantic-mediawiki.org
Jump to: navigation, search
Text
Holds text of arbitrary length
Further Information
Provided by: Semantic MediaWiki
Added in version: 1.0
Removed in version: still in use
Table of Contents

The datatype text is used to store strings of arbitrary length, i.e. text. Since SMW 1.8.0 this datatype depreciated datatype "string" for SMWSQLStore3 and replaced it entirely in SMW 1.9.0. Thus it is now possible to use specific values in semantic queries, or to sort query results by such values. It has the following restriction:

  • If you want to store special character sequences like "::", you need to store them using the parser function #set, instead of with the more standard "[[property::value]]" notation. Thus you cannot embed "regular" semantic annotations inside a text property.

You can use some wiki markup inside a text property such as runs of ' for bold and italic, and the markup will change the appearance of the text.

Restricting values

You can use the special property "Allows value" to restrict a property to a particular set of values. For example you could limit a property like "Status" to values like "Active", "Pending", etc.

Searching within values

Since SMW 1.8.0 the first 40 characters (if more than 72 characters were stored as property value) or all 72 characters (if a maximum of 72 characters were stored as property value) are searchable as explained on the help page about selecting pages.[1] Searching within property values was not possible in earlier versions of SMW (≤ 1.7.1).

Compatibility note

In SMW 1.8.0 only this datatype still had the old behaviour for data store SMWSQLStore2 as explained on the help page for previous versions of SMW. Starting with SMW 1.9.0 you will have to change datatype declarations from "string" to this datatype if you still have these on property pages since aliasing of "string" for "text" will be removed in a later version of SMW.

Notes

  1. See this mailing list post for detailed information



Table of comparison between properties of Type 'Page' and Type 'Text'
Property of Type 'Page' Property of Type 'Text'
Naming values
Characters permitted Value has the naming restrictions that apply to page titles in MediaWiki. See the documentation at MediaWiki.org. Value may contain arbitrary text, including markup (such as that for bold and italic)
Length of value permitted Value may not be longer than 255 bytes, again because of restrictions that apply to page titles in MediaWiki Value may be longer than 255 bytes
Use of values in query statements
Support for equivalent values? Value can be made an alias of another 'Page' value. This is achieved using MediaWiki's #REDIRECT syntax, which is used to forward users from a variant page title to the target page. Value cannot be made an alias of another 'Text' value.
Wildcards Value accepts wildcards in queries Value accepts wildcards in queries
Number of characters searchable (using wildcards and comparators) Value is searchable for all 255 bytes Value is searchable for the first 40 characters (if more than 72 characters were stored as property value) or 72 characters (if a maximum of 72 characters were stored as property value).
Inverse querying Yes, property allows for inverse querying. In this way, a list of unique property values can be retrieved. No, property does not allow for inverse querying. To retrieve a set of unique property values, see some alternative approaches listed here, which may or may not offer a solution.
Annotating values Value cannot itself be annotated. However, the page associated with a value may hold semantic annotations and so it can be the basis for extended queries such as subqueries. In addition, it can be the target for another property-value pair, making it queryable in different contexts. Value cannot itself be annotated. However, it can be the target for another property-value pair, making it queryable in different contexts.
Appearance of values in printout statements
Appearance without special formatting Value returned by a query normally appears as a page link. Value returned by a query is rendered as-is in wiki text. This means that markup, such as that for bold and italic (see above), is usually rendered, although there may be exceptions.
Special formatting Value can be de-linked by setting the query parameter link= (available in most result formats) to none. Additional formatting is usually achieved by means of templates. Additional formatting is usually achieved by means of templates.
Other
Service links Property supports service links Property does not support service links



This documentation page applies to all SMW versions from 1.8 to the most current version.
Other versions: 1.0 – 1.7.1       Other languages: de

Help:Type Text en 1.8