Help:Datatype "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
Datatype ID:
_txt
In this wiki: Text
Table of Contents

The datatype Text is used to store strings of arbitrary length, i.e. text. Since Semantic MediaWiki 1.8.0Released on 2 December 2012 and compatible with MW 1.17.0 - 1.22.x
(except 1.22.1).
this datatype depreciated datatype "String"Holds character sequences up to 255 characters for data store SMWSQLStore3 and replaced it entirely in Semantic MediaWiki 1.9.0Released on 3 January 2014 and compatible with MW 1.19.0 - 1.22.x.. 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 using in-text annotation syntax "[[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

Since Semantic MediaWiki 1.0Released on 31 December 2007 and compatible with MW 1.9.x - 1.12.x. you can use special property "Allows value"Lists one permissible value for a property 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. Since Semantic MediaWiki 2.4.0Released on 9 July 2016 and compatible with MW 1.19.0 - 1.27.x. special property special property "Allows pattern"Pattern to match a permissible value lets you restrict values according to patterns matching regular expressions. Semantic MediaWiki 2.4.0Released on 9 July 2016 and compatible with MW 1.19.0 - 1.27.x. also added special property "Has uniqueness constraint"Allows to restrict value annotation to be unique allowing to annotate a unique data value only once.

Starting with Semantic MediaWiki 3.0.0Released on an unknown date and compatible with MW 1.27.0 - 1.30.x. invalid data value annotations will be shown directly on the page together with a warning sign instead of just showing a warning sign as in previous versions.1 See also the page on special property "Has improper value for"Alerts in case the assigned value to a property is invalid.

Searching within values

Since Semantic MediaWiki 1.8.0Released on 2 December 2012 and compatible with MW 1.17.0 - 1.22.x
(except 1.22.1).
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.2 Searching within property values was not possible in earlier versions of Semantic MediaWiki (≤ 1.7.1).

Semantic MediaWiki 2.5.0Released on 14 March 2017 and compatible with MW 1.23.0 - 1.29.x. introduces Full-text search3 which allows to search with in more than just the maximum of 72 characters as described before.

Semantic MediaWiki 3.0.0Released on an unknown date and compatible with MW 1.27.0 - 1.30.x. introduces configuration parameter $smwgFieldTypeFeaturesSets relational database specific field type features with it's option SMW_FIELDT_CHAR_LONG4 making it possible to extend the searchable length as described here to 300 characters5 without relying on the full-text search feature.

Compatibility note

In Semantic MediaWiki 1.8.0Released on 2 December 2012 and compatible with MW 1.17.0 - 1.22.x
(except 1.22.1).
only this datatype still had the old behaviour for data store SMWSQLStore2 as explained on the help page for previous versions of Semantic MediaWiki. Starting with Semantic MediaWiki 1.9.0Released on 3 January 2014 and compatible with MW 1.19.0 - 1.22.x. you will have to change datatype declarations with special property "Has type"Assigns a datatype to a property from datatype "String"Holds character sequences up to 255 characters to this datatype if you still have these on property pages since aliasing of "String" for "Text" may be removed in any later version of Semantic MediaWiki.

Comparing the datatypes "Page" and "Text"

Table of comparison between properties of datatype "Page"Holds names of wiki pages, and displays them as a link and datatype "Text"Holds text of arbitrary length
Property of datatype "Page" Property of datatype "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



Related query syntax elements

Datatype specific

Help pageSyntax elementDescription
#ask: annotation markup raw format
#-ia
Allows embedded annotation markup within text to retain its raw (parsed) format67
#ask: highlight search tokens
#-hl
Allows to highlight search tokens within a result set8

General

Help pageSyntax elementDescription
#ask: annotation query marker
@annotation
Marks an inline query as part of an annotation9
#ask: control query marker
@control=slider
Allows to dynamically alter a result display without the need to reload a page10
#ask: deferred query marker
@deferred
Marks an inline query as deferred from regular parsing10
#ask: hierarchy depth restriction
+depth=
Restricts the hierarchy depth of a query11
#ask: printout column alignment
+align=
Defines an alignment for the content of a printout column
#ask: printout column width
+width=
Defines a width for a printout column12
#ask: printout sorting order
+order=
Defines the sorting order for printout statements (dot chain syntax)13


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:2348
  2. ^  Semantic MediaWiki: User mailing list thread " Unable to query over the last words of a long text value "
  3. ^  Semantic MediaWiki: GitHub pull request gh:smw:1481
  4. ^  Semantic MediaWiki: GitHub pull request gh:smw:2536
  5. ^  Stack Overflow: Question 3489041: Mysql::Error: Specified key was too long; max key length is 1000 bytes
  6. ^  Semantic MediaWiki: GitHub pull request gh:smw:2325
  7. ^  Semantic MediaWiki: GitHub issue gh:scite:40
  8. ^  Semantic MediaWiki: GitHub pull request gh:smw:2253
  9. ^  Semantic MediaWiki: GitHub pull request gh:smw:2572
  10. a b  Semantic MediaWiki: GitHub pull request gh:smw:2398 (Add support for @deferred mode)
  11. ^  Semantic MediaWiki: GitHub issue gh:smw:2662
  12. ^  Semantic MediaWiki: GitHub pull request gh:smw:2677
  13. ^  Semantic MediaWiki: GitHub pull request gh:smw:2073